API Idempotency for Account Creation: Design Pattern and Current MailMaker Limit
Learn the idempotency pattern for account-creation APIs, why duplicate tasks happen, and how to guard MailMaker requests while server-side keys are unavailable.
Idempotency lets repeated delivery of one logical request resolve to one server-side decision. MailMaker's current creation endpoint does not accept an idempotency key, so clients must persist requests, stop automatic resubmission after uncertain responses, and use manual review until server-side support exists.
What you will leave with
- Server-side idempotency is the correct long-term duplicate-prevention pattern
- The current MailMaker creation endpoint does not accept an idempotency key
- Persist the canonical request and correlation ID before the first call
- Stop uncertain submissions for review instead of retrying automatically
Account creation requests need protection from network ambiguity
A client can time out after the server accepts a task but before the response reaches the client. Without an idempotency strategy, an automatic retry may create a second valid task for the same internal order. The duplicate can consume budget and produce sensitive output nobody intended to own.
Idempotency lets repeated delivery of one logical request resolve to the same creation decision. It does not make every error retryable, and it does not replace task status, limits, or final reconciliation. MailMaker does not currently expose this server-side contract on task creation.
Persist the canonical request before sending it
Create an internal correlation ID and store it durably with provider, quantity, requester, approval reference, expected credit estimate, and request time before the first API call. Attach the MailMaker task ID as soon as the response arrives.
This client-side record does not make the POST idempotent. It gives the operator enough evidence to investigate an uncertain response without allowing a low-level HTTP library to create another order automatically.
- Internal job and correlation ID
- Canonical provider and quantity
- Approval and budget reference
- Request timestamp
- MailMaker task ID when known
- Current review state
Bind the key to a canonical request payload
A repeated key should represent the same provider, quantity, environment, and other creation parameters. Store or derive a canonical payload fingerprint so a later request cannot silently reuse the key with different work.
When the same key arrives with a different payload, return or surface a conflict that requires investigation. Do not update the original task and do not create a second task under ambiguous ownership.
Use bounded status polling only after a task ID exists
Once a MailMaker task ID is known, transition to task retrieval. Poll on a bounded schedule and stop on completed, partial, or failed. Status retrieval is safe to repeat; creation is the operation that must stop when its result is uncertain.
Validation failures, insufficient balance, unsupported requests, transport uncertainty, and permanent errors should not enter a blind creation loop. Store an error class and route the job to the owner able to investigate, correct, or reject it.
- No automatic creation retry after uncertainty
- Persist returned task ID
- Back off status retrieval
- Bound polling by interval and deadline
- Manual review for unresolved ambiguity
Prove duplicate prevention with reconciliation and safe observability
Record uncertain submissions, duplicate attempts prevented by client controls, task IDs, and jobs moved to manual review. Do not log raw API keys or account credentials. Correlation identifiers and task metadata are sufficient for most diagnosis.
At terminal state, compare the internal job with the authoritative task: provider, requested count, successful count, failed count, and credits. A job closes only when one logical request, its task, its accepted output, and its final charge can be followed in one record.
Questions about this workflow
What is an idempotency key?
It is a client-supplied identifier that a supporting server binds to one logical request so repeated delivery can resolve without creating duplicate tasks.
Does MailMaker currently accept an idempotency key?
No. The current creation endpoint does not expose server-side idempotency. Persist requests locally and stop for review after an uncertain response instead of resubmitting automatically.
What if the same key is sent with a different provider or quantity?
Treat it as a conflict and require investigation. Silently changing the original request or creating another task would make ownership and cost ambiguous.
Would idempotency replace status polling?
No. Idempotency would protect creation submission. The client would still need the task ID, bounded polling, terminal-state handling, and final reconciliation.
Sources used in this guide
Provider rules and product behavior can change. These first-party references are the starting point for checking the current requirements.
- MailMaker: Email account creation API ↗
Product source for the current task ID, state, polling, and duplicate-control limitations.
- IETF RFC 9110: Idempotent methods ↗
Internet Standard definition and retry considerations for idempotent HTTP semantics.
- OWASP: Secrets Management Cheat Sheet ↗
Guidance for key, credential, logging, and secret lifecycle controls.
Run the workflow in MailMaker.
Start in the dashboard with your provider selected, or connect the same task lifecycle to your application through the API.