# Contacts

Add the people you write to, find them, change them, and keep their subscriptions and custom fields. This page is generated from the OpenAPI document of release `main-6976024`, the one the API serves, so it lists only what the API has.

How to authenticate, where errors are explained, and the other resources are in the [API reference](https://flyanote.com/docs/api).

## Operations

* [The account's custom fields](https://flyanote.com/docs/api/contacts#list-contact-fields): `GET /v1/contact-fields`
* [Make a custom field](https://flyanote.com/docs/api/contacts#create-contact-field): `POST /v1/contact-fields`
* [Change a custom field's label](https://flyanote.com/docs/api/contacts#update-contact-field): `PATCH /v1/contact-fields/{field_id}`
* [Search the account's contacts](https://flyanote.com/docs/api/contacts#search-contacts): `POST /v1/contacts/search`
* [Add a contact](https://flyanote.com/docs/api/contacts#create-contact): `POST /v1/contacts`
* [A contact](https://flyanote.com/docs/api/contacts#get-contact): `GET /v1/contacts/{contact_id}`
* [Change a contact](https://flyanote.com/docs/api/contacts#update-contact): `PATCH /v1/contacts/{contact_id}`
* [Subscribe a contact to topics](https://flyanote.com/docs/api/contacts#add-contact-topics): `POST /v1/contacts/{contact_id}/topics`
* [Unsubscribe a contact](https://flyanote.com/docs/api/contacts#unsubscribe-contact): `POST /v1/contacts/{contact_id}/unsubscribe`

## The account's custom fields

`GET /v1/contact-fields`

Its API key needs `contacts:read`.

### Parameters

| Parameter | What it is                                            |
| --------- | ----------------------------------------------------- |
| cursor    | text, in the query. The previous page’s next\_cursor. |
| limit     | a whole number from 1 to 100, in the query.           |

### Answers

* **200**: A page of fields, oldest first
* **401**:  
  * API key missing ([api\_key\_missing](https://flyanote.com/docs/errors#api-key-missing))
  * Invalid API key ([api\_key\_invalid](https://flyanote.com/docs/errors#api-key-invalid))
  * API key revoked ([api\_key\_revoked](https://flyanote.com/docs/errors#api-key-revoked))
  * API key expired ([api\_key\_expired](https://flyanote.com/docs/errors#api-key-expired))
* **403**:  
  * Account closed ([account\_closed](https://flyanote.com/docs/errors#account-closed))
  * Missing scope ([api\_key\_scope\_missing](https://flyanote.com/docs/errors#api-key-scope-missing))
  * Test keys can't do this ([test\_key\_not\_allowed](https://flyanote.com/docs/errors#test-key-not-allowed))
* **422**:  
  * Validation failed ([validation\_failed](https://flyanote.com/docs/errors#validation-failed))
* **429**:  
  * Too many requests ([rate\_limited](https://flyanote.com/docs/errors#rate-limited))
* **500**:  
  * Internal error ([internal](https://flyanote.com/docs/errors#internal))
* **503**:  
  * API keys unavailable ([api\_keys\_unavailable](https://flyanote.com/docs/errors#api-keys-unavailable))

### What a 200 answers

| Field                           | What it is                                                                                                                |
| ------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| data (required)                 | a list, each an object.                                                                                                   |
| data\[\].id (required)          | text.                                                                                                                     |
| data\[\].key (required)         | text. How contacts’ fields and templates (contact.<key>) name it. It never changes.                                       |
| data\[\].label (required)       | text. What people see.                                                                                                    |
| data\[\].type (required)        | one of text, number, date or boolean. What every value is: text, number, date (YYYY-MM-DD), or boolean. It never changes. |
| data\[\].created\_at (required) | a date and time (RFC 3339).                                                                                               |
| next\_cursor (required)         | text, or null. Null on the last page.                                                                                     |

## Make a custom field

`POST /v1/contact-fields`

Its key and type are fixed once it's made, since templates and every stored value depend on them; its label can change. A field with this key, type, and label already answers 200, so a retry is safe; one with this key and anything else is 409 `field_key_taken`.

Its API key needs `contacts:write`.

### Request body

A `application/json` body.

| Field            | What it is                                                                                                                                                   |
| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| key (required)   | text, up to 64 characters. A lowercase letter, then up to 63 lowercase letters, digits, or underscores; not a built-in field’s name (email, first\_name, …). |
| label (required) | text, up to 100 characters.                                                                                                                                  |
| type (required)  | one of text, number, date or boolean.                                                                                                                        |

### Answers

* **200**: The account already had it, as asked
* **201**: Made
* **400**:  
  * Malformed request ([malformed\_request](https://flyanote.com/docs/errors#malformed-request))
* **401**:  
  * API key missing ([api\_key\_missing](https://flyanote.com/docs/errors#api-key-missing))
  * Invalid API key ([api\_key\_invalid](https://flyanote.com/docs/errors#api-key-invalid))
  * API key revoked ([api\_key\_revoked](https://flyanote.com/docs/errors#api-key-revoked))
  * API key expired ([api\_key\_expired](https://flyanote.com/docs/errors#api-key-expired))
* **403**:  
  * Account closed ([account\_closed](https://flyanote.com/docs/errors#account-closed))
  * Missing scope ([api\_key\_scope\_missing](https://flyanote.com/docs/errors#api-key-scope-missing))
  * Test keys can't do this ([test\_key\_not\_allowed](https://flyanote.com/docs/errors#test-key-not-allowed))
* **409**:  
  * Field key already in use ([field\_key\_taken](https://flyanote.com/docs/errors#field-key-taken))
* **413**:  
  * Request body too large ([payload\_too\_large](https://flyanote.com/docs/errors#payload-too-large))
* **415**:  
  * Unsupported media type ([unsupported\_media\_type](https://flyanote.com/docs/errors#unsupported-media-type))
* **422**:  
  * Validation failed ([validation\_failed](https://flyanote.com/docs/errors#validation-failed))
* **429**:  
  * Too many requests ([rate\_limited](https://flyanote.com/docs/errors#rate-limited))
* **500**:  
  * Internal error ([internal](https://flyanote.com/docs/errors#internal))
* **503**:  
  * API keys unavailable ([api\_keys\_unavailable](https://flyanote.com/docs/errors#api-keys-unavailable))
  * Contacts unavailable ([contacts\_unavailable](https://flyanote.com/docs/errors#contacts-unavailable))

### What a 200 answers

| Field                  | What it is                                                                                                                |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| id (required)          | text.                                                                                                                     |
| key (required)         | text. How contacts’ fields and templates (contact.<key>) name it. It never changes.                                       |
| label (required)       | text. What people see.                                                                                                    |
| type (required)        | one of text, number, date or boolean. What every value is: text, number, date (YYYY-MM-DD), or boolean. It never changes. |
| created\_at (required) | a date and time (RFC 3339).                                                                                               |

### What a 201 answers

| Field                  | What it is                                                                                                                |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| id (required)          | text.                                                                                                                     |
| key (required)         | text. How contacts’ fields and templates (contact.<key>) name it. It never changes.                                       |
| label (required)       | text. What people see.                                                                                                    |
| type (required)        | one of text, number, date or boolean. What every value is: text, number, date (YYYY-MM-DD), or boolean. It never changes. |
| created\_at (required) | a date and time (RFC 3339).                                                                                               |

## Change a custom field's label

`PATCH /v1/contact-fields/{field_id}`

Its API key needs `contacts:write`.

### Parameters

| Parameter            | What it is                                                       |
| -------------------- | ---------------------------------------------------------------- |
| field\_id (required) | text, up to 64 characters, in the path. The field’s id (fld\_…). |

### Request body

A `application/json` body.

| Field            | What it is                  |
| ---------------- | --------------------------- |
| label (required) | text, up to 100 characters. |

### Answers

* **200**: The field as it now is
* **400**:  
  * Malformed request ([malformed\_request](https://flyanote.com/docs/errors#malformed-request))
* **401**:  
  * API key missing ([api\_key\_missing](https://flyanote.com/docs/errors#api-key-missing))
  * Invalid API key ([api\_key\_invalid](https://flyanote.com/docs/errors#api-key-invalid))
  * API key revoked ([api\_key\_revoked](https://flyanote.com/docs/errors#api-key-revoked))
  * API key expired ([api\_key\_expired](https://flyanote.com/docs/errors#api-key-expired))
* **403**:  
  * Account closed ([account\_closed](https://flyanote.com/docs/errors#account-closed))
  * Missing scope ([api\_key\_scope\_missing](https://flyanote.com/docs/errors#api-key-scope-missing))
  * Test keys can't do this ([test\_key\_not\_allowed](https://flyanote.com/docs/errors#test-key-not-allowed))
* **404**:  
  * Field not found ([field\_not\_found](https://flyanote.com/docs/errors#field-not-found))
* **413**:  
  * Request body too large ([payload\_too\_large](https://flyanote.com/docs/errors#payload-too-large))
* **415**:  
  * Unsupported media type ([unsupported\_media\_type](https://flyanote.com/docs/errors#unsupported-media-type))
* **422**:  
  * Validation failed ([validation\_failed](https://flyanote.com/docs/errors#validation-failed))
* **429**:  
  * Too many requests ([rate\_limited](https://flyanote.com/docs/errors#rate-limited))
* **500**:  
  * Internal error ([internal](https://flyanote.com/docs/errors#internal))
* **503**:  
  * API keys unavailable ([api\_keys\_unavailable](https://flyanote.com/docs/errors#api-keys-unavailable))
  * Contacts unavailable ([contacts\_unavailable](https://flyanote.com/docs/errors#contacts-unavailable))

### What a 200 answers

| Field                  | What it is                                                                                                                |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| id (required)          | text.                                                                                                                     |
| key (required)         | text. How contacts’ fields and templates (contact.<key>) name it. It never changes.                                       |
| label (required)       | text. What people see.                                                                                                    |
| type (required)        | one of text, number, date or boolean. What every value is: text, number, date (YYYY-MM-DD), or boolean. It never changes. |
| created\_at (required) | a date and time (RFC 3339).                                                                                               |

## Search the account's contacts

`POST /v1/contacts/search`

A page of contacts, newest first, that match every filter given, with how many match in all. The text is in the body, never the address, since it's someone's name or address. At most 50 a page.

Its API key needs `contacts:read`.

### Request body

A `application/json` body.

| Field     | What it is                                                                         |
| --------- | ---------------------------------------------------------------------------------- |
| query     | text, up to 200 characters. Text anywhere in their name or address, ignoring case. |
| topic\_id | text. Only those subscribed to this topic.                                         |
| tag\_id   | text. Only those with this tag.                                                    |
| status    | one of active, unsubscribed\_all or bounced. Only those with this status.          |
| cursor    | text. The previous page’s next\_cursor.                                            |
| limit     | a whole number from 1 to 50.                                                       |

### Answers

* **200**: A page of contacts
* **400**:  
  * Malformed request ([malformed\_request](https://flyanote.com/docs/errors#malformed-request))
* **401**:  
  * API key missing ([api\_key\_missing](https://flyanote.com/docs/errors#api-key-missing))
  * Invalid API key ([api\_key\_invalid](https://flyanote.com/docs/errors#api-key-invalid))
  * API key revoked ([api\_key\_revoked](https://flyanote.com/docs/errors#api-key-revoked))
  * API key expired ([api\_key\_expired](https://flyanote.com/docs/errors#api-key-expired))
* **403**:  
  * Account closed ([account\_closed](https://flyanote.com/docs/errors#account-closed))
  * Missing scope ([api\_key\_scope\_missing](https://flyanote.com/docs/errors#api-key-scope-missing))
  * Test keys can't do this ([test\_key\_not\_allowed](https://flyanote.com/docs/errors#test-key-not-allowed))
* **404**:  
  * Topic not found ([topic\_not\_found](https://flyanote.com/docs/errors#topic-not-found))
  * Tag not found ([tag\_not\_found](https://flyanote.com/docs/errors#tag-not-found))
* **413**:  
  * Request body too large ([payload\_too\_large](https://flyanote.com/docs/errors#payload-too-large))
* **415**:  
  * Unsupported media type ([unsupported\_media\_type](https://flyanote.com/docs/errors#unsupported-media-type))
* **422**:  
  * Validation failed ([validation\_failed](https://flyanote.com/docs/errors#validation-failed))
* **429**:  
  * Too many requests ([rate\_limited](https://flyanote.com/docs/errors#rate-limited))
* **500**:  
  * Internal error ([internal](https://flyanote.com/docs/errors#internal))
* **503**:  
  * API keys unavailable ([api\_keys\_unavailable](https://flyanote.com/docs/errors#api-keys-unavailable))

### What a 200 answers

| Field                                    | What it is                                                                                                                                                                                                                              |
| ---------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| data (required)                          | a list, each an object.                                                                                                                                                                                                                 |
| data\[\].id (required)                   | text.                                                                                                                                                                                                                                   |
| data\[\].email (required)                | text, or null. Their email address as it was given. Null only once an erasure took every address they had.                                                                                                                              |
| data\[\].name (required)                 | text, or null. What to call them, if known.                                                                                                                                                                                             |
| data\[\].first\_name (required)          | text, or null.                                                                                                                                                                                                                          |
| data\[\].last\_name (required)           | text, or null.                                                                                                                                                                                                                          |
| data\[\].status (required)               | one of active, unsubscribed\_all or bounced. What stops all mail to them: active (nothing), unsubscribed\_all (they left everything), or bounced (their address bounced). Each topic carries its own status too.                        |
| data\[\].locale (required)               | text, or null. The language to write to them in (BCP 47).                                                                                                                                                                               |
| data\[\].time\_zone (required)           | text, or null. The IANA zone their mail is timed in.                                                                                                                                                                                    |
| data\[\].fields (required)               | an object whose values are each text, a number or true or false. Their custom field values, by each field’s key. A field with no value is left out.                                                                                     |
| data\[\].tag\_ids (required)             | a list, each text. The tags they have (tag\_…).                                                                                                                                                                                         |
| data\[\].topics (required)               | a list, each an object. Every topic they have a consent record for, with where they stand on it.                                                                                                                                        |
| data\[\].topics\[\].topic\_id (required) | text.                                                                                                                                                                                                                                   |
| data\[\].topics\[\].status (required)    | one of subscribed, unsubscribed or expired, or another value later. subscribed, unsubscribed (from this topic, or from everything since), or expired (an implied consent that ran out). Treat a value you don’t know as not subscribed. |
| data\[\].topics\[\].since (required)     | a date and time (RFC 3339). When it became so.                                                                                                                                                                                          |
| data\[\].created\_at (required)          | a date and time (RFC 3339).                                                                                                                                                                                                             |
| next\_cursor (required)                  | text, or null. Null on the last page.                                                                                                                                                                                                   |
| count (required)                         | a whole number. How many contacts match, on every page.                                                                                                                                                                                 |

## Add a contact

`POST /v1/contacts`

Adds one person by their address, with what you know of them, and subscribes them to the topics given under how they agreed. An address already in your contacts answers 200 with them as they are, and changes nothing: change them with `PATCH /v1/contacts/{contact_id}`. So a retry is safe. An address on the account's suppression list (they unsubscribed, bounced, or complained) is refused with 409 `contact_suppressed`: only they can sign up again. A role mailbox (`abuse@`, `postmaster@`) is refused with 422.

Its API key needs `contacts:write`.

### Request body

A `application/json` body.

| Field                                        | What it is                                                                                                                                                                                                                                                                              |
| -------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| email (required)                             | text, up to 320 characters.                                                                                                                                                                                                                                                             |
| name                                         | text, up to 200 characters, or null. What to call them, if not their first and last names. Null clears it.                                                                                                                                                                              |
| first\_name                                  | text, up to 200 characters, or null. Null clears it.                                                                                                                                                                                                                                    |
| last\_name                                   | text, up to 200 characters, or null. Null clears it.                                                                                                                                                                                                                                    |
| locale                                       | text, up to 35 characters, or null. The language to write to them in, as BCP 47 (fr-CA).                                                                                                                                                                                                |
| time\_zone                                   | text, up to 64 characters, or null. The IANA zone their mail is timed in (America/Halifax): yours to set, never guessed over.                                                                                                                                                           |
| country                                      | text, up to 2 characters, or null. Where you know them to be: an ISO 3166-1 alpha-2 code (CA).                                                                                                                                                                                          |
| region                                       | text, up to 6 characters, or null. With country: an ISO 3166-2 code (CA-QC).                                                                                                                                                                                                            |
| fields                                       | an object whose values are each text, a number or true or false, or null. Custom field values by each field’s key (GET /v1/contact-fields), in its type: text, a number, a YYYY-MM-DD date, or a boolean. Null or empty text clears one.                                                |
| tag\_ids                                     | a list of up to 100, each text. Tags to give them.                                                                                                                                                                                                                                      |
| topics                                       | an object. Topics to subscribe them to, and how they agreed.                                                                                                                                                                                                                            |
| topics.topic\_ids (required)                 | a list of up to 100, each text.                                                                                                                                                                                                                                                         |
| topics.agreed (required)                     | an object. How they agreed to hear from you, as the app asks it: signed\_up (online, on paper, or at an event), asked (they asked you to add them), or customer (a customer or member who hasn't said no, with roughly when). Recorded as their consent's basis with you as its source. |
| topics.agreed.choice (required)              | one of signed\_up or asked.                                                                                                                                                                                                                                                             |
| topics.agreed.on                             | a date (YYYY-MM-DD). The day it happened, if known (YYYY-MM-DD); today if not.                                                                                                                                                                                                          |
| topics.agreed.roughly                        | text. Roughly when they bought or paid: a month (YYYY-MM) or a day.                                                                                                                                                                                                                     |
| topics.statement                             | an object. The words behind the consent, kept with it as evidence. Without one, Flyanote records the words of the agreed choice the app shows.                                                                                                                                          |
| topics.statement.text (required)             | text, up to 10,000 characters. The words they agreed to, or that you used to ask, exactly as shown. No email addresses.                                                                                                                                                                 |
| topics.statement.wording\_version (required) | text. Your name for this wording and its version, changed whenever the words do.                                                                                                                                                                                                        |

### Answers

* **200**: Already a contact: nothing in the body was applied, and `topics` is empty. Change them with `PATCH /v1/contacts/{contact_id}`, and subscribe them with `POST /v1/contacts/{contact_id}/topics`.
* **201**: Added
* **400**:  
  * Malformed request ([malformed\_request](https://flyanote.com/docs/errors#malformed-request))
* **401**:  
  * API key missing ([api\_key\_missing](https://flyanote.com/docs/errors#api-key-missing))
  * Invalid API key ([api\_key\_invalid](https://flyanote.com/docs/errors#api-key-invalid))
  * API key revoked ([api\_key\_revoked](https://flyanote.com/docs/errors#api-key-revoked))
  * API key expired ([api\_key\_expired](https://flyanote.com/docs/errors#api-key-expired))
* **403**:  
  * Account closed ([account\_closed](https://flyanote.com/docs/errors#account-closed))
  * Missing scope ([api\_key\_scope\_missing](https://flyanote.com/docs/errors#api-key-scope-missing))
  * Test keys can't do this ([test\_key\_not\_allowed](https://flyanote.com/docs/errors#test-key-not-allowed))
* **404**:  
  * Tag not found ([tag\_not\_found](https://flyanote.com/docs/errors#tag-not-found))
  * Topic not found ([topic\_not\_found](https://flyanote.com/docs/errors#topic-not-found))
* **409**:  
  * Address can't be added ([contact\_suppressed](https://flyanote.com/docs/errors#contact-suppressed))
  * Topic archived ([topic\_archived](https://flyanote.com/docs/errors#topic-archived))
* **413**:  
  * Request body too large ([payload\_too\_large](https://flyanote.com/docs/errors#payload-too-large))
* **415**:  
  * Unsupported media type ([unsupported\_media\_type](https://flyanote.com/docs/errors#unsupported-media-type))
* **422**:  
  * Validation failed ([validation\_failed](https://flyanote.com/docs/errors#validation-failed))
* **429**:  
  * Too many requests ([rate\_limited](https://flyanote.com/docs/errors#rate-limited))
* **500**:  
  * Internal error ([internal](https://flyanote.com/docs/errors#internal))
* **503**:  
  * API keys unavailable ([api\_keys\_unavailable](https://flyanote.com/docs/errors#api-keys-unavailable))
  * Contacts unavailable ([contacts\_unavailable](https://flyanote.com/docs/errors#contacts-unavailable))

### What a 200 answers

| Field                                   | What it is                                                                                                                                                                                                                                                                                                                                                                                                                           |
| --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| created (required)                      | true or false. Whether this request added them; false when they were already a contact.                                                                                                                                                                                                                                                                                                                                              |
| contact (required)                      | an object. The contact as it now is. A key without contacts:read gets id alone, and none of the other properties.                                                                                                                                                                                                                                                                                                                    |
| contact.id (required)                   | text.                                                                                                                                                                                                                                                                                                                                                                                                                                |
| contact.email                           | text, or null. Their email address as it was given. Null only once an erasure took every address they had.                                                                                                                                                                                                                                                                                                                           |
| contact.name                            | text, or null. What to call them, if known.                                                                                                                                                                                                                                                                                                                                                                                          |
| contact.first\_name                     | text, or null.                                                                                                                                                                                                                                                                                                                                                                                                                       |
| contact.last\_name                      | text, or null.                                                                                                                                                                                                                                                                                                                                                                                                                       |
| contact.status                          | one of active, unsubscribed\_all or bounced. What stops all mail to them: active (nothing), unsubscribed\_all (they left everything), or bounced (their address bounced). Each topic carries its own status too.                                                                                                                                                                                                                     |
| contact.locale                          | text, or null. The language to write to them in (BCP 47).                                                                                                                                                                                                                                                                                                                                                                            |
| contact.time\_zone                      | text, or null. The IANA zone their mail is timed in.                                                                                                                                                                                                                                                                                                                                                                                 |
| contact.fields                          | an object whose values are each text, a number or true or false. Their custom field values, by each field’s key. A field with no value is left out.                                                                                                                                                                                                                                                                                  |
| contact.tag\_ids                        | a list, each text. The tags they have (tag\_…).                                                                                                                                                                                                                                                                                                                                                                                      |
| contact.topics                          | a list, each an object. Every topic they have a consent record for, with where they stand on it.                                                                                                                                                                                                                                                                                                                                     |
| contact.topics\[\].topic\_id (required) | text.                                                                                                                                                                                                                                                                                                                                                                                                                                |
| contact.topics\[\].status (required)    | one of subscribed, unsubscribed or expired, or another value later. subscribed, unsubscribed (from this topic, or from everything since), or expired (an implied consent that ran out). Treat a value you don’t know as not subscribed.                                                                                                                                                                                              |
| contact.topics\[\].since (required)     | a date and time (RFC 3339). When it became so.                                                                                                                                                                                                                                                                                                                                                                                       |
| contact.created\_at                     | a date and time (RFC 3339).                                                                                                                                                                                                                                                                                                                                                                                                          |
| topics (required)                       | a list, each an object. Each topic’s outcome, in the order given.                                                                                                                                                                                                                                                                                                                                                                    |
| topics\[\].topic\_id (required)         | text.                                                                                                                                                                                                                                                                                                                                                                                                                                |
| topics\[\].outcome (required)           | one of subscribed, already\_subscribed, skipped\_unsubscribed or skipped\_suppressed, or another value later. subscribed; already\_subscribed (what they agreed to already says as much); skipped\_unsubscribed (they left this topic or everything: only they can join again, through a sign-up form); or skipped\_suppressed (the account's suppression list holds their address). Treat a value you don't know as not subscribed. |

### What a 201 answers

| Field                                   | What it is                                                                                                                                                                                                                                                                                                                                                                                                                           |
| --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| created (required)                      | true or false. Whether this request added them; false when they were already a contact.                                                                                                                                                                                                                                                                                                                                              |
| contact (required)                      | an object. The contact as it now is. A key without contacts:read gets id alone, and none of the other properties.                                                                                                                                                                                                                                                                                                                    |
| contact.id (required)                   | text.                                                                                                                                                                                                                                                                                                                                                                                                                                |
| contact.email                           | text, or null. Their email address as it was given. Null only once an erasure took every address they had.                                                                                                                                                                                                                                                                                                                           |
| contact.name                            | text, or null. What to call them, if known.                                                                                                                                                                                                                                                                                                                                                                                          |
| contact.first\_name                     | text, or null.                                                                                                                                                                                                                                                                                                                                                                                                                       |
| contact.last\_name                      | text, or null.                                                                                                                                                                                                                                                                                                                                                                                                                       |
| contact.status                          | one of active, unsubscribed\_all or bounced. What stops all mail to them: active (nothing), unsubscribed\_all (they left everything), or bounced (their address bounced). Each topic carries its own status too.                                                                                                                                                                                                                     |
| contact.locale                          | text, or null. The language to write to them in (BCP 47).                                                                                                                                                                                                                                                                                                                                                                            |
| contact.time\_zone                      | text, or null. The IANA zone their mail is timed in.                                                                                                                                                                                                                                                                                                                                                                                 |
| contact.fields                          | an object whose values are each text, a number or true or false. Their custom field values, by each field’s key. A field with no value is left out.                                                                                                                                                                                                                                                                                  |
| contact.tag\_ids                        | a list, each text. The tags they have (tag\_…).                                                                                                                                                                                                                                                                                                                                                                                      |
| contact.topics                          | a list, each an object. Every topic they have a consent record for, with where they stand on it.                                                                                                                                                                                                                                                                                                                                     |
| contact.topics\[\].topic\_id (required) | text.                                                                                                                                                                                                                                                                                                                                                                                                                                |
| contact.topics\[\].status (required)    | one of subscribed, unsubscribed or expired, or another value later. subscribed, unsubscribed (from this topic, or from everything since), or expired (an implied consent that ran out). Treat a value you don’t know as not subscribed.                                                                                                                                                                                              |
| contact.topics\[\].since (required)     | a date and time (RFC 3339). When it became so.                                                                                                                                                                                                                                                                                                                                                                                       |
| contact.created\_at                     | a date and time (RFC 3339).                                                                                                                                                                                                                                                                                                                                                                                                          |
| topics (required)                       | a list, each an object. Each topic’s outcome, in the order given.                                                                                                                                                                                                                                                                                                                                                                    |
| topics\[\].topic\_id (required)         | text.                                                                                                                                                                                                                                                                                                                                                                                                                                |
| topics\[\].outcome (required)           | one of subscribed, already\_subscribed, skipped\_unsubscribed or skipped\_suppressed, or another value later. subscribed; already\_subscribed (what they agreed to already says as much); skipped\_unsubscribed (they left this topic or everything: only they can join again, through a sign-up form); or skipped\_suppressed (the account's suppression list holds their address). Treat a value you don't know as not subscribed. |

## A contact

`GET /v1/contacts/{contact_id}`

Its API key needs `contacts:read`.

### Parameters

| Parameter              | What it is                                                        |
| ---------------------- | ----------------------------------------------------------------- |
| contact\_id (required) | text, up to 64 characters, in the path. The contact’s id (ct\_…). |

### Answers

* **200**: The contact
* **401**:  
  * API key missing ([api\_key\_missing](https://flyanote.com/docs/errors#api-key-missing))
  * Invalid API key ([api\_key\_invalid](https://flyanote.com/docs/errors#api-key-invalid))
  * API key revoked ([api\_key\_revoked](https://flyanote.com/docs/errors#api-key-revoked))
  * API key expired ([api\_key\_expired](https://flyanote.com/docs/errors#api-key-expired))
* **403**:  
  * Account closed ([account\_closed](https://flyanote.com/docs/errors#account-closed))
  * Missing scope ([api\_key\_scope\_missing](https://flyanote.com/docs/errors#api-key-scope-missing))
  * Test keys can't do this ([test\_key\_not\_allowed](https://flyanote.com/docs/errors#test-key-not-allowed))
* **404**:  
  * Contact not found ([contact\_not\_found](https://flyanote.com/docs/errors#contact-not-found))
* **422**:  
  * Validation failed ([validation\_failed](https://flyanote.com/docs/errors#validation-failed))
* **429**:  
  * Too many requests ([rate\_limited](https://flyanote.com/docs/errors#rate-limited))
* **500**:  
  * Internal error ([internal](https://flyanote.com/docs/errors#internal))
* **503**:  
  * API keys unavailable ([api\_keys\_unavailable](https://flyanote.com/docs/errors#api-keys-unavailable))

### What a 200 answers

| Field                           | What it is                                                                                                                                                                                                                              |
| ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| id (required)                   | text.                                                                                                                                                                                                                                   |
| email (required)                | text, or null. Their email address as it was given. Null only once an erasure took every address they had.                                                                                                                              |
| name (required)                 | text, or null. What to call them, if known.                                                                                                                                                                                             |
| first\_name (required)          | text, or null.                                                                                                                                                                                                                          |
| last\_name (required)           | text, or null.                                                                                                                                                                                                                          |
| status (required)               | one of active, unsubscribed\_all or bounced. What stops all mail to them: active (nothing), unsubscribed\_all (they left everything), or bounced (their address bounced). Each topic carries its own status too.                        |
| locale (required)               | text, or null. The language to write to them in (BCP 47).                                                                                                                                                                               |
| time\_zone (required)           | text, or null. The IANA zone their mail is timed in.                                                                                                                                                                                    |
| fields (required)               | an object whose values are each text, a number or true or false. Their custom field values, by each field’s key. A field with no value is left out.                                                                                     |
| tag\_ids (required)             | a list, each text. The tags they have (tag\_…).                                                                                                                                                                                         |
| topics (required)               | a list, each an object. Every topic they have a consent record for, with where they stand on it.                                                                                                                                        |
| topics\[\].topic\_id (required) | text.                                                                                                                                                                                                                                   |
| topics\[\].status (required)    | one of subscribed, unsubscribed or expired, or another value later. subscribed, unsubscribed (from this topic, or from everything since), or expired (an implied consent that ran out). Treat a value you don’t know as not subscribed. |
| topics\[\].since (required)     | a date and time (RFC 3339). When it became so.                                                                                                                                                                                          |
| created\_at (required)          | a date and time (RFC 3339).                                                                                                                                                                                                             |

## Change a contact

`PATCH /v1/contacts/{contact_id}`

Changes what the body names and leaves the rest. Topics and tags change through their own operations, and status only by unsubscribing.

Its API key needs `contacts:write`.

### Parameters

| Parameter              | What it is                                                        |
| ---------------------- | ----------------------------------------------------------------- |
| contact\_id (required) | text, up to 64 characters, in the path. The contact’s id (ct\_…). |

### Request body

A `application/json` body.

| Field       | What it is                                                                                                                                                                                                                               |
| ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| name        | text, up to 200 characters, or null. What to call them, if not their first and last names. Null clears it.                                                                                                                               |
| first\_name | text, up to 200 characters, or null. Null clears it.                                                                                                                                                                                     |
| last\_name  | text, up to 200 characters, or null. Null clears it.                                                                                                                                                                                     |
| locale      | text, up to 35 characters, or null. The language to write to them in, as BCP 47 (fr-CA).                                                                                                                                                 |
| time\_zone  | text, up to 64 characters, or null. The IANA zone their mail is timed in (America/Halifax): yours to set, never guessed over.                                                                                                            |
| country     | text, up to 2 characters, or null. Where you know them to be: an ISO 3166-1 alpha-2 code (CA).                                                                                                                                           |
| region      | text, up to 6 characters, or null. With country: an ISO 3166-2 code (CA-QC).                                                                                                                                                             |
| fields      | an object whose values are each text, a number or true or false, or null. Custom field values by each field’s key (GET /v1/contact-fields), in its type: text, a number, a YYYY-MM-DD date, or a boolean. Null or empty text clears one. |

### Answers

* **200**: The contact as it now is
* **400**:  
  * Malformed request ([malformed\_request](https://flyanote.com/docs/errors#malformed-request))
* **401**:  
  * API key missing ([api\_key\_missing](https://flyanote.com/docs/errors#api-key-missing))
  * Invalid API key ([api\_key\_invalid](https://flyanote.com/docs/errors#api-key-invalid))
  * API key revoked ([api\_key\_revoked](https://flyanote.com/docs/errors#api-key-revoked))
  * API key expired ([api\_key\_expired](https://flyanote.com/docs/errors#api-key-expired))
* **403**:  
  * Account closed ([account\_closed](https://flyanote.com/docs/errors#account-closed))
  * Missing scope ([api\_key\_scope\_missing](https://flyanote.com/docs/errors#api-key-scope-missing))
  * Test keys can't do this ([test\_key\_not\_allowed](https://flyanote.com/docs/errors#test-key-not-allowed))
* **404**:  
  * Contact not found ([contact\_not\_found](https://flyanote.com/docs/errors#contact-not-found))
* **413**:  
  * Request body too large ([payload\_too\_large](https://flyanote.com/docs/errors#payload-too-large))
* **415**:  
  * Unsupported media type ([unsupported\_media\_type](https://flyanote.com/docs/errors#unsupported-media-type))
* **422**:  
  * Validation failed ([validation\_failed](https://flyanote.com/docs/errors#validation-failed))
* **429**:  
  * Too many requests ([rate\_limited](https://flyanote.com/docs/errors#rate-limited))
* **500**:  
  * Internal error ([internal](https://flyanote.com/docs/errors#internal))
* **503**:  
  * API keys unavailable ([api\_keys\_unavailable](https://flyanote.com/docs/errors#api-keys-unavailable))
  * Contacts unavailable ([contacts\_unavailable](https://flyanote.com/docs/errors#contacts-unavailable))

### What a 200 answers

| Field                           | What it is                                                                                                                                                                                                                              |
| ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| id (required)                   | text.                                                                                                                                                                                                                                   |
| email                           | text, or null. Their email address as it was given. Null only once an erasure took every address they had.                                                                                                                              |
| name                            | text, or null. What to call them, if known.                                                                                                                                                                                             |
| first\_name                     | text, or null.                                                                                                                                                                                                                          |
| last\_name                      | text, or null.                                                                                                                                                                                                                          |
| status                          | one of active, unsubscribed\_all or bounced. What stops all mail to them: active (nothing), unsubscribed\_all (they left everything), or bounced (their address bounced). Each topic carries its own status too.                        |
| locale                          | text, or null. The language to write to them in (BCP 47).                                                                                                                                                                               |
| time\_zone                      | text, or null. The IANA zone their mail is timed in.                                                                                                                                                                                    |
| fields                          | an object whose values are each text, a number or true or false. Their custom field values, by each field’s key. A field with no value is left out.                                                                                     |
| tag\_ids                        | a list, each text. The tags they have (tag\_…).                                                                                                                                                                                         |
| topics                          | a list, each an object. Every topic they have a consent record for, with where they stand on it.                                                                                                                                        |
| topics\[\].topic\_id (required) | text.                                                                                                                                                                                                                                   |
| topics\[\].status (required)    | one of subscribed, unsubscribed or expired, or another value later. subscribed, unsubscribed (from this topic, or from everything since), or expired (an implied consent that ran out). Treat a value you don’t know as not subscribed. |
| topics\[\].since (required)     | a date and time (RFC 3339). When it became so.                                                                                                                                                                                          |
| created\_at                     | a date and time (RFC 3339).                                                                                                                                                                                                             |

## Subscribe a contact to topics

`POST /v1/contacts/{contact_id}/topics`

Subscribes them under how they agreed, recorded as their consent with you as its source. Nobody is subscribed back to a topic they left, or after leaving everything: only they can, through a sign-up form (`skipped_unsubscribed`). One whose address is on the account's suppression list is skipped too. All the topics or none: an unknown or archived one refuses the request.

Its API key needs `contacts:write`.

### Parameters

| Parameter              | What it is                                                        |
| ---------------------- | ----------------------------------------------------------------- |
| contact\_id (required) | text, up to 64 characters, in the path. The contact’s id (ct\_…). |

### Request body

A `application/json` body.

| Field                                 | What it is                                                                                                                                                                                                                                                                              |
| ------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| topic\_ids (required)                 | a list of up to 100, each text.                                                                                                                                                                                                                                                         |
| agreed (required)                     | an object. How they agreed to hear from you, as the app asks it: signed\_up (online, on paper, or at an event), asked (they asked you to add them), or customer (a customer or member who hasn't said no, with roughly when). Recorded as their consent's basis with you as its source. |
| agreed.choice (required)              | one of signed\_up or asked.                                                                                                                                                                                                                                                             |
| agreed.on                             | a date (YYYY-MM-DD). The day it happened, if known (YYYY-MM-DD); today if not.                                                                                                                                                                                                          |
| agreed.roughly                        | text. Roughly when they bought or paid: a month (YYYY-MM) or a day.                                                                                                                                                                                                                     |
| statement                             | an object. The words behind the consent, kept with it as evidence. Without one, Flyanote records the words of the agreed choice the app shows.                                                                                                                                          |
| statement.text (required)             | text, up to 10,000 characters. The words they agreed to, or that you used to ask, exactly as shown. No email addresses.                                                                                                                                                                 |
| statement.wording\_version (required) | text. Your name for this wording and its version, changed whenever the words do.                                                                                                                                                                                                        |

### Answers

* **200**: Each topic’s outcome, in the order given, and the contact as it now is
* **400**:  
  * Malformed request ([malformed\_request](https://flyanote.com/docs/errors#malformed-request))
* **401**:  
  * API key missing ([api\_key\_missing](https://flyanote.com/docs/errors#api-key-missing))
  * Invalid API key ([api\_key\_invalid](https://flyanote.com/docs/errors#api-key-invalid))
  * API key revoked ([api\_key\_revoked](https://flyanote.com/docs/errors#api-key-revoked))
  * API key expired ([api\_key\_expired](https://flyanote.com/docs/errors#api-key-expired))
* **403**:  
  * Account closed ([account\_closed](https://flyanote.com/docs/errors#account-closed))
  * Missing scope ([api\_key\_scope\_missing](https://flyanote.com/docs/errors#api-key-scope-missing))
  * Test keys can't do this ([test\_key\_not\_allowed](https://flyanote.com/docs/errors#test-key-not-allowed))
* **404**:  
  * Contact not found ([contact\_not\_found](https://flyanote.com/docs/errors#contact-not-found))
  * Topic not found ([topic\_not\_found](https://flyanote.com/docs/errors#topic-not-found))
* **409**:  
  * Topic archived ([topic\_archived](https://flyanote.com/docs/errors#topic-archived))
* **413**:  
  * Request body too large ([payload\_too\_large](https://flyanote.com/docs/errors#payload-too-large))
* **415**:  
  * Unsupported media type ([unsupported\_media\_type](https://flyanote.com/docs/errors#unsupported-media-type))
* **422**:  
  * Validation failed ([validation\_failed](https://flyanote.com/docs/errors#validation-failed))
* **429**:  
  * Too many requests ([rate\_limited](https://flyanote.com/docs/errors#rate-limited))
* **500**:  
  * Internal error ([internal](https://flyanote.com/docs/errors#internal))
* **503**:  
  * API keys unavailable ([api\_keys\_unavailable](https://flyanote.com/docs/errors#api-keys-unavailable))
  * Contacts unavailable ([contacts\_unavailable](https://flyanote.com/docs/errors#contacts-unavailable))

### What a 200 answers

| Field                                   | What it is                                                                                                                                                                                                                                                                                                                                                                                                                           |
| --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| contact (required)                      | an object. The contact as it now is. A key without contacts:read gets id alone, and none of the other properties.                                                                                                                                                                                                                                                                                                                    |
| contact.id (required)                   | text.                                                                                                                                                                                                                                                                                                                                                                                                                                |
| contact.email                           | text, or null. Their email address as it was given. Null only once an erasure took every address they had.                                                                                                                                                                                                                                                                                                                           |
| contact.name                            | text, or null. What to call them, if known.                                                                                                                                                                                                                                                                                                                                                                                          |
| contact.first\_name                     | text, or null.                                                                                                                                                                                                                                                                                                                                                                                                                       |
| contact.last\_name                      | text, or null.                                                                                                                                                                                                                                                                                                                                                                                                                       |
| contact.status                          | one of active, unsubscribed\_all or bounced. What stops all mail to them: active (nothing), unsubscribed\_all (they left everything), or bounced (their address bounced). Each topic carries its own status too.                                                                                                                                                                                                                     |
| contact.locale                          | text, or null. The language to write to them in (BCP 47).                                                                                                                                                                                                                                                                                                                                                                            |
| contact.time\_zone                      | text, or null. The IANA zone their mail is timed in.                                                                                                                                                                                                                                                                                                                                                                                 |
| contact.fields                          | an object whose values are each text, a number or true or false. Their custom field values, by each field’s key. A field with no value is left out.                                                                                                                                                                                                                                                                                  |
| contact.tag\_ids                        | a list, each text. The tags they have (tag\_…).                                                                                                                                                                                                                                                                                                                                                                                      |
| contact.topics                          | a list, each an object. Every topic they have a consent record for, with where they stand on it.                                                                                                                                                                                                                                                                                                                                     |
| contact.topics\[\].topic\_id (required) | text.                                                                                                                                                                                                                                                                                                                                                                                                                                |
| contact.topics\[\].status (required)    | one of subscribed, unsubscribed or expired, or another value later. subscribed, unsubscribed (from this topic, or from everything since), or expired (an implied consent that ran out). Treat a value you don’t know as not subscribed.                                                                                                                                                                                              |
| contact.topics\[\].since (required)     | a date and time (RFC 3339). When it became so.                                                                                                                                                                                                                                                                                                                                                                                       |
| contact.created\_at                     | a date and time (RFC 3339).                                                                                                                                                                                                                                                                                                                                                                                                          |
| topics (required)                       | a list, each an object.                                                                                                                                                                                                                                                                                                                                                                                                              |
| topics\[\].topic\_id (required)         | text.                                                                                                                                                                                                                                                                                                                                                                                                                                |
| topics\[\].outcome (required)           | one of subscribed, already\_subscribed, skipped\_unsubscribed or skipped\_suppressed, or another value later. subscribed; already\_subscribed (what they agreed to already says as much); skipped\_unsubscribed (they left this topic or everything: only they can join again, through a sign-up form); or skipped\_suppressed (the account's suppression list holds their address). Treat a value you don't know as not subscribed. |

## Unsubscribe a contact

`POST /v1/contacts/{contact_id}/unsubscribe`

On their behalf, recorded with you as its source: from one topic (`topic_id`), or from everything (`all: true`), which also puts each of their addresses on the account's suppression list. Leaving everything is final: only they can join a topic again, through a sign-up form. Unsubscribing again changes nothing they'd notice. Each counts toward the account's `contact-irreversible` limit, its own, which deleting a tag shares.

Its API key needs `contacts:write`.

### Parameters

| Parameter              | What it is                                                        |
| ---------------------- | ----------------------------------------------------------------- |
| contact\_id (required) | text, up to 64 characters, in the path. The contact’s id (ct\_…). |

### Request body

A `application/json` body.

It takes one of 2 forms: with `topic_id`, or with `all`.

| Field     | What it is |
| --------- | ---------- |
| topic\_id | text.      |
| all       | true.      |

### Answers

* **200**: The contact as it now is
* **400**:  
  * Malformed request ([malformed\_request](https://flyanote.com/docs/errors#malformed-request))
* **401**:  
  * API key missing ([api\_key\_missing](https://flyanote.com/docs/errors#api-key-missing))
  * Invalid API key ([api\_key\_invalid](https://flyanote.com/docs/errors#api-key-invalid))
  * API key revoked ([api\_key\_revoked](https://flyanote.com/docs/errors#api-key-revoked))
  * API key expired ([api\_key\_expired](https://flyanote.com/docs/errors#api-key-expired))
* **403**:  
  * Account closed ([account\_closed](https://flyanote.com/docs/errors#account-closed))
  * Missing scope ([api\_key\_scope\_missing](https://flyanote.com/docs/errors#api-key-scope-missing))
  * Test keys can't do this ([test\_key\_not\_allowed](https://flyanote.com/docs/errors#test-key-not-allowed))
* **404**:  
  * Contact not found ([contact\_not\_found](https://flyanote.com/docs/errors#contact-not-found))
  * Topic not found ([topic\_not\_found](https://flyanote.com/docs/errors#topic-not-found))
* **413**:  
  * Request body too large ([payload\_too\_large](https://flyanote.com/docs/errors#payload-too-large))
* **415**:  
  * Unsupported media type ([unsupported\_media\_type](https://flyanote.com/docs/errors#unsupported-media-type))
* **422**:  
  * Validation failed ([validation\_failed](https://flyanote.com/docs/errors#validation-failed))
* **429**:  
  * Too many requests ([rate\_limited](https://flyanote.com/docs/errors#rate-limited))
* **500**:  
  * Internal error ([internal](https://flyanote.com/docs/errors#internal))
* **503**:  
  * API keys unavailable ([api\_keys\_unavailable](https://flyanote.com/docs/errors#api-keys-unavailable))
  * Contacts unavailable ([contacts\_unavailable](https://flyanote.com/docs/errors#contacts-unavailable))

### What a 200 answers

| Field                           | What it is                                                                                                                                                                                                                              |
| ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| id (required)                   | text.                                                                                                                                                                                                                                   |
| email                           | text, or null. Their email address as it was given. Null only once an erasure took every address they had.                                                                                                                              |
| name                            | text, or null. What to call them, if known.                                                                                                                                                                                             |
| first\_name                     | text, or null.                                                                                                                                                                                                                          |
| last\_name                      | text, or null.                                                                                                                                                                                                                          |
| status                          | one of active, unsubscribed\_all or bounced. What stops all mail to them: active (nothing), unsubscribed\_all (they left everything), or bounced (their address bounced). Each topic carries its own status too.                        |
| locale                          | text, or null. The language to write to them in (BCP 47).                                                                                                                                                                               |
| time\_zone                      | text, or null. The IANA zone their mail is timed in.                                                                                                                                                                                    |
| fields                          | an object whose values are each text, a number or true or false. Their custom field values, by each field’s key. A field with no value is left out.                                                                                     |
| tag\_ids                        | a list, each text. The tags they have (tag\_…).                                                                                                                                                                                         |
| topics                          | a list, each an object. Every topic they have a consent record for, with where they stand on it.                                                                                                                                        |
| topics\[\].topic\_id (required) | text.                                                                                                                                                                                                                                   |
| topics\[\].status (required)    | one of subscribed, unsubscribed or expired, or another value later. subscribed, unsubscribed (from this topic, or from everything since), or expired (an implied consent that ran out). Treat a value you don’t know as not subscribed. |
| topics\[\].since (required)     | a date and time (RFC 3339). When it became so.                                                                                                                                                                                          |
| created\_at                     | a date and time (RFC 3339).                                                                                                                                                                                                             |
