---
title: "Settle a generation offer and create (or resume) the generation"
method: POST
path: "/v1/images/generate/redeem"
tags: ["Generation"]
---

# Settle a generation offer and create (or resume) the generation

`POST /v1/images/generate/redeem`

## Request

- Base URL: `https://api.memestack.ai`
- URL: `https://api.memestack.ai/v1/images/generate/redeem`
- Auth: HTTP bearer

Checks the offer's invoice for settlement and creates the generation once — the same `mode`/`prompt`/`aspect_ratio`/references as the offer are validated again here and are what actually generate. Poll this at ~2.5 s until the invoice settles (202 while unpaid), then keep calling it to follow the job: `running` → `done` (with the image) or `policy_rejected` (payment retained, no refund). A `failed` job is re-driven on the SAME payment by the next call (`redriven: true`) — one payment delivers at most one image. Account-bound: an expired macaroon still resumes this account's paid claim; another account's is refused. Not gated by IMAGE_GEN_ENABLED for money purposes — with generation off and the invoice PAID, the payment is recorded and the claim stays open (503 GENERATION_UNAVAILABLE, `claim_open: true`). Rate limited 60/min/user. Every answer is private, no-store.

## Request body

- object
  - `mode` 'standard' | 'quality' | 'edit', required
  - `prompt` string, required
  - `aspect_ratio` '1:1' | '3:4' | '16:9', required
  - `ref_image_ids` string[]
  - `ref_upload_ids` string[]
  - `macaroon` string, required: The macaroon from the /v1/images/generate 402.

## Response `200`

The bound generation's current state. `done` carries the image summary; `policy_rejected` closes the claim with the payment retained; `failed` (rare) reports a delivered-then-failed row without re-driving; `running` with `redriven: true` means this call re-dispatched a failed job.

- object
  - `image_id` string, uuid
  - `status` 'done' | 'policy_rejected' | 'failed' | 'running'
  - `redriven` boolean
  - `image` object, nullable
    - `id` string, uuid
    - `caption` string, nullable
    - `tags` object[], nullable
    - `thumb` boolean

## Other responses

- `201`: Invoice settled and the generation dispatched.
- `202`: Invoice not paid yet (AWAITING_PAYMENT) — keep polling.
- `400`: INVALID_MODE / INVALID_PROMPT / INVALID_ASPECT, an invalid reference set, or PRICE_MISMATCH (the macaroon was minted for another mode's price).
- `401`: Authentication required.
- `402`: Macaroon missing, malformed, invalid, bound to another tool, or from a previous payment provider (PAYMENT_INVALID) — request a new offer.
- `404`: The payment belongs to another account's claim (NOT_FOUND), or a referenced image does not exist.
- `410`: The generated image was removed (IMAGE_REMOVED); the payment is recorded for reconciliation.
- `429`: Rate limit exceeded (60/min/user).
- `502`: Could not enqueue the job (ENQUEUE_FAILED) — `claim_open: true`, retry with the same macaroon.
- `503`: PAYMENT_UNAVAILABLE (payments paused or the settlement check failed) or GENERATION_UNAVAILABLE (generation disabled; `claim_open: true`) — the paid invoice is recorded, retry later with the same macaroon.

---

[API](https://skmtc.dev/memestack/apis/memestack-api.md) · [All operations](https://skmtc.dev/memestack/apis/memestack-api/llms.txt) · [OpenAPI document](https://skmtc.dev/memestack/apis/memestack-api/revisions/9d3a19565f75?raw)
