Chyby a limity
Tvar chyby
API v1 vracia pri chybe vhodný HTTP stav a telo:
{"error": {"code": "validation", "message": "definition.0.currency"}}codeje stály strojový kód (tabuľka nižšie). Rozhodujte sa podľa neho a podľa HTTP stavu.messageupresní pole alebo dôvod (napríklademail,name,version,status,scope). Nie je to text pre ľudí.paramsnesie podrobnosti:issues(problémy grafu automatizácie),expectedaactual(počet príjemcov),current(verzia),reason,retryAfter.
API v3 kompatibilné so SmartEmailingom má vlastný tvar {"status": "error", "meta": [], "message": "..."}, pozrite Kompatibilita so SmartEmailingom.
HTTP stavy
| Stav | Kedy |
|---|---|
| 200, 201, 204 | úspech (201 = vytvorené, 204 = bez tela) |
| 400 | neplatný vstup (validation) |
| 401 | chýba alebo neplatí prihlásenie (unauthorized) |
| 403 | prihlásenie platí, ale nie je dovolené (forbidden) |
| 404 | objekt neexistuje (alebo patrí inej firme) |
| 405 | trasa nemá túto metódu |
| 409 | zmena by porušila stav objektu (conflict) |
| 410 | objekt už nie je k dispozícii (expired) |
| 413 | telo požiadavky nad 5 MB |
| 415 | telo nie je JSON (validation / contentType) |
| 429 | prekročený limit (rate_limited), hlavička Retry-After |
| 502 | zlyhala vonkajšia služba (upstream) |
| 503 | služba nie je dostupná (unavailable) |
| 500 | chyba servera (server) |
Kódy chýb
conflict
Význam: The change would break the state of the object. message: name (name taken), locked (a list bound to an e-shop), status (wrong state, e.g. editing a sent campaign), recipients (the audience changed more than 5 % since you counted it, params.expected and params.actual), version (stale baseVersion, params.current), confirm (saving a running automation needs confirmRunning: true), waiting (contacts wait in a node you remove, params.nodes), runs (deleting an automation that ran), trigger (no manual trigger), limit (too many objects).
Čo urobiť: Read the object again, then repeat with current data; for recipients count the audience again and send the new expectedRecipients.
count_mismatch
Význam: expectedRecipients does not match the audience.
Čo urobiť: Count again with POST /campaigns/audience and send the new number.
csrf
Význam: Browser session request without the CSRF header (never with an API key).
Čo urobiť: Send the API key in Authorization instead of cookies.
empty_segment
Význam: The campaign audience has no recipient.
Čo urobiť: Change the audience.
expired
Význam: The object is no longer available (an export file older than its retention).
Čo urobiť: Create it again (POST /exports).
forbidden
Význam: The credentials are valid but not allowed here. message: tenant (another company in the path), scope (a read-only key on a write route), api_key (members, invitations and keys need a signed-in person), a module name (contacts, campaigns, content, settings, billing: the key's roles lack the level), read_only (support view).
Čo urobiť: Use the tenant id of the key (GET /api/v3/account-info), a key with scope full, or a key whose roles include the module (for example marketing_manager).
method_not_allowed
Význam: The path exists but not with this HTTP method.
Čo urobiť: Check the method in this document.
not_found
Význam: The object does not exist in this company (objects of other companies answer the same).
Čo urobiť: Check the id; list the objects first.
not_implemented
Význam: The feature is not available yet.
Čo urobiť: Do not rely on it.
rate_limited
Význam: Too many requests: the company's API limit, or the limit of one action (test e-mails, contact events, sign-in attempts). Retry-After says after how many seconds to retry.
Čo urobiť: Wait Retry-After seconds; spread requests (4 a second sustained).
recently_sent
Význam: HTTP 423: the contact cannot be deleted yet, a campaign e-mail to it is queued or went out in the last 24 hours (SmartEmailing answers the same).
Čo urobiť: Delete it after 24 hours. A request to be forgotten (GDPR) uses POST /contacts/{id}/erase, which is never refused.
server
Význam: Unexpected server error.
Čo urobiť: Retry later; the request may be repeated if it is safe to repeat.
suppression_locked
Význam: The address is suppressed for another reason (bounce, complaint, unsubscribe), so the blacklist cannot be added or removed; params.reason names it.
Čo urobiť: Leave it: such suppressions protect the sender and are removed only one by one (DELETE /suppressions/{email}) when the reason is gone.
unauthorized
Význam: No valid credentials: the API key is unknown, revoked, expired, idle for 180 days, its creator left the company, or the HTTP Basic user name is not an active member.
Čo urobiť: Check the key and the header (Authorization: Bearer pst_...). Create a new key in Nastavení › Datové zdroje › API klíče.
unavailable
Význam: A service the action needs is not available (mail: the mail backend refused a test e-mail, data_key: encryption key for webhook passwords missing).
Čo urobiť: Retry later; tell support when it persists.
upstream
Význam: An outside service failed (downloading a file by URL, the stock photo service); params.reason says why.
Čo urobiť: Check the URL or retry later.
validation
Význam: A parameter or body field is missing, has the wrong type or an invalid value. message names it (email, definition.1.0.listId, graph ...), params may carry details such as params.issues of an automation graph or params.reason.
Čo urobiť: Fix the named field. For 415 contentType send Content-Type: application/json; for body send a JSON object.
Limity požiadaviek
- Na firmu (všetky kľúče spolu): zásobník 2 500 požiadaviek doplňovaný 4 požiadavkami za sekundu a 100 000 požiadaviek za deň.
- Hlavičky každej odpovede:
X-RateLimit-Limit,X-RateLimit-Remaining,X-RateLimit-Reset(unixový čas plného zásobníka). - Po prekročení 429
rate_limited(vmessagenázov zásobníkaper-secondalebodaily-limit) aRetry-Afterv sekundách.
Limity akcií
| Čo | Limit |
|---|---|
| Telo požiadavky JSON | 5 MB |
| CSV import | súbor 64 MB a 300 000 riadkov (multipart), text v JSON 5 MB; do 1 000 riadkov prebehne hneď |
| API kľúče | 20 platných na firmu; platnosť najviac 730 dní; nepoužívaný 180 dní prestane platiť |
| Testovacie e-maily | 10 na kampaň alebo šablónu za 24 hodín, len na testovacie adresy |
Udalosti kontaktu (/contact-events) | 60 na kontakt za 10 minút |
| Pridanie do zoznamu, ručný vstup do automatizácie | 1 až 1 000 kontaktov v jednej požiadavke |
| Automatizácia | 300 uzlov, 600 hrán; čakanie najviac 10 rokov; najviac 10 súbežných behov kontaktu |
| Segment | 8 úrovní skupín, 50 pravidiel, reťaz odkazov na segmenty najviac 5 |
| Kampaň | najviac 100 ID zoznamov a segmentov v každom poli publika, 1 000 vylúčených adries; odoslanie 5 minút až 365 dní dopredu |
| Účtové webhooky | 50 na firmu |
| Formulár | 10 odoslaní za hodinu z IP na formulár, 3 za deň na adresu, 300 za hodinu na firmu |
| Server MCP | 300 správ za minútu na token |
| HTML e-mailu | 102 000 bajtov |
Ako reagovať
| Situácia | Postup |
|---|---|
400 validation | oprava poľa podľa message; neopakovať bez zmeny |
| 401 | skontrolovať kľúč; neopakovať |
403 forbidden | iný kľúč (rola, prístup full, správna firma); neopakovať |
| 404 | overiť ID (objekt mohol niekto zmazať) |
409 conflict | načítať objekt znovu a rozhodnúť podľa message |
| 429 | počkať Retry-After sekúnd, potom opakovať |
| 5xx | opakovať s rastúcim odstupom, len bezpečné operácie (pozrite Pravidlá API) |