# Topics

Topics are the lists your contacts subscribe to: make them, change or archive them, and subscribe contacts. 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 topics](https://flyanote.com/docs/api/topics#list-topics): `GET /v1/topics`
* [Make a topic (owners and admins; keys need topics:write)](https://flyanote.com/docs/api/topics#create-topic): `POST /v1/topics`
* [Change a topic (owners and admins; keys need topics:write)](https://flyanote.com/docs/api/topics#update-topic): `PATCH /v1/topics/{topic_id}`
* [Delete a topic (owners and admins; keys need topics:write)](https://flyanote.com/docs/api/topics#delete-topic): `DELETE /v1/topics/{topic_id}`
* [Archive a topic (owners and admins; keys need topics:write)](https://flyanote.com/docs/api/topics#archive-topic): `POST /v1/topics/{topic_id}/archive`
* [Subscribe contacts to a topic](https://flyanote.com/docs/api/topics#add-topic-contacts): `POST /v1/topics/{topic_id}/contacts`

## The account's topics

`GET /v1/topics`

A page of topics, oldest first, archived ones included, each with how many contacts stand where on it.

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 topics
* **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\[\].name (required)                        | text.                                                                                                                        |
| data\[\].description (required)                 | text, or null.                                                                                                               |
| data\[\].shown\_on\_preference\_page (required) | true or false. Whether the preference page offers it to people, to join or leave.                                            |
| data\[\].archived\_at (required)                | a date and time (RFC 3339), or null. When it was archived: nobody can be subscribed to it since, and no new mail goes to it. |
| data\[\].contacts (required)                    | an object. How many contacts stand where on it, as each contact’s topics says.                                               |
| data\[\].contacts.subscribed (required)         | a whole number.                                                                                                              |
| data\[\].contacts.unsubscribed (required)       | a whole number.                                                                                                              |
| data\[\].contacts.expired (required)            | a whole number.                                                                                                              |
| data\[\].created\_at (required)                 | a date and time (RFC 3339).                                                                                                  |
| next\_cursor (required)                         | text, or null. Null on the last page.                                                                                        |

## Make a topic (owners and admins; keys need `topics:write`)

`POST /v1/topics`

A topic that isn't archived with this name and these words already answers 200, so a retry is safe; one with this name in any case and other words is 409 `topic_name_taken`.

Its API key needs `topics:write`.

### Request body

A `application/json` body.

| Field                       | What it is                                                                                                 |
| --------------------------- | ---------------------------------------------------------------------------------------------------------- |
| name (required)             | text, up to 100 characters.                                                                                |
| description                 | text, up to 500 characters, or null. What people get from it, as the preference page says. Null clears it. |
| shown\_on\_preference\_page | true or false. True if left out.                                                                           |

### 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**:  
  * Topic name already in use ([topic\_name\_taken](https://flyanote.com/docs/errors#topic-name-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.                                                                                                                        |
| name (required)                        | text.                                                                                                                        |
| description (required)                 | text, or null.                                                                                                               |
| shown\_on\_preference\_page (required) | true or false. Whether the preference page offers it to people, to join or leave.                                            |
| archived\_at (required)                | a date and time (RFC 3339), or null. When it was archived: nobody can be subscribed to it since, and no new mail goes to it. |
| contacts (required)                    | an object. How many contacts stand where on it, as each contact’s topics says.                                               |
| contacts.subscribed (required)         | a whole number.                                                                                                              |
| contacts.unsubscribed (required)       | a whole number.                                                                                                              |
| contacts.expired (required)            | a whole number.                                                                                                              |
| created\_at (required)                 | a date and time (RFC 3339).                                                                                                  |

### What a 201 answers

| Field                                  | What it is                                                                                                                   |
| -------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| id (required)                          | text.                                                                                                                        |
| name (required)                        | text.                                                                                                                        |
| description (required)                 | text, or null.                                                                                                               |
| shown\_on\_preference\_page (required) | true or false. Whether the preference page offers it to people, to join or leave.                                            |
| archived\_at (required)                | a date and time (RFC 3339), or null. When it was archived: nobody can be subscribed to it since, and no new mail goes to it. |
| contacts (required)                    | an object. How many contacts stand where on it, as each contact’s topics says.                                               |
| contacts.subscribed (required)         | a whole number.                                                                                                              |
| contacts.unsubscribed (required)       | a whole number.                                                                                                              |
| contacts.expired (required)            | a whole number.                                                                                                              |
| created\_at (required)                 | a date and time (RFC 3339).                                                                                                  |

## Change a topic (owners and admins; keys need `topics:write`)

`PATCH /v1/topics/{topic_id}`

New words are the topic’s next version, which the consent given from now on names; what people agreed to before keeps the words they saw.

Its API key needs `topics:write`.

### Parameters

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

### Request body

A `application/json` body.

| Field                       | What it is                                                                                                 |
| --------------------------- | ---------------------------------------------------------------------------------------------------------- |
| name                        | text, up to 100 characters.                                                                                |
| description                 | text, up to 500 characters, or null. What people get from it, as the preference page says. Null clears it. |
| shown\_on\_preference\_page | true or false.                                                                                             |

### Answers

* **200**: The topic 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**:  
  * Topic not found ([topic\_not\_found](https://flyanote.com/docs/errors#topic-not-found))
* **409**:  
  * Topic name already in use ([topic\_name\_taken](https://flyanote.com/docs/errors#topic-name-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.                                                                                                                        |
| name (required)                        | text.                                                                                                                        |
| description (required)                 | text, or null.                                                                                                               |
| shown\_on\_preference\_page (required) | true or false. Whether the preference page offers it to people, to join or leave.                                            |
| archived\_at (required)                | a date and time (RFC 3339), or null. When it was archived: nobody can be subscribed to it since, and no new mail goes to it. |
| contacts (required)                    | an object. How many contacts stand where on it, as each contact’s topics says.                                               |
| contacts.subscribed (required)         | a whole number.                                                                                                              |
| contacts.unsubscribed (required)       | a whole number.                                                                                                              |
| contacts.expired (required)            | a whole number.                                                                                                              |
| created\_at (required)                 | a date and time (RFC 3339).                                                                                                  |

## Delete a topic (owners and admins; keys need `topics:write`)

`DELETE /v1/topics/{topic_id}`

Only a topic nobody's consent and no campaign email names: one anyone was ever subscribed to is the record of what they agreed to, and an email that names one keeps it, so either is refused with 409 `topic_in_use`. Archive it instead.

Its API key needs `topics:write`.

### Parameters

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

### Answers

* **204**: Deleted
* **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))
* **409**:  
  * Topic in use ([topic\_in\_use](https://flyanote.com/docs/errors#topic-in-use))
* **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))

## Archive a topic (owners and admins; keys need `topics:write`)

`POST /v1/topics/{topic_id}/archive`

Nobody can be subscribed to it from now on, the preference page and forms stop offering it, and no new mail goes to it. Its history stays. Archiving it again changes nothing.

Its API key needs `topics:write`.

### Parameters

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

### Answers

* **200**: The topic as it now is
* **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))
* **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.                                                                                                                        |
| name (required)                        | text.                                                                                                                        |
| description (required)                 | text, or null.                                                                                                               |
| shown\_on\_preference\_page (required) | true or false. Whether the preference page offers it to people, to join or leave.                                            |
| archived\_at (required)                | a date and time (RFC 3339), or null. When it was archived: nobody can be subscribed to it since, and no new mail goes to it. |
| contacts (required)                    | an object. How many contacts stand where on it, as each contact’s topics says.                                               |
| contacts.subscribed (required)         | a whole number.                                                                                                              |
| contacts.unsubscribed (required)       | a whole number.                                                                                                              |
| contacts.expired (required)            | a whole number.                                                                                                              |
| created\_at (required)                 | a date and time (RFC 3339).                                                                                                  |

## Subscribe contacts to a topic

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

Subscribes each contact named, at most 1000, under one way of agreeing, recorded as their consent with you as its source. Nobody is subscribed back to a topic they left, or after leaving everything, and nobody whose address is on the account's suppression list: each is counted instead. All or none.

Its API key needs `contacts:write`.

### Parameters

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

### Request body

A `application/json` body.

| Field                                 | What it is                                                                                                                                                                                                                                                                              |
| ------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| contact\_ids (required)               | a list of up to 1,000, 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**: How many of each
* **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))
  * Contact not found ([contact\_not\_found](https://flyanote.com/docs/errors#contact-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                                                 |
| -------------------------------- | ---------------------------------------------------------- |
| subscribed (required)            | a whole number.                                            |
| already\_subscribed (required)   | a whole number.                                            |
| skipped\_unsubscribed (required) | a whole number. They left this topic, or everything.       |
| skipped\_suppressed (required)   | a whole number. The account's suppression list holds them. |
| skipped\_no\_address (required)  | a whole number. They have no email address left.           |
