# Tags

Tags are your own labels for contacts: make, rename, or delete them, and tag or untag contacts in bulk. 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 tags](https://flyanote.com/docs/api/tags#list-tags): `GET /v1/tags`
* [Make a tag, or find the one with its name](https://flyanote.com/docs/api/tags#create-tag): `POST /v1/tags`
* [Rename a tag](https://flyanote.com/docs/api/tags#update-tag): `PATCH /v1/tags/{tag_id}`
* [Delete a tag](https://flyanote.com/docs/api/tags#delete-tag): `DELETE /v1/tags/{tag_id}`
* [Tag contacts](https://flyanote.com/docs/api/tags#add-tag-contacts): `POST /v1/tags/{tag_id}/contacts`
* [Untag contacts](https://flyanote.com/docs/api/tags#remove-tag-contacts): `POST /v1/tags/{tag_id}/contacts/remove`

## The account's tags

`GET /v1/tags`

A page of tags, oldest first, each with how many contacts have 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 tags
* **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\[\].contacts (required)    | a whole number. How many contacts have it. |
| data\[\].created\_at (required) | a date and time (RFC 3339).                |
| next\_cursor (required)         | text, or null. Null on the last page.      |

## Make a tag, or find the one with its name

`POST /v1/tags`

Answers the tag with this name, ignoring case: 201 if this request made it, 200 if the account had it. So a retry is safe.

Its API key needs `contacts:write`.

### Request body

A `application/json` body.

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

### Answers

* **200**: The account already had it
* **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))
* **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.                                      |
| contacts (required)    | a whole number. How many contacts have it. |
| created\_at (required) | a date and time (RFC 3339).                |

### What a 201 answers

| Field                  | What it is                                 |
| ---------------------- | ------------------------------------------ |
| id (required)          | text.                                      |
| name (required)        | text.                                      |
| contacts (required)    | a whole number. How many contacts have it. |
| created\_at (required) | a date and time (RFC 3339).                |

## Rename a tag

`PATCH /v1/tags/{tag_id}`

Its contacts keep it.

Its API key needs `contacts:write`.

### Parameters

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

### Request body

A `application/json` body.

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

### Answers

* **200**: The tag 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**:  
  * Tag not found ([tag\_not\_found](https://flyanote.com/docs/errors#tag-not-found))
* **409**:  
  * Tag name already in use ([tag\_name\_taken](https://flyanote.com/docs/errors#tag-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.                                      |
| contacts (required)    | a whole number. How many contacts have it. |
| created\_at (required) | a date and time (RFC 3339).                |

## Delete a tag

`DELETE /v1/tags/{tag_id}`

Takes it off every contact that has it. It can’t be undone, so it counts toward the account's `contact-irreversible` limit, its own, which unsubscribing a contact shares.

Its API key needs `contacts:write`.

### Parameters

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

### 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**:  
  * Tag not found ([tag\_not\_found](https://flyanote.com/docs/errors#tag-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))

## Tag contacts

`POST /v1/tags/{tag_id}/contacts`

Gives the tag to each contact named; one that has it already is left as it is. All or none.

Its API key needs `contacts:write`.

### Parameters

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

### Request body

A `application/json` body.

| Field                   | What it is                                                            |
| ----------------------- | --------------------------------------------------------------------- |
| contact\_ids (required) | a list of up to 1,000, each text. The contacts (ct\_…), at most 1000. |

### Answers

* **200**: Tagged
* **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))
  * 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                                      |
| ----------------- | ----------------------------------------------- |
| tagged (required) | a whole number. How many didn’t have it before. |

## Untag contacts

`POST /v1/tags/{tag_id}/contacts/remove`

Takes the tag off each contact named; one without it is left as it is.

Its API key needs `contacts:write`.

### Parameters

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

### Request body

A `application/json` body.

| Field                   | What it is                                                            |
| ----------------------- | --------------------------------------------------------------------- |
| contact\_ids (required) | a list of up to 1,000, each text. The contacts (ct\_…), at most 1000. |

### Answers

* **200**: Untagged
* **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))
* **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                       |
| ------------------- | -------------------------------- |
| untagged (required) | a whole number. How many had it. |
