Sviluppatori
Avvia i Pixmate dal tuo sistema: metti in coda i brief con una chiave API, recupera il risultato, ricevi notifiche via webhook.
1 · Autenticazione
Genera una chiave "po_…" da Profilo → Chiavi API (solo il proprietario dell'ufficio). Inviala in ogni richiesta con l'header X-API-Key — la chiave viene mostrata UNA SOLA VOLTA alla creazione.
Apri nel profilo →2 · Metti un brief in coda
POST /api/v1/runs — restituisce 202; l'esecuzione è asincrona. Campi: pixmate_slug, brief (≤20.000 caratteri), locale (tr|en).
curl -X POST https://pixel-office-api-production.up.railway.app/api/v1/runs \
-H "X-API-Key: po_XXXXXXXXXXXXXXXX" \
-H "Content-Type: application/json" \
-d '{
"pixmate_slug": "ava-generalist-marketer",
"brief": "Yeni single için 6 sosyal medya postu yaz",
"locale": "tr"
}'
# → 202 Accepted
# { "id": "…", "status": "queued", "pixmate_slug": "ava-generalist-marketer", … }3 · Recupera il risultato
GET /api/v1/runs (liste) · GET /api/v1/runs/{id}
curl https://pixel-office-api-production.up.railway.app/api/v1/runs/RUN_ID \
-H "X-API-Key: po_XXXXXXXXXXXXXXXX"
# status: queued → running → completed | failed4 · Limiti di frequenza
60 richieste al minuto per chiave. Oltre il limite: 429 + Retry-After; ogni risposta include gli header X-RateLimit-Limit / X-RateLimit-Remaining.
5 · Webhooks
Registra un endpoint HTTPS da Profilo → Webhook. Quando un run arriva a uno stato finale (completed/failed/cancelled) ricevi una POST firmata; 3 tentativi (0/5/25 s). Firma: HMAC-SHA256("{timestamp}.{body}").
Apri nel profilo →Puoi anche iscriverti con una chiave API (Zapier/Make “REST hook”): POST /api/v1/webhooks {"url": "https://…"} restituisce la chiave di firma una sola volta; GET /api/v1/webhooks elenca; DELETE /api/v1/webhooks/{id} annulla l’iscrizione.
{
"event": "run.completed", // ya da run.failed / run.cancelled
"run": {
"id": "…", "status": "completed",
"pixmate_slug": "ava-generalist-marketer", "kind": "chat",
"tokens_consumed": 3,
"error_message": null, "session_id": "…",
"created_at": "…", "finished_at": "…"
},
"sent_at": "…"
}Verifica (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-SignatureLa superficie API è un contratto v1: le modifiche incompatibili arrivano in una nuova versione. Domande? Pagina di supporto →