Skip to Content
APIEndpointsSet prompt types

Set prompt types

Sets the Prompt Type of one or more prompts, as the Manage Prompt Types dialog does in the app. A prompt’s type says what it names: brand (the brand; shown as Branded in the app), competitor (a tracked competitor), both, or organic (neither). The type you set replaces the current one and stays over Asky’s detection until the prompt’s text changes. Read types with List prompts.

Requires the write:prompts scope.

PATCH /v1/brands/{brand_id}/prompts/types

Authorization

HeaderTypeRequired
AuthorizationBearer asky_sk_…required
Idempotency-Keystringrequired

Path parameters

ParameterTypeRequiredDescription
brand_iduuidrequiredFrom List brands

Body

application/json

FieldTypeRequiredDescription
prompt_idsuuid[], 1-500requiredFrom List prompts. Each prompt’s other running language versions are set with it
prompt_typesstring[]required["brand"], ["competitor"], ["brand", "competitor"] or ["organic"]. organic cannot be combined, and unclassified cannot be set

Request

curl --request PATCH \ --url 'https://api.askylabs.com/v1/brands/242546de-4cee-4a7d-952e-f6aa60c63ef8/prompts/types' \ --header 'Authorization: Bearer <api-key>' \ --header 'Idempotency-Key: 5b0e77d2-13a9-4f6a-8ce1-9a3f5e21c0aa' \ --header 'Content-Type: application/json' \ --data '{"prompt_ids": ["7c2f5a91-3b8e-4d06-9a44-1e7b30c9f852"], "prompt_types": ["organic"]}'

Response

{ "data": { "prompt_types": ["organic"], "updated": 2, "changed": 2, "unchanged": 0, "language_versions_added": 1, "prompt_ids": ["7c2f5a91-3b8e-4d06-9a44-1e7b30c9f852", "9d41c2e0-77a5-4b1f-8e2c-5a0b6f3d9e14"] }, "request_id": "req_5c1e93f8a2074b6dbf30" }

Response fields

FieldTypeDescription
data.prompt_typesstring[]required. The type set, in display order
data.updatedintegerrequired. Prompts set, language versions included
data.changedintegerrequired. Prompts whose type changed, including prompts that had no type yet
data.unchangedintegerrequired. Prompts that already had this type. The choice is stored for them too
data.language_versions_addedintegerrequired. Language versions set because one of their versions was given
data.prompt_idsuuid[]required. Every prompt set: the ones given and their language versions
request_idstringrequired. Also returned as the x-request-id header. Quote it when contacting support

Errors

StatusCodeWhen
400invalid_requestprompt_ids is empty or over 500 entries, an id is not found for this brand, the prompts and their language versions come to more than 500, prompt_types is not one of the four values, or it is competitor and the brand tracks no competitors
401invalid_tokenThe key is missing, malformed, or does not exist
401token_expiredThe key passed its expiry date
401token_revokedThe key was revoked
403insufficient_scopeThe key does not carry write:prompts
403plan_requiredThis workspace is not enabled for API writes
404not_foundThe brand does not exist, or this key is not allowed to reach it
409conflictThe workspace is being deleted
429rate_limitedOver 60 requests per minute

Notes

It replaces the type. Setting ["competitor"] on a prompt that was Branded makes it Competitor only. To add Competitor to a Branded prompt, set ["brand", "competitor"].

A prompt and its language versions move together. The app shows a prompt and its translations as one row, so a type set on one version is set on every running version of that prompt. Deactivated versions are left as they are; a deactivated prompt you name by id is set. prompt_ids in the response lists everything that was set.

It stays until the text changes. Asky’s detection no longer changes these prompts. Editing a prompt’s text returns it to detection. A Competitor type counts only while the brand tracks at least one competitor.

Every report follows. Prompt Type filters, dashboard sections and shared dashboards count these prompts by their new type, for past dates too.

Validation is all-or-nothing. An id that is missing or belongs to another brand refuses the entire call and names every offender. Nothing is set unless every id checks out.

Last updated on