Skip to main content

Responses and errors

The request is accepted​

HTTP/1.1 202 Accepted
X-Request-Id: 0b5c3a1e-7d1f-4c55-9d0e-6f2b8a4c1d23
{ "accepted": true, "request_id": "0b5c3a1e-7d1f-4c55-9d0e-6f2b8a4c1d23" }

202 means "the request is recorded" — the key is valid and the body has the right shape. Each event is checked a few seconds later; there are no counters and no list of refused events in the answer. The result is in the cabinet: Flows → Connections → Event journal.

Keep request_id: it ties the request to the events of the journal when you ask support about it.

Errors of the whole request​

Every error has the same body:

{ "error": {
"code": "rate_limited",
"message": "…",
"details": { "retry_after": 10 },
"request_id": "6f1d7c1e-0a52-4d0b-9f0e-1b2c3d4e5f60"
} }

Act on code: message is a hint for a person and may change.

StatuscodeWhenWhat to do
400invalid_jsonThe body is not JSONFix the request
401unauthenticatedNo key in the Authorization header or in ?key=, an unknown or revoked key, or the account is disabledCheck the key in the cabinet
404not_foundThe address is not /v1/eventsFix the address
405method_not_allowed/v1/events is called not with POSTSend POST
413body_too_largeThe body is over 2 MBSplit the request
413batch_too_largeMore than 100 events in batch; none is recordedSplit the batch
422validation_failedThe body is not an object, batch is not an array, backfill is not true/falseFix the request
429rate_limitedOver 2,000 requests in 10 seconds with this keyRepeat after Retry-After — see Limits and quotas
429quota_exceededThe daily quota of events is used up; the request is not recordedRepeat after Retry-After — see Limits and quotas
503storage_unavailableThe service could not record the requestRepeat after Retry-After (5 seconds)

Refused events​

An event that did not pass the check is refused on its own; the other events of the batch are recorded. The refused event is listed in the event journal with the reason:

ReasonWhen
invalid_envelopeThe event is not a JSON object
invalid_eventNo event name, or the name breaks the rule
invalid_contactNo valid identifier of the contact
invalid_timeoccurred_at cannot be read as a time, or it has no time zone
invalid_message_idmessage_id breaks the rule
invalid_propertiesproperties, context, traits or consents is not an object
invalid_dedupe_keydedupe_key breaks the rule
payload_too_largeThe event is over 64 KB
quota_exceededThe daily quota of events was used up
processing_failedThe event could not be processed after five attempts — a failure on our side, not in the event

Events from a connection address can also be refused for reasons of their own; the journal names the connection:

ReasonWhen
unrecognizedThe connection is «Other system», no system was recognised by the request, and there are no fields mapped by you
bad_bodyThe body is not of the kind the system sends
unmapped_eventThe event of the system is not mapped to an event of AlphaFlow
no_contactThe event has no phone, email or id of the contact
bad_signatureThe signature of the request does not match the secret of the connection

A refused event does not take its message_id: fix it and send it again with the same id. An event refused by the quota is accepted again after the quota resets.

Warnings​

A warning does not stop the event: it is recorded, and the warning stays with it in the journal.

WarningWhat happened
no_message_idThe event has no message_id: a retry will record it a second time
invalid_identifierOne identifier of the contact could not be read and was dropped; the contact was found by the others
invalid_traitA field of traits was not applied; the others were
invalid_consentA consent was not applied; the others were
schema_mismatchA property does not match the type described in the catalogue of events

Limits and quotas​

Requests per second. Up to 2,000 requests in 10 seconds with one key — about 200 a second. The count is approximate. Over it, the answer is 429 rate_limited with Retry-After: 10. Send events in batches: one request carries up to 100 of them.

Events per day. The account has a daily quota of events — 200,000 by default. The quota and how much of it is used today are in Flows → Settings, the Limits block; to raise it, write to support. The day ends at midnight in the account's time zone. When the quota is used up, the answer is 429 quota_exceeded:

HTTP/1.1 429 Too Many Requests
Retry-After: 33120
{ "error": {
"code": "quota_exceeded",
"message": "…",
"details": { "quota": "events_per_day", "retry_after": 33120 },
"request_id": "…"
} }

Retry-After is the number of seconds until midnight. For up to a minute after the quota runs out, requests may still be accepted — the extra events are then refused in the journal with quota_exceeded; send them again after midnight. Events imported from a file do not count against the quota.

Retries​

AnswerWhat to do
202Done. Do not send the request again
A network error, a timeout, 500, 502, 503, 504Repeat the request. With message_id in every event a repeat records nothing twice
429, 503 with Retry-AfterRepeat no earlier than after Retry-After seconds
Other 4xxFix the request: the same request gets the same answer

Keep unsent events in a queue on your side and repeat with growing pauses — 1 second, 5, 30, then every few minutes. Do not repeat a refused event without fixing it: its reason tells what to fix.

When the service storage is briefly unavailable, the request is still answered with 202: it waits in a reserve queue and is recorded once the storage is back. The key of such a request is checked at that moment — a key revoked in between will not record it.