Skip to navigation

Idempotency

Retry a write as often as you need; it takes effect once.

Networks fail after a request has been sent: you cannot tell whether EVVA received it. An Idempotency-Key removes the doubt. Send the same key with the same request again, and EVVA answers the first outcome instead of acting twice.

cURL
curl -X POST "https://api.evvahub.com/partner/v1/accounts/$CREATOR_ID/conversations/$CONVERSATION_ID/messages" \
-H "Authorization: Bearer $EVVA_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: reply-to-msg_7f3a9c" \
-d '{"body": "Thanks for your message!", "authorship": "AI_AUTOMATED"}'

The rules

RuleDetail
WhereOnly on the writes that declare the Idempotency-Key header. Each operation’s page in the API reference shows whether it is required, optional or not taken.
Format1–128 characters of [A-Za-z0-9_-] on most operations; marketplace writes take 1–200 characters. A malformed key is refused before anything is written.
Same key, same requestThe first outcome is answered again. Nothing is sent, charged or created twice.
Same key, different request409, and nothing is done.
Key spaceYour application’s own. A key you send can never match a key of the creator, of a person in your agency, or of another application.
StorageKeys are never echoed back. Message sends, marketplace and AI writes store only a digest of the key.
LifetimeA key protects the retries of one request. Retry within minutes, not days, and use a new key for new work.

There is no exactly-once promise. A key makes your retries safe; it does not turn two different requests into one. If you are unsure whether a write without a key ran, read the resource before repeating it.

By operation family

OperationsHeaderSame key, same requestSame key, different request
Send a messageOptional200 with the stored message409 IDEMPOTENCY_KEY_REUSED
Send a pay-per-view messageRequired200 with the same message409 IDEMPOTENCY_KEY_REUSED
Bulk sendRequiredItems already sent are replayed (200); the rest are sentThat item: 409 IDEMPOTENCY_KEY_REUSED
Mass messages: createOptional200 with the stored draft409 IDEMPOTENCY_KEY_REUSED
Mass messages: queue, cancelOptional200 with the campaign’s state when it is already queued or cancelled—
Fan lists: createOptional200 with the list the first request created409 CONFLICT
Orders: delivery, claim responses, order messagesOptionalThe recorded outcome409 IDEMPOTENCY_KEY_REUSED
Marketplace writesRequired — 400 IDEMPOTENCY_KEY_REQUIRED without it200 with the first outcome409 DIGEST_CONFLICT
AI writesRequired — 400 IDEMPOTENCY_KEY_REQUIRED without itThe same act; the creator’s allowance is never spent twice—
Comment replies, marketing links, new subscription pricesOptionalThe first outcome409 IDEMPOTENCY_KEY_CONFLICT

Bulk sends

A bulk send carries one key for the whole batch (1–128 characters of [A-Za-z0-9_-]). Item i is sent with its own derived key:

base64url(SHA-256("evva.bulk.messages.v1:" + batchKey + ":" + i))

Retrying the batch with the same key replays every item that was already sent and sends only the rest. You can also retry one item on its own through the single send, with its derived key. The answer is 207 with one result per item, in request order.

Operations that may need approval

An operation that may need a person’s approval requires an Idempotency-Key; without one it is refused with 400 IDEMPOTENCY_KEY_REQUIRED before anything is asked. The approval is tied to that key: re-send the approved request with the same key and the Partner-Approval-Id header. See Approvals.

Choosing keys

1

Derive the key from what you are reacting to

A reply to an inbound message can use reply- plus that message’s id. A redelivered event, or a worker that restarted halfway, then produces the same key and cannot reply twice.

2

Keep the key with the work, not the attempt

Generate the key once per logical operation and reuse it on every retry of that operation.

3

Never reuse a key for different work

A new message, a new price or a new recipient set needs a new key.

In the SDKs

The four official SDKs send a key automatically on every operation that declares the header (a random UUID per logical call, reused by its retries) and retry only requests that cannot take effect twice. Pass your own key when your process may repeat the work after a crash:

await evva.messages.sendText(creatorId, conversationId, 'Thanks for your message!', {
idempotencyKey: `reply-to-${inboundMessageId}`,
});

A same-key conflict surfaces as a dedicated idempotency-conflict error in every SDK, and is never retried.

Next steps