---
agentTools:
  projectIndex: https://docs.oncallhealth.io/llms.txt
---

# Working with custom fields

If your organization has custom fields associated with your patient roster, you can update and retrieve these values through this API.

When retreiving a contact, you will be given two related fields:

* custom\_field\_names
* custom\_field\_values

The `custom_field_names` field maps the global identifier of your custom fields to their human-readable name. This field is read-only and is for informational purposes only.

The `custom_field_values` field maps these same field IDs to the value contained for each contact that you are interacting with. This field can be written to, in case you need to update a custom field.

For example, consider Jane Doe:

```json
{
  "url": "https://api.oncallhealth.ca/contacts/1234/",
  "name": "Jane Doe",
  "email": "patient@email.com",
  "phone": "2125551542",
  "sex": "Unknown",
  "date_of_birth": "1970-01-01",
  "custom_field_names": {
        452: "EMR id",
        664: "Has submitted forms?"
  },
  "custom_field_values": {
        452: "Ax1A2",
        664: true
  },
  "appointments": "https://api.oncallhealth.ca/contacts/1234/appointments/",
}
```

We can see that Jane Doe has two custom fields: "EMR id". which has ID `452`, and "Has submitted forms?" which has ID `664`.  By matching the IDs with the `custom_field_values` field, we can see that Jane Doe has an "EMR id" value of "Ax1A2" and "Has submitted forms?" is true.

To update the value of a custom field, simply `PATCH` the contact with the fields you intend to change. For example, if we `PATCH https://api.oncallhealth.ca/contacts/1234/` with the following body:

```json
  "custom_field_values": {
  	452: "Mx978A",
  }
```

We will change the EMR id of Jane Doe to be "Mx978A".