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/typesAuthorization
| Header | Type | Required |
|---|---|---|
Authorization | Bearer asky_sk_… | required |
Idempotency-Key | string | required |
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
brand_id | uuid | required | From List brands |
Body
application/json
| Field | Type | Required | Description |
|---|---|---|---|
prompt_ids | uuid[], 1-500 | required | From List prompts. Each prompt’s other running language versions are set with it |
prompt_types | string[] | required | ["brand"], ["competitor"], ["brand", "competitor"] or ["organic"]. organic cannot be combined, and unclassified cannot be set |
Request
cURL
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
| Field | Type | Description |
|---|---|---|
data.prompt_types | string[] | required. The type set, in display order |
data.updated | integer | required. Prompts set, language versions included |
data.changed | integer | required. Prompts whose type changed, including prompts that had no type yet |
data.unchanged | integer | required. Prompts that already had this type. The choice is stored for them too |
data.language_versions_added | integer | required. Language versions set because one of their versions was given |
data.prompt_ids | uuid[] | required. Every prompt set: the ones given and their language versions |
request_id | string | required. Also returned as the x-request-id header. Quote it when contacting support |
Errors
| Status | Code | When |
|---|---|---|
| 400 | invalid_request | prompt_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 |
| 401 | invalid_token | The key is missing, malformed, or does not exist |
| 401 | token_expired | The key passed its expiry date |
| 401 | token_revoked | The key was revoked |
| 403 | insufficient_scope | The key does not carry write:prompts |
| 403 | plan_required | This workspace is not enabled for API writes |
| 404 | not_found | The brand does not exist, or this key is not allowed to reach it |
| 409 | conflict | The workspace is being deleted |
| 429 | rate_limited | Over 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.