Skip to content

Take one Pixel turn, streamed as SSE

POST
/v1/pixel/turns
curl --request POST \
--url https://api.pixonaut.app/v1/pixel/turns \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "conversationId": null, "openTemplate": null, "page": null, "tools": [ { "description": "Create a WooCommerce product that sells a template.", "inputSchema": { "properties": { "name": { "type": "string" }, "price": { "type": "number" }, "templateId": { "type": "string" } }, "required": [ "templateId", "name" ], "type": "object" }, "name": "woo_create_product" } ], "words": { "attachments": [], "text": "Make a product for the Summer mug template" } }'

Operation ID: pixelTurns.create

A studio member’s turn, or a connected store’s: a member key acts as the member the store’s user linked, whose conversation in that store it is and whose permissions bound what Pixel does, and the turn is charged to the workspace through the store’s key. The store’s own integration key is refused member_link_required.

Media typeapplication/json
object
conversationId
required
string | null
/^pcv_[0-9a-f]{24}$/
openTemplate
required
object
baseId
required

The template’s base id, as list_templates returns it.

string
revision
required
integer
> 0
page
required
object
id
required
string
/^[A-Za-z0-9_-]{1,128}$/
kind
required
string
Allowed values: templates inks shapes palettes blanks designs prints orders
tools

A connected store’s own tools, which it runs itself, each { name, description, inputSchema }: the name under the store’s prefix (woo_ for WooCommerce), the input schema a JSON Schema of an object. When Pixel calls one, the stream gives a tool_call event and ends paused, and the store posts the result to the turn’s tool results. The list may take at most 262144 bytes as JSON. Only an integration key declares them; a declaration that is not one is refused invalid_tools.

Array
words
required

The author’s new words, or null to carry on the turn that paused at its cards once every one of them is decided.

object
attachments
required
Array<string>
<= 4 items
text
required

The author’s words, at most 65536 bytes as JSON.

string
>= 1 characters
uploads
Array<string>
default: <= 4 items

Examples

Exampleexample

Example

{
"conversationId": null,
"openTemplate": null,
"page": null,
"tools": [
{
"description": "Create a WooCommerce product that sells a template.",
"inputSchema": {
"properties": {
"name": {
"type": "string"
},
"price": {
"type": "number"
},
"templateId": {
"type": "string"
}
},
"required": [
"templateId",
"name"
],
"type": "object"
},
"name": "woo_create_product"
}
],
"words": {
"attachments": [],
"text": "Make a product for the Summer mug template"
}
}

The turn’s events, one per PixelTurnEvent, until the turn ends

Media typetext/event-stream
string
X-Request-Id
required
string

Every response names the request it answers in X-Request-Id: the id the request was sent with in that header, when it is well formed, else one the API gave it. Quote it when reporting a refusal or a failure: the API’s log lines for that request carry it.

Refused: invalid_body

Media typeapplication/json
object
error
required
string

Examples

Exampleinvalid_body

invalid_body

{
"error": "invalid_body"
}
X-Request-Id
required
string

Every response names the request it answers in X-Request-Id: the id the request was sent with in that header, when it is well formed, else one the API gave it. Quote it when reporting a refusal or a failure: the API’s log lines for that request carry it.

Refused: unauthorized, member_link_required, member_link_revoked

Media typeapplication/json
object
error
required
string

Examples

member_link_required

{
"error": "member_link_required"
}
X-Request-Id
required
string

Every response names the request it answers in X-Request-Id: the id the request was sent with in that header, when it is well formed, else one the API gave it. Quote it when reporting a refusal or a failure: the API’s log lines for that request carry it.

Refused: insufficient_credits. The tenant’s credits cannot cover this action, its spending cap has no room left for it, it is on the Free plan and Free workspaces together have reached the platform’s daily ceiling on credit spending (it resets at midnight UTC), a storefront’s customer asked and the tenant’s daily storefront ceiling has no room left, or the account that created the tenant has not confirmed its email address yet, so none of it was done. reason says which: balance, spending_cap, free_plan_ceiling, storefront_ceiling or email_unverified. requiredCredits, availableCredits and reason are left out for a publishable key.

Media typeapplication/json
object
availableCredits

Always sent with insufficient_credits.

number
error
required
string
reason

Always sent with insufficient_credits.

string
requiredCredits

Always sent with insufficient_credits.

number

Examples

insufficient_credits

{
"error": "insufficient_credits"
}
X-Request-Id
required
string

Every response names the request it answers in X-Request-Id: the id the request was sent with in that header, when it is well formed, else one the API gave it. Quote it when reporting a refusal or a failure: the API’s log lines for that request carry it.

Refused: origin_forbidden, feature_disabled, forbidden, workspace_suspended

Media typeapplication/json
object
error
required
string
feature

The feature the tenant does not have. Always sent with feature_disabled.

string

Examples

feature_disabled

{
"error": "feature_disabled",
"feature": "api"
}
X-Request-Id
required
string

Every response names the request it answers in X-Request-Id: the id the request was sent with in that header, when it is well formed, else one the API gave it. Quote it when reporting a refusal or a failure: the API’s log lines for that request carry it.

Refused: turn_in_progress, conversation_moved, not_paused

Media typeapplication/json
object
error
required
string

Examples

conversation_moved

{
"error": "conversation_moved"
}
X-Request-Id
required
string

Every response names the request it answers in X-Request-Id: the id the request was sent with in that header, when it is well formed, else one the API gave it. Quote it when reporting a refusal or a failure: the API’s log lines for that request carry it.

Refused: unknown_upload, invalid_tools, payload_too_large

Media typeapplication/json
object
bytes

Sent with payload_too_large.

number
error
required
string
maxBytes

Always sent with payload_too_large.

number

Examples

invalid_tools

{
"error": "invalid_tools"
}
X-Request-Id
required
string

Every response names the request it answers in X-Request-Id: the id the request was sent with in that header, when it is well formed, else one the API gave it. Quote it when reporting a refusal or a failure: the API’s log lines for that request carry it.

Refused: rate_limited

Media typeapplication/json
object
error
required
string

Examples

Examplerate_limited

rate_limited

{
"error": "rate_limited"
}
X-Request-Id
required
string

Every response names the request it answers in X-Request-Id: the id the request was sent with in that header, when it is well formed, else one the API gave it. Quote it when reporting a refusal or a failure: the API’s log lines for that request carry it.

Refused: db_error. A request that failed unexpectedly answers as text instead.

object
error
required
string

Examples

Exampledb_error

db_error

{
"error": "db_error"
}
X-Request-Id
required
string

Every response names the request it answers in X-Request-Id: the id the request was sent with in that header, when it is well formed, else one the API gave it. Quote it when reporting a refusal or a failure: the API’s log lines for that request carry it.

Questions? Write to [email protected].

Status · Terms of service · Privacy policy · Subprocessors