{
  "openapi": "3.1.0",
  "info": {
    "title": "OUTPUT quote, order, and job API (devnet sandbox)",
    "version": "1.0.0",
    "description": "Authenticated quote, idempotent order, and job observation for output.jeezlabs.io. DEVNET SANDBOX: a quote does not reserve material, an order does not accept payment or fund escrow, and job observation never marks manufacture ready. Funding elsewhere in the product, when enabled, uses Solana devnet test tokens and is not documented here. This file describes only the routes whose JSON shapes were verified in the application code and database migrations. It omits /api/demo, /api/admin, /api/workspace, /api/session, artwork download, proof, funding, and lifecycle routes. priceUsdc on a quote is a frozen estimate, not a charge. API v1 uses /api/v1 paths. Unversioned paths remain supported aliases. Breaking changes require a new major URL path. Planned retirement is announced on /developers at least 90 days before removal, with Deprecation (RFC 9745) and Sunset (RFC 8594) headers on affected responses; no retirement is scheduled.",
    "contact": {"url": "https://output.jeezlabs.io/contact"}
  },
  "externalDocs": {"description": "When to use OUTPUT, and how to authenticate", "url": "https://output.jeezlabs.io/llms.txt"},
  "servers": [{"url": "https://output.jeezlabs.io"}],
  "tags": [
    {"name": "quotes", "description": "Supported destinations and durable quotes. Quotes reserve no stock."},
    {"name": "orders", "description": "Idempotent order placement. Does not accept or send payment."},
    {"name": "jobs", "description": "Requester-scoped observation of a job already placed."}
  ],
  "components": {
    "securitySchemes": {
      "privyBearer": {
        "type": "http",
        "scheme": "bearer",
        "description": "Privy access token for the signed-in user. Quotes and orders also require selectedWallet in the JSON body. The job observer requires the same wallet in the X-Output-Wallet header. The website's same-origin session cookies are an alternate for browsers; a cookie call must come from OUTPUT_ORIGIN or it receives 403."
      }
    },
    "parameters": {
      "idempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": false,
        "description": "Stable retry key, 8–80 characters from [A-Za-z0-9_-]. When omitted, the server uses JSON requestId, then requestKey. One of the three is required. The same key and the same quote, shop, and spec hash return the same job. The same key with a different choice returns 409.",
        "schema": {"type": "string", "pattern": "^[a-zA-Z0-9_-]{8,80}$"}
      },
      "outputWallet": {
        "name": "X-Output-Wallet",
        "in": "header",
        "required": false,
        "description": "Solana wallet to verify against the bearer token. Required for agent calls. A missing or unlinked wallet is answered as 401, not as a separate 400, on this route.",
        "schema": {"type": "string", "pattern": "^[1-9A-HJ-NP-Za-km-z]{32,44}$"}
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": ["type", "title", "status", "code", "detail", "error", "resolution", "docs"],
        "properties": {
          "type": {"type": "string", "const": "about:blank"},
          "title": {"type": "string"},
          "status": {"type": "integer", "minimum": 400, "maximum": 599},
          "code": {"type": "string"},
          "detail": {"type": "string"},
          "error": {"type": "string"},
          "resolution": {"type": "string"},
          "docs": {"type": "string", "format": "uri"}
        },
        "additionalProperties": false
      },
      "Destination": {
        "type": "object",
        "required": ["zip", "label"],
        "properties": {
          "zip": {"type": "string", "enum": ["78701", "90012", "75201", "33130"]},
          "label": {"type": "string", "enum": ["Austin, TX", "Los Angeles, CA", "Dallas, TX", "Miami, FL"]}
        },
        "additionalProperties": false
      },
      "QuoteOffer": {
        "type": "object",
        "required": ["outpostId", "name", "eligible", "reason", "rank", "score", "requiredLinearFt", "priceUsdc", "etaMinutes"],
        "properties": {
          "outpostId": {"type": "string", "description": "Shop id from the quote. Send this value as outpostId when ordering."},
          "name": {"type": "string"},
          "eligible": {"type": "boolean"},
          "reason": {"type": "string"},
          "rank": {"type": ["integer", "null"]},
          "score": {"type": ["number", "null"]},
          "requiredLinearFt": {"type": ["number", "null"]},
          "priceUsdc": {
            "type": ["number", "null"],
            "description": "Frozen estimate copied from the quote snapshot. Not a charge and not an escrow balance. Missing or non-finite snapshots are null. A finite zero is kept."
          },
          "etaMinutes": {"type": ["number", "null"], "description": "Frozen time estimate in minutes, or null when the snapshot has no finite value."}
        },
        "additionalProperties": false
      },
      "Quote": {
        "type": "object",
        "required": ["quoteId", "specHash", "expiresAt", "deadlineAt", "offers"],
        "properties": {
          "quoteId": {"type": "string", "format": "uuid"},
          "specHash": {"type": "string", "pattern": "^[0-9a-f]{64}$"},
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "description": "Quote expiry. At most 15 minutes after creation, and never later than the production deadline."
          },
          "deadlineAt": {"type": "string", "format": "date-time"},
          "offers": {"type": "array", "items": {"$ref": "#/components/schemas/QuoteOffer"}}
        },
        "additionalProperties": false
      },
      "QuoteRequest": {
        "type": "object",
        "required": ["selectedWallet", "svgBase64", "quantity", "fulfillment", "destinationZip", "dueAt"],
        "properties": {
          "selectedWallet": {
            "type": "string",
            "pattern": "^[1-9A-HJ-NP-Za-km-z]{32,44}$",
            "description": "Solana wallet linked to the bearer token. Ignored as proof of identity until the server verifies that link."
          },
          "svgBase64": {"type": "string", "description": "Base64 of a UTF-8 SVG. Decoded size must be at most 5 MB. The quote body limit is 7056044 bytes (base64 artwork plus the JSON envelope)."},
          "filename": {
            "type": "string",
            "default": "artwork.svg",
            "description": "Must end in .svg, case-insensitive. Stored filename is truncated to 255 characters."
          },
          "quantity": {"type": "integer", "minimum": 1, "maximum": 10000},
          "fulfillment": {"type": "string", "enum": ["pickup", "ship"]},
          "destinationZip": {"type": "string", "enum": ["78701", "90012", "75201", "33130"]},
          "dueAt": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}$",
            "description": "Production deadline as YYYY-MM-DDTHH:mm, UTC, in the future and within 90 days."
          },
          "laminate": {"type": "boolean", "default": false, "description": "True requests gloss laminate. Any other value is treated as false."}
        },
        "additionalProperties": true
      },
      "OrderRequest": {
        "type": "object",
        "required": ["selectedWallet", "quoteId", "outpostId", "reason"],
        "properties": {
          "selectedWallet": {"type": "string", "pattern": "^[1-9A-HJ-NP-Za-km-z]{32,44}$"},
          "quoteId": {
            "type": "string",
            "format": "uuid",
            "description": "A non-UUID id is rejected by the store and currently surfaces as HTTP 500 with the generic order error. Send the quoteId from the quote response."
          },
          "outpostId": {"type": "string", "description": "outpostId of an eligible offer on that quote."},
          "reason": {"type": "string", "minLength": 1, "maxLength": 500, "description": "Why this shop was chosen. Blank is rejected. Stored trimmed."},
          "requestId": {"type": "string", "pattern": "^[a-zA-Z0-9_-]{8,80}$", "description": "Used only when the Idempotency-Key header is absent."},
          "requestKey": {"type": "string", "pattern": "^[a-zA-Z0-9_-]{8,80}$", "description": "Used only when both the header and requestId are absent."}
        },
        "additionalProperties": true
      },
      "PublicOrder": {
        "type": "object",
        "description": "Public fields copied from the stored job. The response does not include the rest of the jobs row: requester wallet, artwork URLs or hashes, destination coordinates, payout, escrow address, or funding transaction ids. Prefer GET /api/jobs/{id}/observer for later status. manufacture is not authorized by this response.",
        "required": ["id", "status", "quantity", "specHash", "fulfillment", "dueAt", "materialCode", "laminate", "createdAt"],
        "properties": {
          "id": {"type": ["string", "null"], "format": "uuid"},
          "status": {
            "type": ["string", "null"],
            "description": "A new order is inserted as ROUTING and may already be OFFERED or UNROUTABLE when this response is read."
          },
          "quantity": {"type": ["integer", "null"]},
          "specHash": {"type": ["string", "null"]},
          "fulfillment": {"type": ["string", "null"]},
          "dueAt": {"type": ["string", "null"], "format": "date-time"},
          "materialCode": {"type": ["string", "null"]},
          "laminate": {"type": "boolean"},
          "createdAt": {"type": ["string", "null"], "format": "date-time"}
        },
        "additionalProperties": false
      },
      "JobProgress": {
        "type": "object",
        "required": ["phase", "title", "detail", "capacityHold", "reservationExpiresAt", "canCancelUnfunded", "manufactureReady", "source"],
        "properties": {
          "phase": {"type": "string", "enum": ["unfunded", "pending", "review", "quarantined", "cancelled", "disputed", "settled", "unknown"]},
          "title": {"type": "string"},
          "detail": {"type": "string"},
          "capacityHold": {"type": "string", "enum": ["none", "temporary", "retained", "unknown"]},
          "reservationExpiresAt": {"type": ["string", "null"], "format": "date-time"},
          "canCancelUnfunded": {"type": "boolean"},
          "manufactureReady": {"const": false, "description": "Always false. Observation does not authorize manufacture."},
          "source": {"const": "persisted-job-state"}
        },
        "additionalProperties": false
      },
      "JobObservation": {
        "type": "object",
        "required": ["jobId", "status", "specHash", "observedAt", "progress", "offers", "events"],
        "properties": {
          "jobId": {"type": "string", "format": "uuid"},
          "status": {"type": "string", "description": "jobs.status of the caller-owned job."},
          "specHash": {"type": "string"},
          "observedAt": {"type": "string", "format": "date-time"},
          "progress": {"$ref": "#/components/schemas/JobProgress"},
          "offers": {
            "type": "array",
            "items": {
              "type": "object",
              "required": ["id", "outpostId", "status"],
              "properties": {"id": {"type": "string"}, "outpostId": {"type": "string"}, "status": {"type": "string"}},
              "additionalProperties": false
            }
          },
          "events": {
            "type": "array",
            "maxItems": 100,
            "description": "Newest 100 events, returned oldest-first inside that window. id and kind only. Event payloads are not included.",
            "items": {
              "type": "object",
              "required": ["id", "kind", "createdAt"],
              "properties": {"id": {"type": "string"}, "kind": {"type": "string"}, "createdAt": {"type": "string", "format": "date-time"}},
              "additionalProperties": false
            }
          }
        },
        "additionalProperties": false
      }
    }
  },
  "paths": {
    "/api/quotes": {
      "get": {
        "tags": ["quotes"],
        "operationId": "listDestinationsLegacy",
        "summary": "Supported destination ZIP codes",
        "description": "Static, non-secret list. No authentication. Use it to resolve a destination before posting a quote. Response is not cached. Supported unversioned alias; no retirement scheduled.",
        "responses": {
          "200": {
            "description": "Current destination list.",
            "headers": {"Cache-Control": {"schema": {"type": "string", "const": "no-store"}}},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["destinations"],
                  "properties": {"destinations": {"type": "array", "items": {"$ref": "#/components/schemas/Destination"}}},
                  "additionalProperties": false
                }
              }
            }
          },
          "405": {
            "description": "Unsupported method; Allow lists supported methods.",
            "headers": {"Allow": {"schema": {"type": "string"}}},
            "content": {"application/problem+json": {"schema": {"$ref": "#/components/schemas/Error"}}}
          }
        }
      },
      "post": {
        "tags": ["quotes"],
        "operationId": "createQuoteLegacy",
        "summary": "Create a durable quote",
        "description": "Persists a quote and returns its id plus offers. Reserves no stock and accepts no payment. Bearer calls are not origin-locked. Cookie calls from another origin receive 403. Supported unversioned alias; no retirement scheduled.",
        "security": [{"privyBearer": []}],
        "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/QuoteRequest"}}}},
        "responses": {
          "200": {
            "description": "Quote created.",
            "headers": {
              "Cache-Control": {"schema": {"type": "string", "const": "no-store"}},
              "RateLimit-Policy": {
                "description": "Per-IP, per-instance policy. Structured Fields per draft-ietf-httpapi-ratelimit-headers-11 (Internet-Draft).",
                "schema": {"type": "string"},
                "example": "\"quotes\";q=20;w=60"
              },
              "RateLimit": {
                "description": "Remaining requests r and seconds to reset t. Aliases share the same bucket.",
                "schema": {"type": "string"},
                "example": "\"quotes\";r=19;t=60"
              }
            },
            "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Quote"}}}
          },
          "400": {
            "description": "Invalid JSON, SVG, filename, quantity, fulfillment, destination, or deadline. A bearer token without selectedWallet is also 400.",
            "content": {"application/problem+json": {"schema": {"$ref": "#/components/schemas/Error"}}},
            "headers": {
              "RateLimit-Policy": {
                "description": "Per-IP, per-instance policy. Structured Fields per draft-ietf-httpapi-ratelimit-headers-11 (Internet-Draft).",
                "schema": {"type": "string"},
                "example": "\"quotes\";q=20;w=60"
              },
              "RateLimit": {
                "description": "Remaining requests r and seconds to reset t. Aliases share the same bucket.",
                "schema": {"type": "string"},
                "example": "\"quotes\";r=19;t=60"
              }
            }
          },
          "401": {
            "description": "Missing session, or the wallet is not linked to the Privy user.",
            "content": {"application/problem+json": {"schema": {"$ref": "#/components/schemas/Error"}}},
            "headers": {
              "RateLimit-Policy": {
                "description": "Per-IP, per-instance policy. Structured Fields per draft-ietf-httpapi-ratelimit-headers-11 (Internet-Draft).",
                "schema": {"type": "string"},
                "example": "\"quotes\";q=20;w=60"
              },
              "RateLimit": {
                "description": "Remaining requests r and seconds to reset t. Aliases share the same bucket.",
                "schema": {"type": "string"},
                "example": "\"quotes\";r=19;t=60"
              }
            }
          },
          "403": {
            "description": "Cookie session failed the same-origin check. The error string is Forbidden.",
            "content": {"application/problem+json": {"schema": {"$ref": "#/components/schemas/Error"}}},
            "headers": {
              "RateLimit-Policy": {
                "description": "Per-IP, per-instance policy. Structured Fields per draft-ietf-httpapi-ratelimit-headers-11 (Internet-Draft).",
                "schema": {"type": "string"},
                "example": "\"quotes\";q=20;w=60"
              },
              "RateLimit": {
                "description": "Remaining requests r and seconds to reset t. Aliases share the same bucket.",
                "schema": {"type": "string"},
                "example": "\"quotes\";r=19;t=60"
              }
            }
          },
          "409": {
            "description": "The deadline passed while the quote was being prepared.",
            "content": {"application/problem+json": {"schema": {"$ref": "#/components/schemas/Error"}}},
            "headers": {
              "RateLimit-Policy": {
                "description": "Per-IP, per-instance policy. Structured Fields per draft-ietf-httpapi-ratelimit-headers-11 (Internet-Draft).",
                "schema": {"type": "string"},
                "example": "\"quotes\";q=20;w=60"
              },
              "RateLimit": {
                "description": "Remaining requests r and seconds to reset t. Aliases share the same bucket.",
                "schema": {"type": "string"},
                "example": "\"quotes\";r=19;t=60"
              }
            }
          },
          "413": {
            "description": "Body exceeds the base64 size of a 5 MB SVG plus 64 KB (7056044 bytes). Error text is \"Request too large.\"",
            "content": {"application/problem+json": {"schema": {"$ref": "#/components/schemas/Error"}}},
            "headers": {
              "RateLimit-Policy": {
                "description": "Per-IP, per-instance policy. Structured Fields per draft-ietf-httpapi-ratelimit-headers-11 (Internet-Draft).",
                "schema": {"type": "string"},
                "example": "\"quotes\";q=20;w=60"
              },
              "RateLimit": {
                "description": "Remaining requests r and seconds to reset t. Aliases share the same bucket.",
                "schema": {"type": "string"},
                "example": "\"quotes\";r=19;t=60"
              }
            }
          },
          "429": {
            "description": "More than 20 quote POSTs from this client IP in one minute. Error text is \"Too many requests. Retry shortly.\" Retry-After is in seconds. The limit is per server instance.",
            "content": {"application/problem+json": {"schema": {"$ref": "#/components/schemas/Error"}}},
            "headers": {
              "RateLimit-Policy": {
                "description": "Per-IP, per-instance policy. Structured Fields per draft-ietf-httpapi-ratelimit-headers-11 (Internet-Draft).",
                "schema": {"type": "string"},
                "example": "\"quotes\";q=20;w=60"
              },
              "RateLimit": {
                "description": "Remaining requests r and seconds to reset t. Aliases share the same bucket.",
                "schema": {"type": "string"},
                "example": "\"quotes\";r=19;t=60"
              },
              "Retry-After": {"description": "Seconds to wait; takes precedence over RateLimit.", "schema": {"type": "integer", "minimum": 1}}
            }
          },
          "500": {
            "description": "Unexpected failure. Intentional messages are not leaked. Fallback text is \"Unable to create a quote.\"",
            "content": {"application/problem+json": {"schema": {"$ref": "#/components/schemas/Error"}}},
            "headers": {
              "RateLimit-Policy": {
                "description": "Per-IP, per-instance policy. Structured Fields per draft-ietf-httpapi-ratelimit-headers-11 (Internet-Draft).",
                "schema": {"type": "string"},
                "example": "\"quotes\";q=20;w=60"
              },
              "RateLimit": {
                "description": "Remaining requests r and seconds to reset t. Aliases share the same bucket.",
                "schema": {"type": "string"},
                "example": "\"quotes\";r=19;t=60"
              }
            }
          },
          "503": {
            "description": "Quote timing was unavailable.",
            "content": {"application/problem+json": {"schema": {"$ref": "#/components/schemas/Error"}}},
            "headers": {
              "RateLimit-Policy": {
                "description": "Per-IP, per-instance policy. Structured Fields per draft-ietf-httpapi-ratelimit-headers-11 (Internet-Draft).",
                "schema": {"type": "string"},
                "example": "\"quotes\";q=20;w=60"
              },
              "RateLimit": {
                "description": "Remaining requests r and seconds to reset t. Aliases share the same bucket.",
                "schema": {"type": "string"},
                "example": "\"quotes\";r=19;t=60"
              }
            }
          },
          "405": {
            "description": "Unsupported method; Allow lists supported methods.",
            "headers": {"Allow": {"schema": {"type": "string"}}},
            "content": {"application/problem+json": {"schema": {"$ref": "#/components/schemas/Error"}}}
          }
        }
      }
    },
    "/api/orders": {
      "post": {
        "tags": ["orders"],
        "operationId": "placeOrderLegacy",
        "summary": "Place an idempotent order with one chosen shop",
        "description": "Creates or replays one durable job for the authenticated wallet. Does not accept payment, fund escrow, or authorize manufacture. A replay of the same idempotency key and payload returns the same job even after the quote expires. A fresh key against an expired quote returns 409 and creates nothing. The response order object is the public job fields, not the stored jobs row and not the minimized observer view. Supported unversioned alias; no retirement scheduled.",
        "security": [{"privyBearer": []}],
        "parameters": [{"$ref": "#/components/parameters/idempotencyKey"}],
        "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/OrderRequest"}}}},
        "responses": {
          "200": {
            "description": "Order created or replayed.",
            "headers": {
              "Cache-Control": {"schema": {"type": "string", "const": "no-store"}},
              "RateLimit-Policy": {
                "description": "Per-IP, per-instance policy. Structured Fields per draft-ietf-httpapi-ratelimit-headers-11 (Internet-Draft).",
                "schema": {"type": "string"},
                "example": "\"orders\";q=30;w=60"
              },
              "RateLimit": {
                "description": "Remaining requests r and seconds to reset t. Aliases share the same bucket.",
                "schema": {"type": "string"},
                "example": "\"orders\";r=19;t=60"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["order"],
                  "properties": {"order": {"$ref": "#/components/schemas/PublicOrder"}},
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON, missing idempotency key, or a reason that is empty or longer than 500 characters. A bearer token without selectedWallet is also 400.",
            "content": {"application/problem+json": {"schema": {"$ref": "#/components/schemas/Error"}}},
            "headers": {
              "RateLimit-Policy": {
                "description": "Per-IP, per-instance policy. Structured Fields per draft-ietf-httpapi-ratelimit-headers-11 (Internet-Draft).",
                "schema": {"type": "string"},
                "example": "\"orders\";q=30;w=60"
              },
              "RateLimit": {
                "description": "Remaining requests r and seconds to reset t. Aliases share the same bucket.",
                "schema": {"type": "string"},
                "example": "\"orders\";r=19;t=60"
              }
            }
          },
          "401": {
            "description": "Missing session, or the wallet is not linked to the Privy user.",
            "content": {"application/problem+json": {"schema": {"$ref": "#/components/schemas/Error"}}},
            "headers": {
              "RateLimit-Policy": {
                "description": "Per-IP, per-instance policy. Structured Fields per draft-ietf-httpapi-ratelimit-headers-11 (Internet-Draft).",
                "schema": {"type": "string"},
                "example": "\"orders\";q=30;w=60"
              },
              "RateLimit": {
                "description": "Remaining requests r and seconds to reset t. Aliases share the same bucket.",
                "schema": {"type": "string"},
                "example": "\"orders\";r=19;t=60"
              }
            }
          },
          "403": {
            "description": "The quote belongs to a different wallet, or a cookie session failed the same-origin check.",
            "content": {"application/problem+json": {"schema": {"$ref": "#/components/schemas/Error"}}},
            "headers": {
              "RateLimit-Policy": {
                "description": "Per-IP, per-instance policy. Structured Fields per draft-ietf-httpapi-ratelimit-headers-11 (Internet-Draft).",
                "schema": {"type": "string"},
                "example": "\"orders\";q=30;w=60"
              },
              "RateLimit": {
                "description": "Remaining requests r and seconds to reset t. Aliases share the same bucket.",
                "schema": {"type": "string"},
                "example": "\"orders\";r=19;t=60"
              }
            }
          },
          "404": {
            "description": "No quote with that id.",
            "content": {"application/problem+json": {"schema": {"$ref": "#/components/schemas/Error"}}},
            "headers": {
              "RateLimit-Policy": {
                "description": "Per-IP, per-instance policy. Structured Fields per draft-ietf-httpapi-ratelimit-headers-11 (Internet-Draft).",
                "schema": {"type": "string"},
                "example": "\"orders\";q=30;w=60"
              },
              "RateLimit": {
                "description": "Remaining requests r and seconds to reset t. Aliases share the same bucket.",
                "schema": {"type": "string"},
                "example": "\"orders\";r=19;t=60"
              }
            }
          },
          "409": {
            "description": "Shop was not an eligible offer, the idempotency key was already used for a different payload, or a fresh key arrived after the quote expired.",
            "content": {"application/problem+json": {"schema": {"$ref": "#/components/schemas/Error"}}},
            "headers": {
              "RateLimit-Policy": {
                "description": "Per-IP, per-instance policy. Structured Fields per draft-ietf-httpapi-ratelimit-headers-11 (Internet-Draft).",
                "schema": {"type": "string"},
                "example": "\"orders\";q=30;w=60"
              },
              "RateLimit": {
                "description": "Remaining requests r and seconds to reset t. Aliases share the same bucket.",
                "schema": {"type": "string"},
                "example": "\"orders\";r=19;t=60"
              }
            }
          },
          "413": {
            "description": "Body exceeds 64 KB (65536 bytes). Error text is \"Request too large.\"",
            "content": {"application/problem+json": {"schema": {"$ref": "#/components/schemas/Error"}}},
            "headers": {
              "RateLimit-Policy": {
                "description": "Per-IP, per-instance policy. Structured Fields per draft-ietf-httpapi-ratelimit-headers-11 (Internet-Draft).",
                "schema": {"type": "string"},
                "example": "\"orders\";q=30;w=60"
              },
              "RateLimit": {
                "description": "Remaining requests r and seconds to reset t. Aliases share the same bucket.",
                "schema": {"type": "string"},
                "example": "\"orders\";r=19;t=60"
              }
            }
          },
          "429": {
            "description": "More than 30 order POSTs from this client IP in one minute. Error text is \"Too many requests. Retry shortly.\" Retry-After is in seconds. The limit is per server instance.",
            "content": {"application/problem+json": {"schema": {"$ref": "#/components/schemas/Error"}}},
            "headers": {
              "RateLimit-Policy": {
                "description": "Per-IP, per-instance policy. Structured Fields per draft-ietf-httpapi-ratelimit-headers-11 (Internet-Draft).",
                "schema": {"type": "string"},
                "example": "\"orders\";q=30;w=60"
              },
              "RateLimit": {
                "description": "Remaining requests r and seconds to reset t. Aliases share the same bucket.",
                "schema": {"type": "string"},
                "example": "\"orders\";r=19;t=60"
              },
              "Retry-After": {"description": "Seconds to wait; takes precedence over RateLimit.", "schema": {"type": "integer", "minimum": 1}}
            }
          },
          "500": {
            "description": "Unexpected failure, including a quoteId that is not a UUID. Fallback text is \"Unable to place this order.\"",
            "content": {"application/problem+json": {"schema": {"$ref": "#/components/schemas/Error"}}},
            "headers": {
              "RateLimit-Policy": {
                "description": "Per-IP, per-instance policy. Structured Fields per draft-ietf-httpapi-ratelimit-headers-11 (Internet-Draft).",
                "schema": {"type": "string"},
                "example": "\"orders\";q=30;w=60"
              },
              "RateLimit": {
                "description": "Remaining requests r and seconds to reset t. Aliases share the same bucket.",
                "schema": {"type": "string"},
                "example": "\"orders\";r=19;t=60"
              }
            }
          },
          "405": {
            "description": "Unsupported method; Allow lists supported methods.",
            "headers": {"Allow": {"schema": {"type": "string"}}},
            "content": {"application/problem+json": {"schema": {"$ref": "#/components/schemas/Error"}}}
          }
        }
      }
    },
    "/api/jobs/{id}/observer": {
      "get": {
        "tags": ["jobs"],
        "operationId": "observeJobLegacy",
        "summary": "Read status for a job the caller can access",
        "description": "Requester-only minimized view of one durable job: progress, offer ids and statuses, and the newest 100 events without payloads. Places no order and invents no state. A non-UUID id and a job the caller cannot access both return 404. Authentication failures, including a bearer token without X-Output-Wallet, all return 401 with \"Sign in to observe your job.\" Supported unversioned alias; no retirement scheduled.",
        "security": [{"privyBearer": []}],
        "parameters": [
          {"name": "id", "in": "path", "required": true, "schema": {"type": "string", "format": "uuid"}},
          {"$ref": "#/components/parameters/outputWallet"}
        ],
        "responses": {
          "200": {
            "description": "Current observation.",
            "headers": {"Cache-Control": {"schema": {"type": "string", "const": "no-store"}}},
            "content": {"application/json": {"schema": {"$ref": "#/components/schemas/JobObservation"}}}
          },
          "401": {
            "description": "Sign-in failed or the wallet header did not verify.",
            "content": {"application/problem+json": {"schema": {"$ref": "#/components/schemas/Error"}}}
          },
          "404": {
            "description": "Job not found for this caller, or the id is not a UUID.",
            "content": {"application/problem+json": {"schema": {"$ref": "#/components/schemas/Error"}}}
          },
          "503": {
            "description": "Event history could not be read. No progress is inferred. Error text is \"Live updates are unavailable. Retry shortly.\"",
            "content": {"application/problem+json": {"schema": {"$ref": "#/components/schemas/Error"}}}
          },
          "405": {
            "description": "Unsupported method; Allow lists supported methods.",
            "headers": {"Allow": {"schema": {"type": "string"}}},
            "content": {"application/problem+json": {"schema": {"$ref": "#/components/schemas/Error"}}}
          }
        }
      }
    },
    "/api/v1/quotes": {
      "get": {
        "tags": ["quotes"],
        "operationId": "listDestinations",
        "summary": "Supported destination ZIP codes",
        "description": "Static, non-secret list. No authentication. Use it to resolve a destination before posting a quote. Response is not cached.",
        "responses": {
          "200": {
            "description": "Current destination list.",
            "headers": {"Cache-Control": {"schema": {"type": "string", "const": "no-store"}}},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["destinations"],
                  "properties": {"destinations": {"type": "array", "items": {"$ref": "#/components/schemas/Destination"}}},
                  "additionalProperties": false
                }
              }
            }
          },
          "405": {
            "description": "Unsupported method; Allow lists supported methods.",
            "headers": {"Allow": {"schema": {"type": "string"}}},
            "content": {"application/problem+json": {"schema": {"$ref": "#/components/schemas/Error"}}}
          }
        }
      },
      "post": {
        "tags": ["quotes"],
        "operationId": "createQuote",
        "summary": "Create a durable quote",
        "description": "Persists a quote and returns its id plus offers. Reserves no stock and accepts no payment. Bearer calls are not origin-locked. Cookie calls from another origin receive 403.",
        "security": [{"privyBearer": []}],
        "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/QuoteRequest"}}}},
        "responses": {
          "200": {
            "description": "Quote created.",
            "headers": {
              "Cache-Control": {"schema": {"type": "string", "const": "no-store"}},
              "RateLimit-Policy": {
                "description": "Per-IP, per-instance policy. Structured Fields per draft-ietf-httpapi-ratelimit-headers-11 (Internet-Draft).",
                "schema": {"type": "string"},
                "example": "\"quotes\";q=20;w=60"
              },
              "RateLimit": {
                "description": "Remaining requests r and seconds to reset t. Aliases share the same bucket.",
                "schema": {"type": "string"},
                "example": "\"quotes\";r=19;t=60"
              }
            },
            "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Quote"}}}
          },
          "400": {
            "description": "Invalid JSON, SVG, filename, quantity, fulfillment, destination, or deadline. A bearer token without selectedWallet is also 400.",
            "content": {"application/problem+json": {"schema": {"$ref": "#/components/schemas/Error"}}},
            "headers": {
              "RateLimit-Policy": {
                "description": "Per-IP, per-instance policy. Structured Fields per draft-ietf-httpapi-ratelimit-headers-11 (Internet-Draft).",
                "schema": {"type": "string"},
                "example": "\"quotes\";q=20;w=60"
              },
              "RateLimit": {
                "description": "Remaining requests r and seconds to reset t. Aliases share the same bucket.",
                "schema": {"type": "string"},
                "example": "\"quotes\";r=19;t=60"
              }
            }
          },
          "401": {
            "description": "Missing session, or the wallet is not linked to the Privy user.",
            "content": {"application/problem+json": {"schema": {"$ref": "#/components/schemas/Error"}}},
            "headers": {
              "RateLimit-Policy": {
                "description": "Per-IP, per-instance policy. Structured Fields per draft-ietf-httpapi-ratelimit-headers-11 (Internet-Draft).",
                "schema": {"type": "string"},
                "example": "\"quotes\";q=20;w=60"
              },
              "RateLimit": {
                "description": "Remaining requests r and seconds to reset t. Aliases share the same bucket.",
                "schema": {"type": "string"},
                "example": "\"quotes\";r=19;t=60"
              }
            }
          },
          "403": {
            "description": "Cookie session failed the same-origin check. The error string is Forbidden.",
            "content": {"application/problem+json": {"schema": {"$ref": "#/components/schemas/Error"}}},
            "headers": {
              "RateLimit-Policy": {
                "description": "Per-IP, per-instance policy. Structured Fields per draft-ietf-httpapi-ratelimit-headers-11 (Internet-Draft).",
                "schema": {"type": "string"},
                "example": "\"quotes\";q=20;w=60"
              },
              "RateLimit": {
                "description": "Remaining requests r and seconds to reset t. Aliases share the same bucket.",
                "schema": {"type": "string"},
                "example": "\"quotes\";r=19;t=60"
              }
            }
          },
          "409": {
            "description": "The deadline passed while the quote was being prepared.",
            "content": {"application/problem+json": {"schema": {"$ref": "#/components/schemas/Error"}}},
            "headers": {
              "RateLimit-Policy": {
                "description": "Per-IP, per-instance policy. Structured Fields per draft-ietf-httpapi-ratelimit-headers-11 (Internet-Draft).",
                "schema": {"type": "string"},
                "example": "\"quotes\";q=20;w=60"
              },
              "RateLimit": {
                "description": "Remaining requests r and seconds to reset t. Aliases share the same bucket.",
                "schema": {"type": "string"},
                "example": "\"quotes\";r=19;t=60"
              }
            }
          },
          "413": {
            "description": "Body exceeds the base64 size of a 5 MB SVG plus 64 KB (7056044 bytes). Error text is \"Request too large.\"",
            "content": {"application/problem+json": {"schema": {"$ref": "#/components/schemas/Error"}}},
            "headers": {
              "RateLimit-Policy": {
                "description": "Per-IP, per-instance policy. Structured Fields per draft-ietf-httpapi-ratelimit-headers-11 (Internet-Draft).",
                "schema": {"type": "string"},
                "example": "\"quotes\";q=20;w=60"
              },
              "RateLimit": {
                "description": "Remaining requests r and seconds to reset t. Aliases share the same bucket.",
                "schema": {"type": "string"},
                "example": "\"quotes\";r=19;t=60"
              }
            }
          },
          "429": {
            "description": "More than 20 quote POSTs from this client IP in one minute. Error text is \"Too many requests. Retry shortly.\" Retry-After is in seconds. The limit is per server instance.",
            "content": {"application/problem+json": {"schema": {"$ref": "#/components/schemas/Error"}}},
            "headers": {
              "RateLimit-Policy": {
                "description": "Per-IP, per-instance policy. Structured Fields per draft-ietf-httpapi-ratelimit-headers-11 (Internet-Draft).",
                "schema": {"type": "string"},
                "example": "\"quotes\";q=20;w=60"
              },
              "RateLimit": {
                "description": "Remaining requests r and seconds to reset t. Aliases share the same bucket.",
                "schema": {"type": "string"},
                "example": "\"quotes\";r=19;t=60"
              },
              "Retry-After": {"description": "Seconds to wait; takes precedence over RateLimit.", "schema": {"type": "integer", "minimum": 1}}
            }
          },
          "500": {
            "description": "Unexpected failure. Intentional messages are not leaked. Fallback text is \"Unable to create a quote.\"",
            "content": {"application/problem+json": {"schema": {"$ref": "#/components/schemas/Error"}}},
            "headers": {
              "RateLimit-Policy": {
                "description": "Per-IP, per-instance policy. Structured Fields per draft-ietf-httpapi-ratelimit-headers-11 (Internet-Draft).",
                "schema": {"type": "string"},
                "example": "\"quotes\";q=20;w=60"
              },
              "RateLimit": {
                "description": "Remaining requests r and seconds to reset t. Aliases share the same bucket.",
                "schema": {"type": "string"},
                "example": "\"quotes\";r=19;t=60"
              }
            }
          },
          "503": {
            "description": "Quote timing was unavailable.",
            "content": {"application/problem+json": {"schema": {"$ref": "#/components/schemas/Error"}}},
            "headers": {
              "RateLimit-Policy": {
                "description": "Per-IP, per-instance policy. Structured Fields per draft-ietf-httpapi-ratelimit-headers-11 (Internet-Draft).",
                "schema": {"type": "string"},
                "example": "\"quotes\";q=20;w=60"
              },
              "RateLimit": {
                "description": "Remaining requests r and seconds to reset t. Aliases share the same bucket.",
                "schema": {"type": "string"},
                "example": "\"quotes\";r=19;t=60"
              }
            }
          },
          "405": {
            "description": "Unsupported method; Allow lists supported methods.",
            "headers": {"Allow": {"schema": {"type": "string"}}},
            "content": {"application/problem+json": {"schema": {"$ref": "#/components/schemas/Error"}}}
          }
        }
      }
    },
    "/api/v1/orders": {
      "post": {
        "tags": ["orders"],
        "operationId": "placeOrder",
        "summary": "Place an idempotent order with one chosen shop",
        "description": "Creates or replays one durable job for the authenticated wallet. Does not accept payment, fund escrow, or authorize manufacture. A replay of the same idempotency key and payload returns the same job even after the quote expires. A fresh key against an expired quote returns 409 and creates nothing. The response order object is the public job fields, not the stored jobs row and not the minimized observer view.",
        "security": [{"privyBearer": []}],
        "parameters": [{"$ref": "#/components/parameters/idempotencyKey"}],
        "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/OrderRequest"}}}},
        "responses": {
          "200": {
            "description": "Order created or replayed.",
            "headers": {
              "Cache-Control": {"schema": {"type": "string", "const": "no-store"}},
              "RateLimit-Policy": {
                "description": "Per-IP, per-instance policy. Structured Fields per draft-ietf-httpapi-ratelimit-headers-11 (Internet-Draft).",
                "schema": {"type": "string"},
                "example": "\"orders\";q=30;w=60"
              },
              "RateLimit": {
                "description": "Remaining requests r and seconds to reset t. Aliases share the same bucket.",
                "schema": {"type": "string"},
                "example": "\"orders\";r=19;t=60"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["order"],
                  "properties": {"order": {"$ref": "#/components/schemas/PublicOrder"}},
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON, missing idempotency key, or a reason that is empty or longer than 500 characters. A bearer token without selectedWallet is also 400.",
            "content": {"application/problem+json": {"schema": {"$ref": "#/components/schemas/Error"}}},
            "headers": {
              "RateLimit-Policy": {
                "description": "Per-IP, per-instance policy. Structured Fields per draft-ietf-httpapi-ratelimit-headers-11 (Internet-Draft).",
                "schema": {"type": "string"},
                "example": "\"orders\";q=30;w=60"
              },
              "RateLimit": {
                "description": "Remaining requests r and seconds to reset t. Aliases share the same bucket.",
                "schema": {"type": "string"},
                "example": "\"orders\";r=19;t=60"
              }
            }
          },
          "401": {
            "description": "Missing session, or the wallet is not linked to the Privy user.",
            "content": {"application/problem+json": {"schema": {"$ref": "#/components/schemas/Error"}}},
            "headers": {
              "RateLimit-Policy": {
                "description": "Per-IP, per-instance policy. Structured Fields per draft-ietf-httpapi-ratelimit-headers-11 (Internet-Draft).",
                "schema": {"type": "string"},
                "example": "\"orders\";q=30;w=60"
              },
              "RateLimit": {
                "description": "Remaining requests r and seconds to reset t. Aliases share the same bucket.",
                "schema": {"type": "string"},
                "example": "\"orders\";r=19;t=60"
              }
            }
          },
          "403": {
            "description": "The quote belongs to a different wallet, or a cookie session failed the same-origin check.",
            "content": {"application/problem+json": {"schema": {"$ref": "#/components/schemas/Error"}}},
            "headers": {
              "RateLimit-Policy": {
                "description": "Per-IP, per-instance policy. Structured Fields per draft-ietf-httpapi-ratelimit-headers-11 (Internet-Draft).",
                "schema": {"type": "string"},
                "example": "\"orders\";q=30;w=60"
              },
              "RateLimit": {
                "description": "Remaining requests r and seconds to reset t. Aliases share the same bucket.",
                "schema": {"type": "string"},
                "example": "\"orders\";r=19;t=60"
              }
            }
          },
          "404": {
            "description": "No quote with that id.",
            "content": {"application/problem+json": {"schema": {"$ref": "#/components/schemas/Error"}}},
            "headers": {
              "RateLimit-Policy": {
                "description": "Per-IP, per-instance policy. Structured Fields per draft-ietf-httpapi-ratelimit-headers-11 (Internet-Draft).",
                "schema": {"type": "string"},
                "example": "\"orders\";q=30;w=60"
              },
              "RateLimit": {
                "description": "Remaining requests r and seconds to reset t. Aliases share the same bucket.",
                "schema": {"type": "string"},
                "example": "\"orders\";r=19;t=60"
              }
            }
          },
          "409": {
            "description": "Shop was not an eligible offer, the idempotency key was already used for a different payload, or a fresh key arrived after the quote expired.",
            "content": {"application/problem+json": {"schema": {"$ref": "#/components/schemas/Error"}}},
            "headers": {
              "RateLimit-Policy": {
                "description": "Per-IP, per-instance policy. Structured Fields per draft-ietf-httpapi-ratelimit-headers-11 (Internet-Draft).",
                "schema": {"type": "string"},
                "example": "\"orders\";q=30;w=60"
              },
              "RateLimit": {
                "description": "Remaining requests r and seconds to reset t. Aliases share the same bucket.",
                "schema": {"type": "string"},
                "example": "\"orders\";r=19;t=60"
              }
            }
          },
          "413": {
            "description": "Body exceeds 64 KB (65536 bytes). Error text is \"Request too large.\"",
            "content": {"application/problem+json": {"schema": {"$ref": "#/components/schemas/Error"}}},
            "headers": {
              "RateLimit-Policy": {
                "description": "Per-IP, per-instance policy. Structured Fields per draft-ietf-httpapi-ratelimit-headers-11 (Internet-Draft).",
                "schema": {"type": "string"},
                "example": "\"orders\";q=30;w=60"
              },
              "RateLimit": {
                "description": "Remaining requests r and seconds to reset t. Aliases share the same bucket.",
                "schema": {"type": "string"},
                "example": "\"orders\";r=19;t=60"
              }
            }
          },
          "429": {
            "description": "More than 30 order POSTs from this client IP in one minute. Error text is \"Too many requests. Retry shortly.\" Retry-After is in seconds. The limit is per server instance.",
            "content": {"application/problem+json": {"schema": {"$ref": "#/components/schemas/Error"}}},
            "headers": {
              "RateLimit-Policy": {
                "description": "Per-IP, per-instance policy. Structured Fields per draft-ietf-httpapi-ratelimit-headers-11 (Internet-Draft).",
                "schema": {"type": "string"},
                "example": "\"orders\";q=30;w=60"
              },
              "RateLimit": {
                "description": "Remaining requests r and seconds to reset t. Aliases share the same bucket.",
                "schema": {"type": "string"},
                "example": "\"orders\";r=19;t=60"
              },
              "Retry-After": {"description": "Seconds to wait; takes precedence over RateLimit.", "schema": {"type": "integer", "minimum": 1}}
            }
          },
          "500": {
            "description": "Unexpected failure, including a quoteId that is not a UUID. Fallback text is \"Unable to place this order.\"",
            "content": {"application/problem+json": {"schema": {"$ref": "#/components/schemas/Error"}}},
            "headers": {
              "RateLimit-Policy": {
                "description": "Per-IP, per-instance policy. Structured Fields per draft-ietf-httpapi-ratelimit-headers-11 (Internet-Draft).",
                "schema": {"type": "string"},
                "example": "\"orders\";q=30;w=60"
              },
              "RateLimit": {
                "description": "Remaining requests r and seconds to reset t. Aliases share the same bucket.",
                "schema": {"type": "string"},
                "example": "\"orders\";r=19;t=60"
              }
            }
          },
          "405": {
            "description": "Unsupported method; Allow lists supported methods.",
            "headers": {"Allow": {"schema": {"type": "string"}}},
            "content": {"application/problem+json": {"schema": {"$ref": "#/components/schemas/Error"}}}
          }
        }
      }
    },
    "/api/v1/jobs/{id}/observer": {
      "get": {
        "tags": ["jobs"],
        "operationId": "observeJob",
        "summary": "Read status for a job the caller can access",
        "description": "Requester-only minimized view of one durable job: progress, offer ids and statuses, and the newest 100 events without payloads. Places no order and invents no state. A non-UUID id and a job the caller cannot access both return 404. Authentication failures, including a bearer token without X-Output-Wallet, all return 401 with \"Sign in to observe your job.\"",
        "security": [{"privyBearer": []}],
        "parameters": [
          {"name": "id", "in": "path", "required": true, "schema": {"type": "string", "format": "uuid"}},
          {"$ref": "#/components/parameters/outputWallet"}
        ],
        "responses": {
          "200": {
            "description": "Current observation.",
            "headers": {"Cache-Control": {"schema": {"type": "string", "const": "no-store"}}},
            "content": {"application/json": {"schema": {"$ref": "#/components/schemas/JobObservation"}}}
          },
          "401": {
            "description": "Sign-in failed or the wallet header did not verify.",
            "content": {"application/problem+json": {"schema": {"$ref": "#/components/schemas/Error"}}}
          },
          "404": {
            "description": "Job not found for this caller, or the id is not a UUID.",
            "content": {"application/problem+json": {"schema": {"$ref": "#/components/schemas/Error"}}}
          },
          "503": {
            "description": "Event history could not be read. No progress is inferred. Error text is \"Live updates are unavailable. Retry shortly.\"",
            "content": {"application/problem+json": {"schema": {"$ref": "#/components/schemas/Error"}}}
          },
          "405": {
            "description": "Unsupported method; Allow lists supported methods.",
            "headers": {"Allow": {"schema": {"type": "string"}}},
            "content": {"application/problem+json": {"schema": {"$ref": "#/components/schemas/Error"}}}
          }
        }
      }
    }
  }
}
