> For the complete documentation index, see [llms.txt](https://guide.fariaedu.com/integrations-portal/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://guide.fariaedu.com/integrations-portal/openapply/public-rest-apis/v3/contacts.md).

# Contacts

This page describes all the APIs relating to contacts. `source_campaign` and `utm` are independent: `utm` holds the marketing parameters captured when the contact arrived, is null when nothing was captured or the school has no CRM module, and never falls back to `source_campaign`. Legacy UTM values held in custom fields are historical and are not reconciled with the `utm` object.

## GET /api/v3/contacts

> Get all Contacts

```json
{"openapi":"3.0.1","info":{"title":"openapply","version":"3.0.0"},"tags":[{"name":"Contacts","description":"This page describes all the APIs relating to contacts. `source_campaign` and `utm` are independent: `utm` holds the marketing parameters captured when the contact arrived, is null when nothing was captured or the school has no CRM module, and never falls back to `source_campaign`. Legacy UTM values held in custom fields are historical and are not reconciled with the `utm` object."}],"servers":[{"url":"https://api.openapply.com","description":"CAN region auth server"},{"url":"https://api.openapply.cn","description":"CN region auth server"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}}},"paths":{"/api/v3/contacts":{"get":{"summary":"Get all Contacts","tags":["Contacts"],"operationId":"listContacts","parameters":[{"name":"page","in":"query","required":false,"description":"The page number of results to return.","schema":{"type":"integer","minimum":1,"default":1}},{"name":"per_page","in":"query","required":false,"description":"Request for how many records to return.","schema":{"type":"integer","minimum":1,"maximum":200,"default":50}},{"name":"count","in":"query","required":false,"description":"Synonym for per_page","schema":{"type":"integer"}}],"responses":{"200":{"description":"successful","content":{"application/json":{}}}}}}}}
```

## POST /api/v3/contacts

> Create a New Contact

```json
{"openapi":"3.0.1","info":{"title":"openapply","version":"3.0.0"},"tags":[{"name":"Contacts","description":"This page describes all the APIs relating to contacts. `source_campaign` and `utm` are independent: `utm` holds the marketing parameters captured when the contact arrived, is null when nothing was captured or the school has no CRM module, and never falls back to `source_campaign`. Legacy UTM values held in custom fields are historical and are not reconciled with the `utm` object."}],"servers":[{"url":"https://api.openapply.com","description":"CAN region auth server"},{"url":"https://api.openapply.cn","description":"CN region auth server"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}}},"paths":{"/api/v3/contacts":{"post":{"summary":"Create a New Contact","tags":["Contacts"],"operationId":"createContact","parameters":[],"responses":{"200":{"description":"successful","content":{"application/json":{}}},"422":{"description":"invalid source_campaign_id structure","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"first_name":{"type":"string"},"last_name":{"type":"string"},"phone_number":{"type":"string"},"email":{"type":"string"},"employer_company":{"type":"string"},"job_title":{"type":"string"},"applied_academic_year":{"type":"string"},"applied_grade":{"type":"string"},"campus_id":{"type":"integer"},"agent_id":{"type":"array","items":{"type":"integer"}},"tag_ids":{"type":"array","items":{"type":"integer"}},"students":{"type":"array","items":{"type":"object","properties":{"first_name":{"type":"string"},"last_name":{"type":"string"},"birthday":{"type":"string"},"gender":{"type":"string"},"nationality":{"type":"string"}}}},"source_campaign_id":{"type":"integer"},"contact_form_id":{"type":"integer","description":"Links the contact to this contact form (see GET /api/v3/forms?kind=contact). Set only on create; an id that is not a contact form of the school is refused with 422."},"utm":{"type":"object","description":"Marketing attribution, set only when the contact is created and never changed afterwards. Independent of source_campaign_id. Needs at least one of source, medium, campaign, term, content or gclid. Unknown keys, non-string or over-long values, and a school with UTM attribution switched off are refused with 422.","properties":{"source":{"type":"string","maxLength":255},"medium":{"type":"string","maxLength":255},"campaign":{"type":"string","maxLength":500},"term":{"type":"string","maxLength":500},"content":{"type":"string","maxLength":500},"gclid":{"type":"string","maxLength":255},"referrer_url":{"type":"string"},"landing_url":{"type":"string"}},"additionalProperties":false}},"required":["first_name","last_name","phone_number","email"]}}}}}}}}
```

## GET /api/v3/contacts/{id}

> Get a Contact

```json
{"openapi":"3.0.1","info":{"title":"openapply","version":"3.0.0"},"tags":[{"name":"Contacts","description":"This page describes all the APIs relating to contacts. `source_campaign` and `utm` are independent: `utm` holds the marketing parameters captured when the contact arrived, is null when nothing was captured or the school has no CRM module, and never falls back to `source_campaign`. Legacy UTM values held in custom fields are historical and are not reconciled with the `utm` object."}],"servers":[{"url":"https://api.openapply.com","description":"CAN region auth server"},{"url":"https://api.openapply.cn","description":"CN region auth server"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}}},"paths":{"/api/v3/contacts/{id}":{"get":{"summary":"Get a Contact","tags":["Contacts"],"operationId":"getContact","parameters":[{"name":"id","in":"path","description":"Serial database ID that uniquely identifies a contact record in OpenApply","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"successful","content":{"application/json":{}}}}}}}}
```

## PUT /api/v3/contacts/{id}

> Update a Contact

```json
{"openapi":"3.0.1","info":{"title":"openapply","version":"3.0.0"},"tags":[{"name":"Contacts","description":"This page describes all the APIs relating to contacts. `source_campaign` and `utm` are independent: `utm` holds the marketing parameters captured when the contact arrived, is null when nothing was captured or the school has no CRM module, and never falls back to `source_campaign`. Legacy UTM values held in custom fields are historical and are not reconciled with the `utm` object."}],"servers":[{"url":"https://api.openapply.com","description":"CAN region auth server"},{"url":"https://api.openapply.cn","description":"CN region auth server"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}}},"paths":{"/api/v3/contacts/{id}":{"put":{"summary":"Update a Contact","tags":["Contacts"],"operationId":"updateContact","parameters":[{"name":"id","in":"path","description":"Serial database ID that uniquely identifies a contact record in OpenApply","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"successful","content":{"application/json":{}}},"404":{"description":"not_found","content":{"application/json":{}}},"422":{"description":"utm sent on update","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"first_name":{"type":"string"},"last_name":{"type":"string"},"phone_number":{"type":"string"},"email":{"type":"string"},"employer_company":{"type":"string"},"job_title":{"type":"string"},"applied_academic_year":{"type":"string"},"applied_grade":{"type":"string"},"campus_id":{"type":"integer"},"agent_id":{"type":"array","items":{"type":"integer"}},"tag_ids":{"type":"array","items":{"type":"integer"}},"students":{"type":"array","items":{"type":"object","properties":{"first_name":{"type":"string"},"last_name":{"type":"string"},"birthday":{"type":"string"},"gender":{"type":"string"},"nationality":{"type":"string"}}}},"source_campaign_id":{"type":"integer"}}}}}}}}}}
```

## Update contact custom fields

> Updates custom field values of a contact by field ID. Contact-level values (Parent fields of the\
> contact form) go in \`custom\_fields\`; values of the contact's student (Student fields) go in\
> \`students\[0].custom\_fields\`. Get the field IDs from \`GET /api/v3/fields?record\_type=contact\`.\
> \
> Values are strings, or arrays of option IDs for checkbox fields; option fields take option IDs,\
> dates use \`YYYY-MM-DD\`, and \`null\` clears a value. Required fields are not enforced.\
> Without \`contact\_form\_id\` the contact's own contact form is used, or the school's original contact\
> form when it has none. Nothing is saved when any value is invalid.<br>

```json
{"openapi":"3.0.1","info":{"title":"openapply","version":"3.0.0"},"tags":[{"name":"Contacts","description":"This page describes all the APIs relating to contacts. `source_campaign` and `utm` are independent: `utm` holds the marketing parameters captured when the contact arrived, is null when nothing was captured or the school has no CRM module, and never falls back to `source_campaign`. Legacy UTM values held in custom fields are historical and are not reconciled with the `utm` object."}],"servers":[{"url":"https://api.openapply.com","description":"CAN region auth server"},{"url":"https://api.openapply.cn","description":"CN region auth server"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}}},"paths":{"/api/v3/contacts/{id}/custom_fields":{"patch":{"summary":"Update contact custom fields","tags":["Contacts"],"operationId":"updateContactCustomFields","description":"Updates custom field values of a contact by field ID. Contact-level values (Parent fields of the\ncontact form) go in `custom_fields`; values of the contact's student (Student fields) go in\n`students[0].custom_fields`. Get the field IDs from `GET /api/v3/fields?record_type=contact`.\n\nValues are strings, or arrays of option IDs for checkbox fields; option fields take option IDs,\ndates use `YYYY-MM-DD`, and `null` clears a value. Required fields are not enforced.\nWithout `contact_form_id` the contact's own contact form is used, or the school's original contact\nform when it has none. Nothing is saved when any value is invalid.\n","parameters":[{"name":"id","in":"path","description":"Serial database ID that uniquely identifies a contact record in OpenApply","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"successful","content":{"application/json":{"schema":{"type":"object","properties":{"contact":{"type":"object","properties":{"id":{"type":"integer"},"contact_form_id":{"type":"integer"},"custom_fields":{"type":"object","additionalProperties":true},"students":{"type":"array","items":{"type":"object","properties":{"custom_fields":{"type":"object","additionalProperties":true}}}}},"required":["id","contact_form_id","custom_fields","students"]}}}}}},"404":{"description":"not_found","content":{"application/json":{}}},"422":{"description":"unprocessable_entity","content":{"application/json":{"schema":{"type":"object","properties":{"errors":{"type":"array","items":{"type":"string"}}},"required":["errors"]}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"contact_form_id":{"type":"integer","description":"Contact form the field IDs belong to"},"custom_fields":{"type":"object","additionalProperties":true},"students":{"type":"array","maxItems":1,"items":{"type":"object","properties":{"custom_fields":{"type":"object","additionalProperties":true}}}}}}}}}}}}}
```
