> For the complete documentation index, see [llms.txt](https://docs.alternativepayments.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.alternativepayments.io/api-reference/tags.md).

# Tags

## Tag a customer

> Apply a custom tag to a customer. Applying a tag the customer already has is a no-op. System tags cannot be applied manually.

```json
{"openapi":"3.1.1","info":{"title":"Alternative Payments","version":"1.2.0"},"servers":[{"url":"http://public-api.alternativepayments.io"}],"security":[{"OAuth2ClientCredentials":["tags:write"]}],"components":{"securitySchemes":{"OAuth2ClientCredentials":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"/oauth/token","scopes":{"checkout:read":"Read checkout data","checkout:write":"Create checkout tokens","customers:read":"Read customers and payment methods","customers:write":"Create and update customers and payment methods","invoices:read":"Read invoices","invoices:write":"Create and update invoices","payments:read":"Read payments and payment requests","payments:write":"Create payments and payment requests","payouts:read":"Read payouts","refunds:read":"Read refunds","refunds:write":"Create refunds","tags:read":"Read customer tags","tags:write":"Create, update and delete customer tags, and add or remove them on customers","webhooks:read":"Read webhook subscriptions and events","webhooks:write":"Manage webhook subscriptions"}}}}},"schemas":{"HttpError":{"properties":{"code":{"type":"string"},"message":{"type":"string"},"validation_errors":{"additionalProperties":{"type":"string"},"type":"object"}},"type":"object"},"TagCustomerBody":{"properties":{"tag_id":{"type":"string"}},"type":"object"}}},"paths":{"/customers/{customer_id}/tags":{"post":{"description":"Apply a custom tag to a customer. Applying a tag the customer already has is a no-op. System tags cannot be applied manually.","operationId":"tagCustomer","parameters":[{"schema":{"type":"string"},"description":"Customer ID","in":"path","name":"customer_id","required":true}],"responses":{"204":{"description":"No Content"},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}},"404":{"description":"`CUSTOMER_NOT_FOUND` (unknown, other partner's, or archived customer; restore an archived customer before tagging it) or `TAG_NOT_FOUND`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}},"422":{"description":"Unprocessable Entity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}}},"summary":"Tag a customer","tags":["Tags"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TagCustomerBody"}}},"description":"Tag to apply","required":true}}}}}
```

## Remove a tag from a customer

> Remove a custom tag from a customer. Removing a tag the customer does not have is a no-op. System tags cannot be removed manually.

```json
{"openapi":"3.1.1","info":{"title":"Alternative Payments","version":"1.2.0"},"servers":[{"url":"http://public-api.alternativepayments.io"}],"security":[{"OAuth2ClientCredentials":["tags:write"]}],"components":{"securitySchemes":{"OAuth2ClientCredentials":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"/oauth/token","scopes":{"checkout:read":"Read checkout data","checkout:write":"Create checkout tokens","customers:read":"Read customers and payment methods","customers:write":"Create and update customers and payment methods","invoices:read":"Read invoices","invoices:write":"Create and update invoices","payments:read":"Read payments and payment requests","payments:write":"Create payments and payment requests","payouts:read":"Read payouts","refunds:read":"Read refunds","refunds:write":"Create refunds","tags:read":"Read customer tags","tags:write":"Create, update and delete customer tags, and add or remove them on customers","webhooks:read":"Read webhook subscriptions and events","webhooks:write":"Manage webhook subscriptions"}}}}},"schemas":{"HttpError":{"properties":{"code":{"type":"string"},"message":{"type":"string"},"validation_errors":{"additionalProperties":{"type":"string"},"type":"object"}},"type":"object"}}},"paths":{"/customers/{customer_id}/tags/{tag_id}":{"delete":{"description":"Remove a custom tag from a customer. Removing a tag the customer does not have is a no-op. System tags cannot be removed manually.","operationId":"untagCustomer","parameters":[{"schema":{"type":"string"},"description":"Customer ID","in":"path","name":"customer_id","required":true},{"schema":{"type":"string"},"description":"Tag ID","in":"path","name":"tag_id","required":true}],"responses":{"204":{"description":"No Content"},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}},"422":{"description":"Unprocessable Entity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}}},"summary":"Remove a tag from a customer","tags":["Tags"]}}}}
```

## Add or remove a tag on many customers

> Add (operation=add) or remove (operation=remove) a custom tag across up to 200 distinct customers (duplicate IDs are ignored). Returns 200 with per-customer results; only whole-batch validation errors return 4xx.

```json
{"openapi":"3.1.1","info":{"title":"Alternative Payments","version":"1.2.0"},"servers":[{"url":"http://public-api.alternativepayments.io"}],"security":[{"OAuth2ClientCredentials":["tags:write"]}],"components":{"securitySchemes":{"OAuth2ClientCredentials":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"/oauth/token","scopes":{"checkout:read":"Read checkout data","checkout:write":"Create checkout tokens","customers:read":"Read customers and payment methods","customers:write":"Create and update customers and payment methods","invoices:read":"Read invoices","invoices:write":"Create and update invoices","payments:read":"Read payments and payment requests","payments:write":"Create payments and payment requests","payouts:read":"Read payouts","refunds:read":"Read refunds","refunds:write":"Create refunds","tags:read":"Read customer tags","tags:write":"Create, update and delete customer tags, and add or remove them on customers","webhooks:read":"Read webhook subscriptions and events","webhooks:write":"Manage webhook subscriptions"}}}}},"schemas":{"BatchUpdateCustomerTagsReply":{"properties":{"applied":{"items":{"type":"string"},"type":"array"},"failed":{"items":{"$ref":"#/components/schemas/BatchUpdateCustomerTagResult"},"type":"array"},"skipped":{"items":{"$ref":"#/components/schemas/BatchUpdateCustomerTagResult"},"type":"array"}},"type":"object"},"BatchUpdateCustomerTagResult":{"properties":{"customer_id":{"type":"string"},"reason":{"type":"string"}},"type":"object"},"HttpError":{"properties":{"code":{"type":"string"},"message":{"type":"string"},"validation_errors":{"additionalProperties":{"type":"string"},"type":"object"}},"type":"object"},"BatchUpdateCustomerTagsBody":{"properties":{"customer_ids":{"description":"Customer IDs to update. At most 200 distinct IDs after canonicalisation; duplicates are ignored.","items":{"type":"string"},"minItems":1,"type":"array"},"operation":{"enum":["add","remove"],"type":"string"},"tag_id":{"type":"string"}},"required":["customer_ids"],"type":"object"}}},"paths":{"/customers/tags/batch":{"post":{"description":"Add (operation=add) or remove (operation=remove) a custom tag across up to 200 distinct customers (duplicate IDs are ignored). Returns 200 with per-customer results; only whole-batch validation errors return 4xx.","operationId":"batchUpdateCustomerTags","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchUpdateCustomerTagsReply"}}}},"400":{"description":"invalid_request; EMPTY_COHORT: customer_ids is empty; COHORT_TOO_LARGE: more than 200 distinct customer_ids","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}},"404":{"description":"TAG_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}},"422":{"description":"SYSTEM_TAG_NOT_MUTABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}},"503":{"description":"service_unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}},"504":{"description":"gateway_timeout","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}}},"summary":"Add or remove a tag on many customers","tags":["Tags"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchUpdateCustomerTagsBody"}}},"description":"Batch operation","required":true}}}}}
```

## List tags

> List all tags owned by the partner, including system tags. Use the returned IDs to tag customers.

```json
{"openapi":"3.1.1","info":{"title":"Alternative Payments","version":"1.2.0"},"servers":[{"url":"http://public-api.alternativepayments.io"}],"security":[{"OAuth2ClientCredentials":["tags:read"]}],"components":{"securitySchemes":{"OAuth2ClientCredentials":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"/oauth/token","scopes":{"checkout:read":"Read checkout data","checkout:write":"Create checkout tokens","customers:read":"Read customers and payment methods","customers:write":"Create and update customers and payment methods","invoices:read":"Read invoices","invoices:write":"Create and update invoices","payments:read":"Read payments and payment requests","payments:write":"Create payments and payment requests","payouts:read":"Read payouts","refunds:read":"Read refunds","refunds:write":"Create refunds","tags:read":"Read customer tags","tags:write":"Create, update and delete customer tags, and add or remove them on customers","webhooks:read":"Read webhook subscriptions and events","webhooks:write":"Manage webhook subscriptions"}}}}},"schemas":{"PaginatedResponse-TagReply":{"properties":{"data":{"items":{"$ref":"#/components/schemas/TagReply"},"type":"array"},"end_cursor":{"type":"string"},"has_next_page":{"type":"boolean"},"has_previous_page":{"type":"boolean"},"start_cursor":{"type":"string"}},"type":"object"},"TagReply":{"properties":{"color":{"type":"string"},"customer_count":{"type":"integer"},"description":{"type":"string"},"id":{"type":"string"},"name":{"type":"string"},"partner_id":{"type":"string"},"type":{"type":"string"}},"type":"object"},"HttpError":{"properties":{"code":{"type":"string"},"message":{"type":"string"},"validation_errors":{"additionalProperties":{"type":"string"},"type":"object"}},"type":"object"}}},"paths":{"/tags":{"get":{"description":"List all tags owned by the partner, including system tags. Use the returned IDs to tag customers.","operationId":"listTags","parameters":[{"schema":{"type":"string"},"description":"Case-insensitive substring match on tag name","in":"query","name":"name"},{"schema":{"type":"string"},"description":"Only return tags applied to this customer","in":"query","name":"customer_id"},{"schema":{"type":"integer","default":100,"maximum":100,"minimum":1},"description":"Page size","in":"query","name":"limit"},{"schema":{"type":"string"},"description":"Return tags after this cursor (end_cursor of the previous page)","in":"query","name":"after"},{"schema":{"type":"string"},"description":"Return tags before this cursor (start_cursor of the next page)","in":"query","name":"before"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedResponse-TagReply"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}},"503":{"description":"Service Unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}},"504":{"description":"Gateway Timeout","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}}},"summary":"List tags","tags":["Tags"]}}}}
```

## Create a tag

> Create a custom tag that can be applied to customers.

```json
{"openapi":"3.1.1","info":{"title":"Alternative Payments","version":"1.2.0"},"servers":[{"url":"http://public-api.alternativepayments.io"}],"security":[{"OAuth2ClientCredentials":["tags:write"]}],"components":{"securitySchemes":{"OAuth2ClientCredentials":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"/oauth/token","scopes":{"checkout:read":"Read checkout data","checkout:write":"Create checkout tokens","customers:read":"Read customers and payment methods","customers:write":"Create and update customers and payment methods","invoices:read":"Read invoices","invoices:write":"Create and update invoices","payments:read":"Read payments and payment requests","payments:write":"Create payments and payment requests","payouts:read":"Read payouts","refunds:read":"Read refunds","refunds:write":"Create refunds","tags:read":"Read customer tags","tags:write":"Create, update and delete customer tags, and add or remove them on customers","webhooks:read":"Read webhook subscriptions and events","webhooks:write":"Manage webhook subscriptions"}}}}},"schemas":{"TagReply":{"properties":{"color":{"type":"string"},"customer_count":{"type":"integer"},"description":{"type":"string"},"id":{"type":"string"},"name":{"type":"string"},"partner_id":{"type":"string"},"type":{"type":"string"}},"type":"object"},"HttpError":{"properties":{"code":{"type":"string"},"message":{"type":"string"},"validation_errors":{"additionalProperties":{"type":"string"},"type":"object"}},"type":"object"},"CreateTagBody":{"properties":{"color":{"enum":["aqua_blue","dark_grey","grey","green","red","orange","yellow","purple"],"type":"string"},"description":{"maxLength":500,"type":"string"},"name":{"maxLength":100,"type":"string"}},"type":"object"}}},"paths":{"/tags":{"post":{"description":"Create a custom tag that can be applied to customers.","operationId":"createTag","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TagReply"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}}},"summary":"Create a tag","tags":["Tags"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTagBody"}}},"description":"Tag to create","required":true}}}}}
```

## Get a tag

> Get a tag by ID, including the number of non-archived customers it is applied to.

```json
{"openapi":"3.1.1","info":{"title":"Alternative Payments","version":"1.2.0"},"servers":[{"url":"http://public-api.alternativepayments.io"}],"security":[{"OAuth2ClientCredentials":["tags:read"]}],"components":{"securitySchemes":{"OAuth2ClientCredentials":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"/oauth/token","scopes":{"checkout:read":"Read checkout data","checkout:write":"Create checkout tokens","customers:read":"Read customers and payment methods","customers:write":"Create and update customers and payment methods","invoices:read":"Read invoices","invoices:write":"Create and update invoices","payments:read":"Read payments and payment requests","payments:write":"Create payments and payment requests","payouts:read":"Read payouts","refunds:read":"Read refunds","refunds:write":"Create refunds","tags:read":"Read customer tags","tags:write":"Create, update and delete customer tags, and add or remove them on customers","webhooks:read":"Read webhook subscriptions and events","webhooks:write":"Manage webhook subscriptions"}}}}},"schemas":{"TagReply":{"properties":{"color":{"type":"string"},"customer_count":{"type":"integer"},"description":{"type":"string"},"id":{"type":"string"},"name":{"type":"string"},"partner_id":{"type":"string"},"type":{"type":"string"}},"type":"object"},"HttpError":{"properties":{"code":{"type":"string"},"message":{"type":"string"},"validation_errors":{"additionalProperties":{"type":"string"},"type":"object"}},"type":"object"}}},"paths":{"/tags/{id}":{"get":{"description":"Get a tag by ID, including the number of non-archived customers it is applied to.","operationId":"getTag","parameters":[{"schema":{"type":"string"},"description":"Tag ID","in":"path","name":"id","required":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TagReply"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}}},"summary":"Get a tag","tags":["Tags"]}}}}
```

## Update a tag

> Replace a custom tag's name, description and color. All fields are required; send an empty description to clear it. System tags cannot be modified.

```json
{"openapi":"3.1.1","info":{"title":"Alternative Payments","version":"1.2.0"},"servers":[{"url":"http://public-api.alternativepayments.io"}],"security":[{"OAuth2ClientCredentials":["tags:write"]}],"components":{"securitySchemes":{"OAuth2ClientCredentials":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"/oauth/token","scopes":{"checkout:read":"Read checkout data","checkout:write":"Create checkout tokens","customers:read":"Read customers and payment methods","customers:write":"Create and update customers and payment methods","invoices:read":"Read invoices","invoices:write":"Create and update invoices","payments:read":"Read payments and payment requests","payments:write":"Create payments and payment requests","payouts:read":"Read payouts","refunds:read":"Read refunds","refunds:write":"Create refunds","tags:read":"Read customer tags","tags:write":"Create, update and delete customer tags, and add or remove them on customers","webhooks:read":"Read webhook subscriptions and events","webhooks:write":"Manage webhook subscriptions"}}}}},"schemas":{"TagReply":{"properties":{"color":{"type":"string"},"customer_count":{"type":"integer"},"description":{"type":"string"},"id":{"type":"string"},"name":{"type":"string"},"partner_id":{"type":"string"},"type":{"type":"string"}},"type":"object"},"HttpError":{"properties":{"code":{"type":"string"},"message":{"type":"string"},"validation_errors":{"additionalProperties":{"type":"string"},"type":"object"}},"type":"object"},"UpdateTagBody":{"properties":{"color":{"enum":["aqua_blue","dark_grey","grey","green","red","orange","yellow","purple"],"type":"string"},"description":{"maxLength":500,"type":"string"},"name":{"maxLength":100,"type":"string"}},"required":["color","description","name"],"type":"object"}}},"paths":{"/tags/{id}":{"put":{"description":"Replace a custom tag's name, description and color. All fields are required; send an empty description to clear it. System tags cannot be modified.","operationId":"updateTag","parameters":[{"schema":{"type":"string"},"description":"Tag ID","in":"path","name":"id","required":true},{"schema":{"type":"string"},"description":"Optional client-generated UUID, logged for tracing only. Not stored: a retry re-applies the request.","in":"header","name":"Idempotency-Key"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TagReply"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}},"413":{"description":"payload_too_large: body exceeds 16 MiB","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}},"422":{"description":"Unprocessable Entity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}},"503":{"description":"Service Unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}},"504":{"description":"Gateway Timeout","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}}},"summary":"Update a tag","tags":["Tags"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateTagBody"}}},"description":"Full tag snapshot","required":true}}}}}
```

## Delete a tag

> Delete a custom tag and remove it from every customer. System tags cannot be deleted.

```json
{"openapi":"3.1.1","info":{"title":"Alternative Payments","version":"1.2.0"},"servers":[{"url":"http://public-api.alternativepayments.io"}],"security":[{"OAuth2ClientCredentials":["tags:write"]}],"components":{"securitySchemes":{"OAuth2ClientCredentials":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"/oauth/token","scopes":{"checkout:read":"Read checkout data","checkout:write":"Create checkout tokens","customers:read":"Read customers and payment methods","customers:write":"Create and update customers and payment methods","invoices:read":"Read invoices","invoices:write":"Create and update invoices","payments:read":"Read payments and payment requests","payments:write":"Create payments and payment requests","payouts:read":"Read payouts","refunds:read":"Read refunds","refunds:write":"Create refunds","tags:read":"Read customer tags","tags:write":"Create, update and delete customer tags, and add or remove them on customers","webhooks:read":"Read webhook subscriptions and events","webhooks:write":"Manage webhook subscriptions"}}}}},"schemas":{"HttpError":{"properties":{"code":{"type":"string"},"message":{"type":"string"},"validation_errors":{"additionalProperties":{"type":"string"},"type":"object"}},"type":"object"}}},"paths":{"/tags/{id}":{"delete":{"description":"Delete a custom tag and remove it from every customer. System tags cannot be deleted.","operationId":"deleteTag","parameters":[{"schema":{"type":"string"},"description":"Tag ID","in":"path","name":"id","required":true},{"schema":{"type":"string"},"description":"Optional client-generated UUID, logged for tracing only. Not stored: a retry re-applies the request.","in":"header","name":"Idempotency-Key"}],"responses":{"204":{"description":"No Content"},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}},"422":{"description":"Unprocessable Entity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}}},"summary":"Delete a tag","tags":["Tags"]}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.alternativepayments.io/api-reference/tags.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
