Skip to Content
APIEndpointsAccept prompt suggestion

Accept prompt suggestion

Not available yet. Write endpoints are documented ahead of implementation so the contract can be reviewed. No API key can call them today: every key is minted read-only, and a workspace must hold the write entitlement before one can be issued that is not.

Accepts a suggestion, creating a tracked prompt from it. The suggestion’s topic, funnel stage and language carry over, so the new prompt arrives already classified rather than waiting on background analysis.

This is a billable action: the created prompt consumes an active-prompt slot per market, exactly as Create prompt does.

Requires the write:prompts scope.

POST /v1/brands/{brand_id}/prompts/suggestions/{suggestion_id}/accept

Authorization

HeaderTypeRequired
AuthorizationBearer asky_sk_…required
Idempotency-Keystringrequired

Path parameters

ParameterTypeRequiredDescription
brand_iduuidrequiredFrom List brands
suggestion_iduuidrequiredFrom List prompt suggestions

Query parameters

None.

Any parameter you pass returns 400 invalid_request naming the offending key, rather than being ignored silently.

Body

application/json

FieldTypeRequiredDescription
country_codesstring[]optionalOverride the suggested markets. Defaults to the suggestion’s own
tag_idsuuid[]optionalTags to apply to the created prompt

Request

curl --request POST \ --url 'https://api.askylabs.com/v1/brands/242546de-4cee-4a7d-952e-f6aa60c63ef8/prompts/suggestions/8d31a70c-5f24-4e19-b063-9a1c72f4e850/accept' \ --header 'Authorization: Bearer <api-key>' \ --header 'Idempotency-Key: <unique-per-attempt>' \ --header 'Content-Type: application/json' \ --data '{"country_codes":["US","GB"]}'

Response

{ "data": { "id": "7c2f5a91-3b8e-4d06-9a44-1e7b30c9f852", "suggestion_id": "8d31a70c-5f24-4e19-b063-9a1c72f4e850" }, "request_id": "req_4e7b02cf8a13496db2f5" }

Response fields

FieldTypeDescription
data.iduuidrequired. The prompt that was created, not the suggestion
data.suggestion_iduuidrequired. Now promoted
request_idstringrequired. Also returned as the x-request-id header. Quote it when contacting support

Errors

StatusCodeWhen
400invalid_requestA parameter is unknown or malformed. The message names it
401invalid_tokenThe key is missing, malformed, or does not exist
401token_expiredThe key passed its expiry date
401token_revokedThe key was revoked
404not_foundThe brand does not exist, or this key is not allowed to reach it. The two are deliberately indistinguishable
429rate_limitedOver 300 requests per minute. See the Retry-After header

Notes

data.id is the new prompt id, which is what you will want to hold on to. The suggestion id is returned alongside it so the two can be reconciled.

Accepting is not free. Quota is checked first and 403 plan_required is returned if the plan has no room, leaving the suggestion untouched so it can be accepted later.

Accepting a suggestion whose text duplicates an existing prompt returns 409 conflict rather than creating a second copy.

Last updated on