# Set accounts for a resource

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

Set the Account references recorded in the resource's Ovok metadata. This route updates one resource and is restricted to project administrators. For propagation from a Patient to its compartment, use the Patient-specific operation and `propagate=true`.

| Method | Path |
| --- | --- |
| `POST` | `/fhir/R4/:type/:id/$set-accounts` |

## Request [#request]

Send a FHIR `Parameters` resource with one or more `accounts` references.

```bash
curl --request POST \
  --url "https://api.sandbox.ovok.com/fhir/R4/Encounter/${ENCOUNTER_ID}/\$set-accounts" \
  --header "Authorization: Bearer ${OVOK_TOKEN}" \
  --header 'Content-Type: application/fhir+json' \
  --data "{\"resourceType\":\"Parameters\",\"parameter\":[{\"name\":\"accounts\",\"valueReference\":{\"reference\":\"Account/${ACCOUNT_ID}\"}}]}"
```

| Parameter | Type | Description |
| --- | --- | --- |
| `:type` | Path | FHIR resource type. |
| `:id` | Path | ID of the resource to update. |
| `accounts` | Reference, repeated | Account references to assign. An empty list clears the account association. |

## Successful response [#successful-response]

The synchronous response is a FHIR `Parameters` resource with a `resourcesUpdated` integer, normally `1` for this single-resource operation.

| Response parameter | Type | Description |
| --- | --- | --- |
| `resourcesUpdated` | integer | Number of resources updated. |

The server rejects requests from callers without the required project administration permission.
