# DEFAULT_PATIENT_ACCESS_POLICY

Canonical page: https://docs.ovok.com/settings-and-features/settings/default-patient-access-policy

The AccessPolicy that a new patient receives when Ovok creates their account: through self-registration or a care invitation.

| | |
| --- | --- |
| Type | Text setting, stored as the project's `defaultPatientAccessPolicy` field |
| Change with | `PUT /v1/project/settings/values/DEFAULT_PATIENT_ACCESS_POLICY` |
| Value | `AccessPolicy/<id>` of an AccessPolicy **in this project**, or `null` to remove it |
| Who can change it | Project admin |
| When unset | Patient registration and patient invitations are refused |
| Set on new projects | Not set by any project-creation route |
| Inherited | No. A child project reads only its own value. |

## Why it exists [#why-it-exists]

A project membership with no AccessPolicy is not limited by one. For that reason Ovok will not create a patient without a policy: registration and the care invitation refuse until this setting is set. Set it once, to a policy that holds only what a brand-new patient should be able to do, such as reading and writing their own records.

## Set it [#set-it]

```bash
curl --request PUT \
  --url 'https://api.sandbox.ovok.com/v1/project/settings/values/DEFAULT_PATIENT_ACCESS_POLICY' \
  --header "Authorization: Bearer ${OVOK_TOKEN}" \
  --header 'Content-Type: application/json' \
  --data '{"value":"AccessPolicy/patient-policy-id"}'
```

The response is the full settings record; the value appears under `values`. Send `{"value":null}` to remove it.

| Response | Meaning |
| --- | --- |
| `422` with `code` [`INVALID_SETTING_VALUE`](/errors/invalid-setting-value) | The value is not `AccessPolicy/<id>`, no such policy exists, or the policy belongs to another project. |
| `400` with `code` [`UNKNOWN_SETTING`](/errors/unknown-setting) | The key is misspelled. The body lists `acceptedKeys`. |
| `403` | The caller is not a project admin. |
| `409` | The project changed during the write. Read the settings again and retry. |

To write the policy itself, see [access policies](/access-policies) and the [policy model](/access-policies/policy-model).

## Where Ovok reads it [#where-ovok-reads-it]

| Route | What it does with the policy | When it is missing |
| --- | --- | --- |
| `POST /v1/auth/tenant/Patient/register` | Gives it to the new patient. | `403` `Registration is not enabled for this project.`, the same answer as when the switch is off |
| `POST /v1/invites/care` (formerly `/v1/invites/patient`) | Gives it to a patient account it creates for a new email address. | `409`, `error` [`invitation_not_configured`](/errors/invitation-not-configured) |

`GET /v1/project/settings` also reads it: while it is missing or names a policy that cannot be read, [`PATIENT_REGISTRATION_ENABLED`](/settings-and-features/settings/patient-registration-enabled) reports `false`, and while it is missing, [`PATIENT_INVITATION_ENABLED`](/settings-and-features/settings/patient-invitation-enabled) reports `false`, whatever was saved.

## Gotchas [#gotchas]

- **A parent's policy id does not work in a child project.** Creating a child with `POST /v1/slim/project/child` copies the parent's AccessPolicies under new ids. Read the child's own policies and use those ids.
- **Changing it does not touch patients who already have an account.** It applies to patients created afterwards.
- **Off and "not configured" look the same on registration.** Both answer `403` with the same message. If you did not turn registration off, check this setting first.

## Related [#related]

- [Access policies](/access-policies)
- [Default access policies](/access-policies/defaults)
- [Patient registration](/authentication/patient-registration)
- [Invite a patient](/invitations/invite-a-patient)
- [Set up your project](/authentication/project-setup#4-give-new-users-an-accesspolicy)
- [DEFAULT_PRACTITIONER_ACCESS_POLICY](/settings-and-features/settings/default-practitioner-access-policy)
