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.
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) - Invalid API key (
api_key_invalid) - API key revoked (
api_key_revoked) - API key expired (
api_key_expired)
- API key missing (
- 403:
- Account closed (
account_closed) - Missing scope (
api_key_scope_missing) - Test keys can't do this (
test_key_not_allowed)
- Account closed (
- 422:
- Validation failed (
validation_failed)
- Validation failed (
- 429:
- Too many requests (
rate_limited)
- Too many requests (
- 500:
- Internal error (
internal)
- Internal error (
- 503:
- API keys unavailable (
api_keys_unavailable)
- 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)
- Malformed request (
- 401:
- API key missing (
api_key_missing) - Invalid API key (
api_key_invalid) - API key revoked (
api_key_revoked) - API key expired (
api_key_expired)
- API key missing (
- 403:
- Account closed (
account_closed) - Missing scope (
api_key_scope_missing) - Test keys can't do this (
test_key_not_allowed)
- Account closed (
- 409:
- Topic name already in use (
topic_name_taken)
- Topic name already in use (
- 413:
- Request body too large (
payload_too_large)
- Request body too large (
- 415:
- Unsupported media type (
unsupported_media_type)
- Unsupported media type (
- 422:
- Validation failed (
validation_failed)
- Validation failed (
- 429:
- Too many requests (
rate_limited)
- Too many requests (
- 500:
- Internal error (
internal)
- Internal error (
- 503:
- API keys unavailable (
api_keys_unavailable) - Contacts unavailable (
contacts_unavailable)
- API keys 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)
- Malformed request (
- 401:
- API key missing (
api_key_missing) - Invalid API key (
api_key_invalid) - API key revoked (
api_key_revoked) - API key expired (
api_key_expired)
- API key missing (
- 403:
- Account closed (
account_closed) - Missing scope (
api_key_scope_missing) - Test keys can't do this (
test_key_not_allowed)
- Account closed (
- 404:
- Topic not found (
topic_not_found)
- Topic not found (
- 409:
- Topic name already in use (
topic_name_taken)
- Topic name already in use (
- 413:
- Request body too large (
payload_too_large)
- Request body too large (
- 415:
- Unsupported media type (
unsupported_media_type)
- Unsupported media type (
- 422:
- Validation failed (
validation_failed)
- Validation failed (
- 429:
- Too many requests (
rate_limited)
- Too many requests (
- 500:
- Internal error (
internal)
- Internal error (
- 503:
- API keys unavailable (
api_keys_unavailable) - Contacts unavailable (
contacts_unavailable)
- API keys 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) - Invalid API key (
api_key_invalid) - API key revoked (
api_key_revoked) - API key expired (
api_key_expired)
- API key missing (
- 403:
- Account closed (
account_closed) - Missing scope (
api_key_scope_missing) - Test keys can't do this (
test_key_not_allowed)
- Account closed (
- 404:
- Topic not found (
topic_not_found)
- Topic not found (
- 409:
- Topic in use (
topic_in_use)
- Topic in use (
- 422:
- Validation failed (
validation_failed)
- Validation failed (
- 429:
- Too many requests (
rate_limited)
- Too many requests (
- 500:
- Internal error (
internal)
- Internal error (
- 503:
- API keys unavailable (
api_keys_unavailable) - Contacts unavailable (
contacts_unavailable)
- API keys 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) - Invalid API key (
api_key_invalid) - API key revoked (
api_key_revoked) - API key expired (
api_key_expired)
- API key missing (
- 403:
- Account closed (
account_closed) - Missing scope (
api_key_scope_missing) - Test keys can't do this (
test_key_not_allowed)
- Account closed (
- 404:
- Topic not found (
topic_not_found)
- Topic not found (
- 422:
- Validation failed (
validation_failed)
- Validation failed (
- 429:
- Too many requests (
rate_limited)
- Too many requests (
- 500:
- Internal error (
internal)
- Internal error (
- 503:
- API keys unavailable (
api_keys_unavailable) - Contacts unavailable (
contacts_unavailable)
- API keys 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)
- Malformed request (
- 401:
- API key missing (
api_key_missing) - Invalid API key (
api_key_invalid) - API key revoked (
api_key_revoked) - API key expired (
api_key_expired)
- API key missing (
- 403:
- Account closed (
account_closed) - Missing scope (
api_key_scope_missing) - Test keys can't do this (
test_key_not_allowed)
- Account closed (
- 404:
- Topic not found (
topic_not_found) - Contact not found (
contact_not_found)
- Topic not found (
- 409:
- Topic archived (
topic_archived)
- Topic archived (
- 413:
- Request body too large (
payload_too_large)
- Request body too large (
- 415:
- Unsupported media type (
unsupported_media_type)
- Unsupported media type (
- 422:
- Validation failed (
validation_failed)
- Validation failed (
- 429:
- Too many requests (
rate_limited)
- Too many requests (
- 500:
- Internal error (
internal)
- Internal error (
- 503:
- API keys unavailable (
api_keys_unavailable) - Contacts unavailable (
contacts_unavailable)
- API keys 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. |