{
  "openapi": "3.1.0",
  "info": {
    "title": "Worth API",
    "version": "2026-09-19",
    "summary": "Identify any physical item from photos and return an AI-generated resale valuation range.",
    "description": "Values are AI estimates, not live marketplace comparables, guarantees, or offers. Unknown details are returned as null rather than guessed. Callers are expected to relay `confidence` and `warnings` to their own users.\n\nEvery request needs three headers: `Authorization`, `Idempotency-Key` (UUID v4) and `Worth-Version`. Full prose docs at https://api.tryworthit.co/docs",
    "contact": {
      "name": "Worth API support",
      "url": "https://tryworthit.co/support"
    },
    "license": {
      "name": "Proprietary",
      "identifier": "LicenseRef-Proprietary"
    }
  },
  "servers": [
    {
      "url": "https://api.tryworthit.co",
      "description": "Production"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "tags": [
    {
      "name": "Valuations",
      "description": "Turn photos of an item into a price range."
    }
  ],
  "paths": {
    "/v1/valuations": {
      "post": {
        "tags": [
          "Valuations"
        ],
        "operationId": "createValuation",
        "summary": "Value an item from photos",
        "description": "Send 1-5 photos of a single item. Returns `status: \"completed\"` with a price range, or `status: \"needs_input\"` with exactly one question. To answer the question, resend the whole request (images included) with `previous_valuation_id` and `clarification_answer` added and a **fresh** `Idempotency-Key`. There is exactly one clarification round.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "UUID v4. Same key + same body replays the original response; same key + a different body is a 409. Records live 24 hours.",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "550e8400-e29b-41d4-a716-446655440000"
          },
          {
            "name": "Worth-Version",
            "in": "header",
            "required": true,
            "description": "The contract date you coded against. Breaking changes ship as new versions.",
            "schema": {
              "type": "string",
              "enum": [
                "2026-09-19"
              ]
            },
            "example": "2026-09-19"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ValuationRequest"
              },
              "encoding": {
                "images": {
                  "contentType": "image/jpeg, image/png, image/webp, image/gif"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "A completed valuation, or a single clarifying question.",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Unique to this call, including replays."
              },
              "Worth-Version": {
                "schema": {
                  "type": "string"
                },
                "description": "The contract version that produced this response."
              },
              "RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Valuations allowed per hour on this key."
              },
              "RateLimit-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Remaining in the current hour."
              },
              "RateLimit-Reset": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              },
              "Idempotent-Replay": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when this body is a replay of an earlier identical request."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Valuation"
                },
                "examples": {
                  "completed": {
                    "summary": "A priced item",
                    "value": {
                      "status": "completed",
                      "valuation_id": "val_9f3a1c72b8e04d6a5f3c2190",
                      "object": {
                        "name": "Eames-style lounge chair",
                        "brand": "Herman Miller",
                        "model": null,
                        "category": "lounge_chair",
                        "condition": "good"
                      },
                      "valuation": {
                        "low": 850,
                        "likely": 1100,
                        "high": 1400,
                        "currency": "USD"
                      },
                      "pricing": {
                        "sell_fast": 800,
                        "fair": 1100,
                        "patient": 1350
                      },
                      "confidence": 0.82,
                      "assumptions": [
                        "Walnut veneer, original upholstery"
                      ],
                      "warnings": [
                        "AI-generated estimate — not an appraisal, a live comparable, or an offer."
                      ],
                      "recommends_appraisal": false,
                      "request_id": "req_2f1c9a7b4d0e5a3c8b1f6d24"
                    }
                  },
                  "needs_input": {
                    "summary": "One question first",
                    "value": {
                      "status": "needs_input",
                      "valuation_id": "val_41b7e0a9d3c25f8614ab7290",
                      "object": {
                        "name": "DSLR camera body",
                        "brand": "Canon",
                        "model": null,
                        "category": "camera",
                        "condition": "good"
                      },
                      "valuation": null,
                      "pricing": null,
                      "confidence": 0.48,
                      "assumptions": [
                        "Body only; no lens visible in the photo"
                      ],
                      "warnings": [
                        "AI-generated estimate — not an appraisal, a live comparable, or an offer.",
                        "Identification confidence is low. Send clearer or additional photos for a better estimate."
                      ],
                      "clarification": {
                        "question": "Does it come with a lens, and does the shutter still fire?"
                      },
                      "recommends_appraisal": false,
                      "request_id": "req_88d1c04eab37925f6c130ade"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Malformed request. Read the message, fix it, resend.",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Echo this when reporting a problem."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "invalid_request",
                    "message": "A Worth-Version header is required. The current contract is 2026-09-19."
                  },
                  "request_id": "req_2f1c9a7b4d0e5a3c8b1f6d24"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Echo this when reporting a problem."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "unauthenticated",
                    "message": "Missing or invalid API key. Send `Authorization: Bearer wk_live_…`."
                  },
                  "request_id": "req_2f1c9a7b4d0e5a3c8b1f6d24"
                }
              }
            }
          },
          "403": {
            "description": "The key was revoked. Do not retry.",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Echo this when reporting a problem."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "forbidden",
                    "message": "This API key has been revoked."
                  },
                  "request_id": "req_2f1c9a7b4d0e5a3c8b1f6d24"
                }
              }
            }
          },
          "409": {
            "description": "The Idempotency-Key was reused with a different body.",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Echo this when reporting a problem."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "idempotency_conflict",
                    "message": "This Idempotency-Key was already used with a different request body. Generate a new key for a new valuation."
                  },
                  "request_id": "req_2f1c9a7b4d0e5a3c8b1f6d24"
                }
              }
            }
          },
          "422": {
            "description": "The photos cannot be used, or the item is outside what Worth values. Never retry unchanged — the result is stored against your Idempotency-Key and replayed.",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "image_unusable": {
                    "value": {
                      "error": {
                        "code": "image_unusable",
                        "message": "HEIC is not supported. Convert to JPEG before uploading."
                      },
                      "request_id": "req_…"
                    }
                  },
                  "unable_to_value": {
                    "value": {
                      "error": {
                        "code": "unable_to_value",
                        "message": "Vehicles are not valued at this contract version."
                      },
                      "request_id": "req_…"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Hourly cap, concurrency cap, or monthly allowance. Back off per Retry-After.",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds. Truthful — waiting this long will work."
              },
              "RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "rate_limited",
                    "message": "Hourly limit of 60 valuations reached for this key."
                  },
                  "request_id": "req_…"
                }
              }
            }
          },
          "503": {
            "description": "Transient. Retry with exponential backoff. Also returned while a request with the same Idempotency-Key is still in flight.",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "temporarily_unavailable",
                    "message": "The valuation service is temporarily unavailable."
                  },
                  "request_id": "req_…"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "An API key: `wk_live_` for production, `wk_test_` for sandbox. Keep it server-side."
      }
    },
    "schemas": {
      "ValuationRequest": {
        "type": "object",
        "required": [
          "images"
        ],
        "properties": {
          "images": {
            "type": "array",
            "minItems": 1,
            "maxItems": 5,
            "description": "1-5 photos of the SAME item. JPEG, PNG, WebP or GIF, 5 MB each. The format is read from the file's own bytes, not the declared content type; HEIC is rejected. Images are resized to 1200px on the longest edge and re-encoded, which is where EXIF and GPS are discarded.",
            "items": {
              "type": "string",
              "format": "binary"
            }
          },
          "market": {
            "type": "string",
            "default": "US",
            "enum": [
              "US",
              "CA",
              "GB",
              "IE",
              "AU",
              "NZ",
              "EU"
            ],
            "description": "Which country's consumer resale market the estimate is tuned for."
          },
          "currency": {
            "type": "string",
            "enum": [
              "USD",
              "CAD",
              "GBP",
              "EUR",
              "AUD",
              "NZD"
            ],
            "description": "Defaults to the market's own currency. The estimate is produced natively in this currency, not converted from USD."
          },
          "condition_hint": {
            "type": "string",
            "enum": [
              "new",
              "like_new",
              "good",
              "fair",
              "poor",
              "for_parts"
            ],
            "description": "Treated as a claim, not a fact. If the photos plainly contradict it, the photos win and the disagreement is noted."
          },
          "category_hint": {
            "type": "string",
            "maxLength": 500,
            "examples": [
              "mid-century furniture"
            ]
          },
          "notes": {
            "type": "string",
            "maxLength": 500,
            "description": "Anything the photos do not show.",
            "examples": [
              "Minor scratch on the left leg"
            ]
          },
          "previous_valuation_id": {
            "type": "string",
            "maxLength": 500,
            "description": "Correction flow. The valuation_id that asked you a question. Must be sent with clarification_answer, and must belong to the same API key."
          },
          "clarification_answer": {
            "type": "string",
            "maxLength": 500,
            "description": "Correction flow. Your user's answer. Must be sent with previous_valuation_id."
          }
        }
      },
      "Valuation": {
        "type": "object",
        "required": [
          "status",
          "valuation_id",
          "object",
          "valuation",
          "pricing",
          "confidence",
          "assumptions",
          "warnings",
          "request_id"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "completed",
              "needs_input"
            ]
          },
          "valuation_id": {
            "type": "string",
            "description": "Stable id for this result. Retained 12 months."
          },
          "object": {
            "type": [
              "object",
              "null"
            ],
            "required": [
              "name",
              "brand",
              "model",
              "category",
              "condition"
            ],
            "description": "What the model concluded the item is. `brand` and `model` are null rather than guessed.",
            "properties": {
              "name": {
                "type": "string",
                "description": "Short product name, no brand and no caveats."
              },
              "brand": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "model": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "category": {
                "type": "string"
              },
              "condition": {
                "type": "string",
                "enum": [
                  "new",
                  "like_new",
                  "good",
                  "fair",
                  "poor"
                ]
              }
            }
          },
          "valuation": {
            "type": [
              "object",
              "null"
            ],
            "required": [
              "low",
              "likely",
              "high",
              "currency"
            ],
            "description": "Null when status is needs_input. Rounded to the nearest 5 below 200, 10 up to 1,000, 25 above.",
            "properties": {
              "low": {
                "type": "number"
              },
              "likely": {
                "type": "number",
                "description": "Lead with this one. Equal to pricing.fair, and always inside [low, high]."
              },
              "high": {
                "type": "number"
              },
              "currency": {
                "type": "string",
                "enum": [
                  "USD",
                  "CAD",
                  "GBP",
                  "EUR",
                  "AUD",
                  "NZD"
                ]
              }
            }
          },
          "pricing": {
            "type": [
              "object",
              "null"
            ],
            "required": [
              "sell_fast",
              "fair",
              "patient"
            ],
            "description": "Null when status is needs_input. Strictly increasing: sell_fast < fair < patient.",
            "properties": {
              "sell_fast": {
                "type": "number",
                "description": "Undercuts the market to move quickly."
              },
              "fair": {
                "type": "number",
                "description": "What most sellers should ask."
              },
              "patient": {
                "type": "number",
                "description": "For a seller willing to wait."
              }
            }
          },
          "confidence": {
            "type": "number",
            "minimum": 0,
            "maximum": 1,
            "description": "Honest probability the identification is correct. Below about 0.55 a warning says so; surface it either way."
          },
          "assumptions": {
            "type": "array",
            "maxItems": 5,
            "items": {
              "type": "string"
            },
            "description": "Specific things taken to be true in order to price it — each one a claim a buyer could contradict. The fastest way for your user to correct the estimate."
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Always contains the estimate disclaimer. Pass these through to your users verbatim."
          },
          "clarification": {
            "type": "object",
            "required": [
              "question"
            ],
            "description": "Present only when status is needs_input. Exactly one question; there is never a second round.",
            "properties": {
              "question": {
                "type": "string"
              }
            }
          },
          "recommends_appraisal": {
            "type": "boolean",
            "description": "True for jewellery, fine art, rare antiques, authentication-sensitive luxury and graded collectibles. The estimate is still real; a human expert should confirm it."
          },
          "request_id": {
            "type": "string"
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error",
          "request_id"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "unauthenticated",
                  "forbidden",
                  "invalid_request",
                  "image_unusable",
                  "unable_to_value",
                  "idempotency_conflict",
                  "rate_limited",
                  "temporarily_unavailable"
                ]
              },
              "message": {
                "type": "string"
              }
            }
          },
          "request_id": {
            "type": "string",
            "examples": [
              "req_2f1c9a7b4d0e5a3c8b1f6d24"
            ]
          }
        }
      }
    }
  }
}
