# Check patient name exists

Canonical page: https://docs.ovok.com/api/slim/patient/check-patient-name-exists

`POST /v1/slim/patient/check-name-exists`

Checks whether a Resident ID (the resident's nickname) is already used in your project. Use it to validate the Resident ID field before you create or rename a resident.

**Auth:** Bearer token. The caller must be a practitioner, an admin, a super admin, or hold the "System Owner" access policy. The access policy must grant `Patient:read` (an admin or super admin who holds no access policy skips this check).
**Scope:** Residents in the caller's project (from the token).

## Behaviour

- Read-only.
- Only the `name` entry with `use: "nickname"` is compared. Official and maiden names are ignored. Without a nickname entry the answer is `exists: false`.
- A match needs the same `given` tokens in the same order and the same `family` (or no `family` on both sides). Tokens are trimmed and compared case-insensitively.
- When you edit an existing resident, pass their id as `excludePatientId` so their own record does not count as a match.
- The create and update routes run the same check, so a `true` here means those requests would be refused with a 422.

## Example

```bash
curl -X POST 'https://api.sandbox.ovok.com/v1/slim/patient/check-name-exists' \
  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": [{ "use": "nickname", "given": ["Maxi"] }],
    "excludePatientId": "c3499c27-2973-0a7f-807e-fb8676a92dcb"
  }'
```

```json
{ "exists": false }
```
