Take one Pixel turn, streamed as SSE
const url = 'https://api.pixonaut.app/v1/pixel/turns';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"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"}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
object
The template’s base id, as list_templates returns it.
object
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.
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
The author’s words, at most 65536 bytes as JSON.
Examples
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" }}Responses
Section titled “Responses”The turn’s events, one per PixelTurnEvent, until the turn ends
Headers
Section titled “Headers”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
object
Examples
invalid_body
{ "error": "invalid_body"}Headers
Section titled “Headers”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
object
Examples
member_link_required
{ "error": "member_link_required"}member_link_revoked
{ "error": "member_link_revoked"}unauthorized
{ "error": "unauthorized"}Headers
Section titled “Headers”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.
object
Always sent with insufficient_credits.
Always sent with insufficient_credits.
Always sent with insufficient_credits.
Examples
insufficient_credits
{ "error": "insufficient_credits"}insufficient_credits (requiredCredits, availableCredits, reason)
{ "availableCredits": 0, "error": "insufficient_credits", "reason": "email_unverified", "requiredCredits": 0}Headers
Section titled “Headers”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
object
The feature the tenant does not have. Always sent with feature_disabled.
Examples
feature_disabled
{ "error": "feature_disabled", "feature": "api"}forbidden
{ "error": "forbidden"}origin_forbidden
{ "error": "origin_forbidden"}workspace_suspended
{ "error": "workspace_suspended"}Headers
Section titled “Headers”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
object
Examples
conversation_moved
{ "error": "conversation_moved"}not_paused
{ "error": "not_paused"}turn_in_progress
{ "error": "turn_in_progress"}Headers
Section titled “Headers”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
object
Sent with payload_too_large.
Always sent with payload_too_large.
Examples
invalid_tools
{ "error": "invalid_tools"}payload_too_large
{ "error": "payload_too_large", "maxBytes": 0}unknown_upload
{ "error": "unknown_upload"}Headers
Section titled “Headers”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
object
Examples
rate_limited
{ "error": "rate_limited"}Headers
Section titled “Headers”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
Examples
db_error
{ "error": "db_error"}Headers
Section titled “Headers”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].