
Store Imagild idempotency keys in durable backend operation records beside the approved request and returned task ID. A browser component, temporary response file, or worker's memory is not sufficient for a process restart. Your application must be able to recover the same intent without generating a fresh identity.
Key Takeaways
- Persist the operation before making the paid request.
- Keep the original request, remote key, and task ID together under explicit account ownership.
- Choose retention through your application policy; do not import another provider's replay window as an Imagild promise.
Store enough information to recover the action
A key alone cannot reconstruct the intended operation. After a lost acknowledgment, you also need the endpoint and original parameters. After acceptance, the returned task ID becomes the direct status lookup.
A minimal application record should distinguish the application's customer or tenant from the owning Imagild account. Do not assume that knowing a task ID authorizes its retrieval. The API credential and active membership still belong to the account serving the operation.
This PostgreSQL example illustrates storage fields and uniqueness, not a complete tenant-security implementation:
CREATE TABLE media_operation_record (
tenant_ref text NOT NULL,
operation_id uuid NOT NULL,
imagild_account_ref text NOT NULL,
remote_key varchar(128) NOT NULL,
endpoint text NOT NULL,
request_json text NOT NULL,
request_fingerprint char(64) NOT NULL,
task_id uuid,
local_state text NOT NULL,
created_at timestamptz NOT NULL DEFAULT now(),
PRIMARY KEY (tenant_ref, operation_id),
UNIQUE (imagild_account_ref, remote_key)
);
Use your database driver's parameter binding. Enforce ownership before reading or updating rows, and protect private request contents through your normal storage controls. Never store the Bearer API key inside this operation table.
Keep an integrity fingerprint without confusing contracts
An application fingerprint can help detect accidental mutation of a saved request. For example, compute SHA-256 over the exact serialized request string you persist. Recompute that local fingerprint before dispatching or recovering the record.
That fingerprint is not an API field and is not a promise to reproduce Imagild's server hash. Imagild compares validated parsed parameters, including defaults and trimmed prompt text. Your local integrity check simply answers whether your stored snapshot changed.
A hash cannot replace the request itself: you cannot recover the original prompt or reference selector from a hash. If your policy requires encrypted request storage, design recovery around authorized decryption rather than sending an incomplete reconstructed payload.
Make state updates preserve evidence
After HTTP 202, save data.id against the existing operation. Do not replace the row with a new operation when the worker restarts. Update observed status and billing state separately from immutable approval fields.
If multiple workers can update the row, use transaction conditions that prevent a stale update from erasing a task ID or successful result. Local coordination is your implementation's responsibility. The API console provides same-key task reuse for identical parsed requests; changed parameters return a conflict.
An unknown provider outcome should remain visible in the record until reconciliation. Deleting it to clear a dashboard can make later recovery indistinguishable from a new paid request.
Decide retention deliberately
Stripe's idempotency documentation publishes its own replay behavior and retention rules. Those rules do not establish an Imagild 24-hour reuse window, nor permission to rotate keys automatically after that interval.
Keep operation records long enough for your workload's recovery, support, and applicable data policies. Minimize sensitive content where possible, but preserve the evidence needed to distinguish completed, failed, and unresolved work. Explain any deletion or archive policy in your own application.
The OWASP REST security guidance supports authorization at protected resource boundaries. Moving a key into a database does not remove the need for access controls.
Link retention to cost and delivery records
Current model market image tiers use 10, 15, and 20 points for 1K, 2K, and 4K. API access requires active membership. Preserve the submitted quote rather than repricing old work from a later catalog.
Use the asset archive guide for approved media copies and the failed-job guide for recovery. Durable records make duplicate protection usable across restarts; they do not prove global exactly-once execution or guarantee permanent result storage.
Related tasks
- How to Archive Imagild Assets Before the 90-Day Storage Window Ends
- What Should You Check Before Retrying a Failed Image or Video Job?
Sources and scope
- Imagild API console: Same-key matching parsed request reuse, changed-parameter conflict and owned async tasks.
- Imagild model market: Current image tier point costs.
- Stripe idempotent requests: Replay and retention are provider-specific policies, not a universal24-hour contract.
- OWASP REST Security Cheat Sheet: Protected operation access must be authorized and credentials kept out of inappropriate storage and URLs.
Product instructions were checked against the current Imagild API contract and the public model catalog. Code, budgets and acceptance checks are illustrative; this article does not claim a new paid generation test, an uptime measurement, a search-volume study or a ranking of AI citations.
Prepared by Imagild Editorial, the company editorial team responsible for these guides. AI assisted research and drafting. This is documentation-based guidance with proposed examples, not a claim of hands-on testing or an independent product review. Report a correction.
Cover: Original Imagild product screenshot captured on 28 October 2026; model availability and prices may change. This image is not an API response or a performance benchmark.