Desenvolvedores
Rode Pixmates a partir do seu sistema: enfileire briefs com uma chave de API, busque o resultado e receba avisos por webhook.
1 · Autenticação
Gere uma chave "po_…" em Perfil → Chaves de API (só o dono do escritório). Envie no cabeçalho X-API-Key a cada requisição — a chave aparece UMA ÚNICA VEZ, na criação.
2 · Colocar um brief na fila
POST /api/v1/runs — retorna 202; a execução é assíncrona. Campos: pixmate_slug, brief (≤20.000 caracteres), locale (tr|en).
curl -X POST https://api.pixel-office.app/api/v1/runs \
-H "X-API-Key: po_XXXXXXXXXXXXXXXX" \
-H "Content-Type: application/json" \
-d '{
"pixmate_slug": "mira-marketing",
"brief": "Yeni single için 6 sosyal medya postu yaz",
"locale": "tr"
}'
# → 202 Accepted
# { "id": "…", "status": "queued", "pixmate_slug": "mira-marketing", … }3 · Buscar o resultado
GET /api/v1/runs (liste) · GET /api/v1/runs/{id}
curl https://api.pixel-office.app/api/v1/runs/RUN_ID \
-H "X-API-Key: po_XXXXXXXXXXXXXXXX"
# status: queued → running → completed | failed4 · Limites de taxa
60 requisições por minuto por chave. Ao exceder, retorna 429 + Retry-After; toda resposta traz os headers X-RateLimit-Limit / X-RateLimit-Remaining.
5 · Webhooks
Cadastre um endpoint HTTPS em Perfil → Webhooks. Quando um run chega a um estado final (completed/failed/cancelled), chega um POST assinado; 3 tentativas (0/5/25 s). Assinatura: HMAC-SHA256("{timestamp}.{gövde}").
{
"event": "run.completed", // ya da run.failed / run.cancelled
"run": {
"id": "…", "status": "completed",
"pixmate_slug": "mira-marketing", "kind": "chat",
"cost_usd": 0.0213, "tokens_consumed": 3,
"error_message": null, "session_id": "…",
"created_at": "…", "finished_at": "…"
},
"sent_at": "…"
}Verificação (Python):
import hashlib, hmac
def verify(secret: str, ts: str, raw_body: bytes, signature: str) -> bool:
expected = hmac.new(
secret.encode(), f"{ts}.".encode() + raw_body, hashlib.sha256
).hexdigest()
return hmac.compare_digest(f"sha256={expected}", signature)
# headers: X-Webhook-Timestamp / X-Webhook-SignatureDúvidas: o e-mail de suporte está na sua página de perfil. A superfície da API é um contrato v1 — mudanças incompatíveis saem em uma nova versão.