Skip to Content
APIEndpointsSet prompt tags

Set prompt tags

Replaces a prompt’s tags with exactly the ids you send. Tags not in the list are removed; an empty array clears them all.

Set-exact rather than add-and-remove, because that is what a sync integration needs: one call expresses “these and only these”, and repeating it is harmless. Reading the current set first is not required, but List prompts returns each prompt’s tags.

Requires the write:tags scope, and the workspace must be enabled for API writes.

PATCH /v1/brands/{brand_id}/prompts/{prompt_id}/tags

Authorization

HeaderTypeRequired
AuthorizationBearer asky_sk_…required
Idempotency-Keystringrequired

Path parameters

ParameterTypeRequiredDescription
brand_iduuidrequiredFrom List brands
prompt_iduuidrequiredFrom List prompts

Query parameters

None.

Body

application/json

FieldTypeRequiredDescription
tag_idsuuid[], max 50requiredThe complete set. [] removes every tag. Duplicates are collapsed

Every id must name a tag on this brand. If any does not, the whole call is refused and nothing changes — the message names the offending ids.

Request

curl --request PATCH \ --url 'https://api.askylabs.com/v1/brands/242546de-4cee-4a7d-952e-f6aa60c63ef8/prompts/9f2c1d84-6b31-4a2e-9c77-1e5b0a3f8d42/tags' \ --header 'Authorization: Bearer <api-key>' \ --header 'Idempotency-Key: <unique-per-attempt>' \ --header 'Content-Type: application/json' \ --data '{"tag_ids":["5524d66a-df1e-47e4-9dbc-802af39235ad"]}'

Response

{ "data": { "prompt_id": "9f2c1d84-6b31-4a2e-9c77-1e5b0a3f8d42", "tags": [ { "id": "5524d66a-df1e-47e4-9dbc-802af39235ad", "name": "Bottom funnel", "slug": "bottom-funnel", "color": "#4F46E5", "description": null } ] }, "request_id": "req_7d21b0af59c34e18b6ac" }

Response fields

The resulting set, so you can confirm the outcome without a follow-up read.

FieldTypeDescription
data.prompt_iduuidrequired
data.tags[].iduuidrequired
data.tags[].namestringrequired
data.tags[].slugstringrequired
data.tags[].colorstring | nullrequired
data.tags[].descriptionstring | nullrequired
request_idstringrequired

Errors

StatusCodeWhen
400invalid_requesttag_ids missing, not an array of uuids, or over 50 entries
401invalid_tokenThe key is missing, malformed, or does not exist
403insufficient_scopeThe key does not carry write:tags
404not_foundThe prompt or one of the tags does not exist, or belongs to another brand
429rate_limitedOver 60 requests per minute

Notes

Applying one tag to many at once? Use Bulk add tag to prompts — it adds without replacing the rest.

Tags are shared. The pool is brand-level: the same tag can label prompts and competitors. See Create tag.

The call is idempotent by construction. Sending the same set twice leaves the same result, so a retry after a lost response is safe even without the Idempotency-Key replay.

All-or-nothing on unknown ids. One bad id refuses the whole call rather than applying the others, so a partially-synced state is never reachable.

Last updated on