Développeurs
Lance des Pixmates depuis ton système : mets un brief en file avec une clé API, récupère le résultat, sois notifié par webhook.
1 · Authentification
Génère une clé "po_…" dans Profil → Clés API (propriétaire du bureau uniquement). Envoie-la dans l'en-tête X-API-Key — la clé n'est affichée qu'UNE SEULE fois, à sa création.
2 · Mettre un brief en file
POST /api/v1/runs — renvoie 202 ; l'exécution est asynchrone. Champs : pixmate_slug, brief (≤ 20 000 caractères), 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 · Récupérer le résultat
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 débit
60 requêtes par minute et par clé. Au-delà : 429 + Retry-After ; chaque réponse porte les en-têtes X-RateLimit-Limit / X-RateLimit-Remaining.
5 · Webhooks
Enregistre un endpoint HTTPS dans Profil → Webhooks. Quand un run atteint un état terminal (completed/failed/cancelled), un POST signé arrive ; 3 tentatives (0/5/25 s). Signature : HMAC-SHA256("{timestamp}.{body}").
{
"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": "…"
}Vérification (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-SignatureDes questions ? L'e-mail du support est sur ta page profil. La surface d'API est un contrat v1 — les changements cassants sortent dans une nouvelle version.