# Validate a resource

Canonical page: https://docs.ovok.com/primitives/validate-resource

Send a FHIR resource to `$validate` to check its structure and constraints without creating or updating it. The route is resource-type level: the type in the URL must match `resourceType` in the request body.

| Method | Path |
| --- | --- |
| `POST` | `/fhir/R4/:type/$validate` |

## Request [#request]

The request body is the resource to validate. This example validates a Patient. Replace the illustrative fields with a valid resource for your project.

```bash
curl --request POST \
  --url 'https://api.sandbox.ovok.com/fhir/R4/Patient/$validate' \
  --header "Authorization: Bearer ${OVOK_TOKEN}" \
  --header 'Content-Type: application/fhir+json' \
  --data '{"resourceType":"Patient","active":true}'
```

| Request part | Description |
| --- | --- |
| `:type` | FHIR resource type, such as `Patient` or `Observation`. |
| Body | The resource being checked. It is not persisted by this operation. |

## Response [#response]

On success the operation returns `200 OK` with no resource body. If validation fails, the server returns a FHIR `OperationOutcome` whose `issue` entries describe the errors or warnings.

| `OperationOutcome` field | Description |
| --- | --- |
| `issue[].severity` | Whether an issue is fatal, an error, a warning, or informational. |
| `issue[].code` | Machine-readable category for the issue. |
| `issue[].details` | Optional coded or human-readable explanation. |
| `issue[].expression` | Optional location in the resource that caused the issue. |

See the [FHIR R4 `$validate` operation](https://hl7.org/fhir/R4/resource-operation-validate.html) for the standard operation definition.
