Stijn AI
Documentation

API reference

Base URL https://api.stijnai.shop/v1. Everything the dashboard does is a public endpoint, authenticated with a bearer token from your profile page.

Authentication

Create a token on your profile page. Pass it as a bearer token on every request. Tokens can be revoked at any time without interrupting runs already in flight.

export TOKEN=sk_live_xxxxxxxxxxxxxxxxxxxx curl https://api.stijnai.shop/v1/agents \ -H "Authorization: Bearer $TOKEN"

Runs

MethodPathDescription
POST/v1/runsCreate a run and execute it
GET/v1/runs/{id}Fetch a single run with output and trace
GET/v1/runsList runs, filterable by agent, status and date
GET/v1/agentsList available agents and their rates
GET/v1/balanceCurrent credit balance in cents
PUT/v1/agents/{slug}/configReplace an agent's configuration

Creating a run

curl -X POST https://api.stijnai.shop/v1/runs \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: ticket-48213" \ -d '{ "agent": "support-triage", "input": { "subject": "Card declined again", "body": "This is the third time this month..." } }'

Returns 201 with the completed run. Runs are synchronous: the response arrives when the work is done, which for most agents is under two seconds. Research Analyst can take up to a minute, so set your client timeout accordingly.

Idempotency

Send an Idempotency-Key header and a retry with the same key returns the original run instead of creating and charging for a second one. Keys are remembered for 24 hours. Use the identifier of the thing you are processing, not a random value, so that a retry after a network failure is genuinely deduplicated.

Agent configuration

Configuration is how an agent learns about your business. It is plain prose plus a little structure, stored per agent per account, and applied to every run automatically.

PUT /v1/agents/support-triage/config { "categories": ["Billing", "Shipping", "Technical", "Account", "Other"], "tone": "Direct and warm. Short sentences. Never say 'we apologise for the inconvenience'. Use the customer's first name once.", "escalate_when": "The customer mentions legal action, a chargeback, or press.", "abstain_below": 0.75 }

Setting abstain_below makes the agent decline rather than guess when its confidence falls under the threshold. The run still costs the normal rate, but you get an explicit abstention instead of a confident mistake.

Webhooks

Register an endpoint and every completed run is posted to it. Deliveries are retried with exponential backoff for 24 hours, and each carries an HMAC signature in the X-Signature header computed over the raw body with your webhook secret.

Errors

CodeMeaningWhat to do
400Input failed validationCheck it against the agent's input shape
401Token missing or revokedIssue a new token on the profile page
402Insufficient creditTop up; nothing was run or charged
404No such agent or runCheck the slug against /v1/agents
409Idempotency key reused with different inputUse a new key
422Agent ran but could not produce valid outputNot charged; inspect the run trace
429Rate limitedHonour the Retry-After header
503Agent temporarily unavailableNot charged; retry with backoff

Rate limits

120 runs per minute per account, and 600 read requests per minute. Exceeding either returns 429 with a Retry-After header. If you need more, open a ticket — the limit exists to protect the platform, not to sell you an upgrade.

Versioning

The version is in the path. We will not change the meaning of a field inside v1. New optional fields may be added, so parse defensively and ignore what you do not recognise. Breaking changes ship as v2 with at least six months of overlap.