{"openapi":"3.1.0","info":{"title":"space-ocr Public API","version":"v2.9","description":"spocr_* API keys. MySpace CRUD + OCR + webhooks."},"servers":[{"url":"https://api.space-ocr.com"}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"spocr_*"}},"schemas":{"FieldSpec":{"type":"object","properties":{"name":{"type":"string"},"type":{"type":"string","description":"Containers are `array` / `object`; the default is `string`. Declaring a type never reformats `values` and the type is never shown to the model — `values` stays the model's reading of the page, held to the printed text by a normalized character cross-check (width / brackets / whitespace folded), not a byte-for-byte copy; for exact string reconciliation use `cells[path].evidence.printed_text`. A scalar type (`number` / `integer` / `date`) additionally produces `normalized`: the same reading parsed into that type, shaped exactly like `values`. A value that will not parse is null there, the reason lands at `cells[path].normalized.error`, and the cell is flagged `type_mismatch`. Any other string is accepted, read as string, and reported back in `review.notes`."},"description":{"type":"string"},"children":{"type":"array","items":{}},"required":{"type":"boolean","description":"Review declaration: when this field comes back empty or missing, review.flagged reports it with reason \"missing\". Never shown to the model — extraction is unchanged."},"label":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}],"description":"The label printed next to the value (e.g. \"合計\"), or an array of candidates. When the value repeats on the page, coordinates anchor to the occurrence beside this label. Labels spanning several words (\"消費税（8%）\") work as written. Top-level non-container fields only (string / number / integer / date) — a label on an array or object, or on any of its children, is ignored, since a label printed once cannot say which repeating row a value belongs to; line-item children are already anchored within their own row. Fires only when the label is printed exactly once; otherwise the normal search is used and review.notes reports it as issue \"label_unresolved\" (the value still comes back, so that note is the only way to see the declaration is inert). Never shown to the model — text is unchanged, only the coordinate anchor moves."},"pattern":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}],"description":"Regex the NORMALIZED value must satisfy (JSON-Schema semantics: unanchored, use ^…$ for a whole-value rule). String fields only. An array means any-of. Matching runs on the width-folded value, so a plain-ASCII pattern works against a full-width page. Violation → review reason \"pattern_mismatch\"."},"min":{"type":"number","description":"Inclusive lower bound for a number/integer field, checked against the normalized value. Violation → review reason \"out_of_range\"."},"max":{"type":"number","description":"Inclusive upper bound for a number/integer field, checked against the normalized value. Violation → review reason \"out_of_range\"."},"enum":{"type":"array","items":{"type":"string"},"description":"The slot for handing the API a value set your business already owns — a vendor master's company names, an item catalogue, a unit list (袋/本/個). A normalized value outside the set raises review reason \"pattern_mismatch\". Also the only handle on misreads both engines agree on (冊→申), which character cross-checking cannot see. It cannot tell two legitimate set members apart (a registered-but-wrong vendor still passes) — that spot is `near`'s job."},"review":{"type":"string","enum":["normal","off"],"description":"Review sensitivity. \"off\" withholds the reasons the ENGINE infers (text_mismatch, low_ratio, ambiguous_occurrence, …) for this field — the cell keeps all its evidence, only the verdict is withheld. It does NOT silence \"missing\" or a constraint violation: those are rules the caller declared. Use on free-text columns (品名/備考) so the signal on 登録番号/合計 stays readable."},"near":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"object","properties":{"terms":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"match":{"type":"string"}},"required":["terms"]}],"description":"Printed vocabulary this value is expected to sit beside — one term, a list of alternatives, or { terms, match } (御中/様 for an addressee, 登録番号/〒/TEL for an issuer block). The check runs over EVERY occurrence of the value: none beside a declared term raises review reason \"near_mismatch\" (wrong wherever it is printed), one beside a term but not the copy the coordinates landed on raises \"near_ambiguous\" (which copy is meant is undecided). The arithmetic rides in cells[path].evidence.near. When no declared term is printed anywhere the check abstains and review.notes reports \"near_unresolved\". Never shown to the model — it cannot make the pick right, it makes a wrong pick visible."},"not_near":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"object","properties":{"terms":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"match":{"type":"string"}},"required":["terms"]}],"description":"The mirror of `near` — printed vocabulary this value must NOT sit beside (declare 登録番号/TEL/〒 on an addressee name). Sitting beside one raises review reason \"near_conflict\", with the matched term and distance in cells[path].evidence.not_near. Reaches the forms `near` cannot: a form with no addressee line prints no 御中, so `near` can only abstain, while an issuer block always prints something. Absence of the vocabulary is not a violation, so this never abstains and files no note. Never shown to the model."}},"required":["name"]},"ColumnSpec":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"type":"string","description":"\"string\" (default) | \"number\" | \"integer\" | \"date\" | \"array\". Scalar types never reach the model — declaring one adds a parsed `normalized` value per cell and raises `type_mismatch` when the printed value won't parse."},"description":{"type":"string"},"children":{"type":"array","items":{}},"required":{"type":"boolean","description":"Review declaration: report reason \"missing\" when this column comes back empty on an upload. Never shown to the model."},"label":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}],"description":"Printed label to anchor this column's coordinates to when the value repeats on the page (string columns only, engine v64). Never shown to the model."},"pattern":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}],"description":"Regex the extracted value must match (string columns only, JSON-Schema partial-match semantics — anchor with ^…$ for whole-value). Array = any-one-matches. Violation → review reason `pattern_mismatch`. Never shown to the model."},"min":{"type":"number","description":"Inclusive lower bound for a number/integer column's normalized value. Violation → `out_of_range`."},"max":{"type":"number","description":"Inclusive upper bound for a number/integer column's normalized value. Violation → `out_of_range`."},"enum":{"type":"array","items":{"type":"string"},"description":"Allowed values (string columns only). A value outside the set raises review reason `pattern_mismatch`. Never shown to the model."},"near":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"object","properties":{"terms":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"match":{"type":"string"}},"required":["terms"]}],"description":"Vocabulary that must be printed beside the value — one term, a list, or { terms, match }. The check runs over every occurrence of the value: none beside a declared term → `near_mismatch`, one beside a term but not the copy the coordinates landed on → `near_ambiguous`. When the term itself is absent, `review.notes` reports `near_unresolved`. Never shown to the model."},"not_near":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"object","properties":{"terms":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"match":{"type":"string"}},"required":["terms"]}],"description":"The mirror of `near` — vocabulary the value must NOT sit beside (登録番号/TEL/〒 on an addressee column). Sitting beside one raises `near_conflict`. Absence of the vocabulary is not a violation, so this never abstains. Never shown to the model."},"review":{"type":"string","enum":["normal","off"],"description":"\"off\" withholds engine-inferred review reasons for this column. Declared-rule violations (missing / pattern / range / enum / near) still report."}},"required":["name","type"]},"CellEvidence":{"type":"object","properties":{"text_match":{"type":"boolean","description":"The character cross-check itself: did the value equal the OCR text under these coordinates (two independent engines agreeing)? Key present only when the check ran — when it could not run, verified is null. Engine v82 moved this out of `verified`, which is now the review verdict; `verified: false` with `text_match: true` is a normal combination (the characters matched and a declared rule caught it)."},"source":{"type":"string","description":"Where the coordinates came from. Vocabulary varies by endpoint: vision_symbol_match / token_id / char_matcher_fallback / unclaimed_tokens / vision_paragraph …"},"match_ratio":{"type":"number","description":"Match ratio of the character cross-check."},"printed_text":{"type":"string","description":"What the OCR pass itself read at these coordinates (engine v83; /ocr/fields only). `values` is the model's rendering and the cross-check folds width / brackets / whitespace before comparing, so a value the model re-spelled still passes — use printed_text when you need an exact string match, such as reconciling against a master table. It does not supersede values (the OCR pass has its own misreads, which is why the two are cross-checked). Glyphs only — inter-word spacing is not reconstructed, so compare ignoring whitespace. Absent when nothing was matched (no box)."},"ocr_confidence":{"type":"number","description":"Minimum OCR self-confidence over the matched glyphs. Key absent when unavailable. Not a review threshold and not declarable — gate on it caller-side if you need one."},"crop_verified":{"type":"boolean","description":"Result of the crop re-read, present only when it ran."},"multiline":{"type":"boolean","description":"Present (true) only when the value wraps and box is the union of those lines."},"near":{"type":"object","properties":{"occurrences":{"type":"integer","description":"How many times this value is printed on the page."},"satisfied":{"type":"integer","description":"How many of those sit beside a declared term."},"anchored":{"type":"boolean","description":"Whether the copy that got the coordinates is one of them."},"nearest_term":{"type":["string","null"]},"nearest":{"type":["number","null"],"description":"Gap to the closest declared term in multiples of the ALLOWED window — <= 1 would have passed (the window is anisotropic, 6 wide × 3 tall, so one absolute distance cannot be compared to one threshold)."}},"required":["occurrences","satisfied","anchored"],"description":"Present only when a field that declared `near` was flagged near_mismatch / near_ambiguous — the arithmetic of the verdict, so a reviewer can re-derive it instead of trusting the reason."},"not_near":{"type":"object","properties":{"matched":{"type":"string"},"distance":{"type":"number"}},"required":["matched","distance"],"description":"Present only on near_conflict — the declared term the value sat beside, distance in window multiples."}}},"CellNormalized":{"type":"object","properties":{"value":{"description":"The parsed reading, or null when the printed text would not parse (see error)."},"type":{"type":"string"},"method":{"type":"string"},"error":{"type":"string","description":"Present when value is null — why the printed text would not parse: \"not_numeric\" | \"not_an_integer\" | \"not_a_date\" | \"no_year\" | \"conventional_token\" (a legitimate printed convention such as 一式 — read correctly, just not the declared type) | \"relative_date\"."}},"required":["type"],"description":"Deterministic second reading of the value in the declared scalar type. Present only on /ocr/fields cells whose field declared number / integer / date (or a string carrying pattern / enum)."},"Cell":{"type":"object","properties":{"box":{"type":"object","properties":{"xmin":{"type":"number"},"ymin":{"type":"number"},"xmax":{"type":"number"},"ymax":{"type":"number"}},"required":["xmin","ymin","xmax","ymax"],"description":"Axis-aligned rectangle, normalized to 0–1000 — convert to pixels with data.image (pixel_x = xmin / 1000 × width)."},"quad":{"type":"array","items":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"}},"required":["x","y"]},"description":"Four corners following a tilted scan — always present alongside box, same 0–1000 frame (the page as read; see data.image). No deskew is applied: coordinates stay in the input image's coordinate system."},"verified":{"type":["boolean","null"],"description":"The cell's verdict — a mirror of review (engine v82): false whenever review carries reasons (any kind, declared rules included), true when nothing was flagged and a check actually ran, null when nothing was flagged but there was nothing to check (geometry-only units such as row unions and table containers). The character cross-check itself lives at evidence.text_match."},"review":{"type":["object","null"],"properties":{"reasons":{"type":"array","items":{"type":"string"},"description":"Every rule broken, ordered by rank — index 0 is the primary verdict (always an array, even at length one). Vocabulary: \"type_mismatch\" | \"out_of_range\" | \"pattern_mismatch\" | \"near_mismatch\" | \"near_ambiguous\" | \"near_conflict\" (the first six are rules the caller declared, ranked above engine-inferred reasons) | \"nobox\" | \"text_mismatch\" | \"crop_mismatch\" | \"low_ratio\" | \"weak_source\" | \"low_ocr_confidence\" | \"ambiguous_occurrence\" | \"overwide_box\" | \"missing\". New codes may be added later — fall back to a generic \"needs review\" for unknown ones."}},"required":["reasons"],"description":"null = passed. Anything else = human review recommended; reasons carries the ranked verdicts."},"evidence":{"$ref":"#/components/schemas/CellEvidence"},"normalized":{"$ref":"#/components/schemas/CellNormalized"}},"required":["box","quad","verified","review"],"description":"One entry of the flat, path-keyed coordinate/verification map. Keys share the grammar of review.flagged[].path (items[0].price); a row path like items[0] is the row's union box. Fields that came back without coordinates (nobox) or never came back (missing) have NO cell — they appear only in review.flagged."},"FlaggedEntry":{"type":"object","properties":{"path":{"type":"string","description":"Same grammar as the cells map keys — a direct lookup. Note: missing is raised only for fields declared required; an undeclared field that never comes back raises no flag."},"reasons":{"type":"array","items":{"type":"string"},"description":"Every rule broken, ordered by rank — index 0 is the primary verdict (always an array, even at length one). Vocabulary: \"type_mismatch\" | \"out_of_range\" | \"pattern_mismatch\" | \"near_mismatch\" | \"near_ambiguous\" | \"near_conflict\" (the first six are rules the caller declared, ranked above engine-inferred reasons) | \"nobox\" | \"text_mismatch\" | \"crop_mismatch\" | \"low_ratio\" | \"weak_source\" | \"low_ocr_confidence\" | \"ambiguous_occurrence\" | \"overwide_box\" | \"missing\". New codes may be added later — fall back to a generic \"needs review\" for unknown ones."}},"required":["path","reasons"]},"ReviewNote":{"type":"object","properties":{"path":{"type":"string"},"issue":{"type":"string","description":"What did not run as declared: \"type_coerced\" (unsupported declared type read as string; declared_type / applied_type ride along) | \"label_unresolved\" (a declared label anchored nothing — the value still comes back, so this note is the only trace that the declaration is inert) | \"near_unresolved\" (no declared near term is printed anywhere — the check abstained)."},"description":{"type":"string"}},"required":["path","issue"]},"Review":{"type":"object","properties":{"unit":{"type":"string","description":"\"field\" on /ocr/fields, \"element\" on /ocr/markdown, \"block\" on /ocr/text."},"declared":{"type":"integer","description":"/ocr/fields only — every declared slot, empty and unreturned required included (a fixed denominator)."},"returned":{"type":"integer","description":"/ocr/fields only — non-empty values."},"total":{"type":"integer","description":"/ocr/markdown and /ocr/text — total counted units (each table cell counts on its own)."},"boxed":{"type":"integer","description":"Units that carry a box."},"verified":{"type":"integer","description":"Units with verified: true — nothing flagged and a check actually ran. Flagged units are not counted here; their count is flagged.length."},"flagged":{"type":"array","items":{"$ref":"#/components/schemas/FlaggedEntry"},"description":"The review list — the review count IS its length (no separate counter)."},"by_reason":{"type":"object","additionalProperties":{"type":"integer"},"description":"Per-reason tally. One cell can break a declared rule AND carry an engine suspicion, so every entry in reasons is counted — the total is therefore at least flagged.length."},"coverage":{"type":"object","properties":{"recovered_blocks":{"type":"number"},"vision_tokens":{"type":"number"},"tokens_claimed":{"type":"number"},"token_coverage":{"type":"number"}},"description":"How much of the page came back (document endpoints; LLM path only on /ocr/text)."},"notes":{"type":"array","items":{"$ref":"#/components/schemas/ReviewNote"},"description":"Present only when a declaration did not run as written — branch on issue."}},"required":["unit","boxed","verified","flagged","by_reason"]},"ImageInfo":{"type":"object","properties":{"width":{"type":"integer"},"height":{"type":"integer"}},"required":["width","height"],"description":"The size in pixels of the page as read — the frame every coordinate lives in (pixel_x = xmin / 1000 × width). Measured after the page is turned upright (EXIF) and after any downscale, so it can differ from the file you sent: a sideways 4000×3000 photo can come back 3000×4000."},"MarkdownElement":{"type":"object","properties":{"type":{"type":"string","description":"\"heading\" | \"paragraph\" | \"list_item\" | \"blockquote\" | \"code_block\" | \"thematic_break\" | \"table\"."},"text":{"type":"string","description":"The element's text (all kinds except table)."},"level":{"type":"integer","description":"Heading level (heading only)."},"rows":{"type":"integer","description":"Row count (table only)."},"cols":{"type":"integer","description":"Column count (table only)."},"cells":{"type":"array","items":{"type":"object","properties":{"row":{"type":"integer"},"col":{"type":"integer"},"header":{"type":"boolean"},"text":{"type":"string"}},"required":["row","col","text"]},"description":"The table's cells (table only)."}},"required":["type"]},"OcrFieldsResponse":{"type":"object","properties":{"status":{"type":"string","description":"Always \"success\" here — errors come back as HTTP 4xx/5xx with the common error envelope instead.","example":"success"},"data":{"type":"object","properties":{"values":{"type":"object","additionalProperties":{},"description":"Pure user data, exactly your declared schema — the model's reading of the page, held to the printed text by the character cross-check (not a byte-for-byte copy; for exact string matching use cells[path].evidence.printed_text)."},"normalized":{"type":"object","additionalProperties":{},"description":"Present only when some field declared a scalar type (number / integer / date, or a string carrying pattern / enum): a sparse tree shaped exactly like values, with the leaves parsed into the declared type. A leaf that would not parse is null — the reason is at cells[path].normalized.error. values itself is left alone; it is the side carrying the coordinates and the verification."},"cells":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/Cell"},"description":"Flat, path-keyed coordinate/verification map — keys share review.flagged[].path grammar."},"review":{"$ref":"#/components/schemas/Review"},"image":{"$ref":"#/components/schemas/ImageInfo"}},"required":["values","cells","review","image"]},"message":{"type":"string"}},"required":["status","data"]},"OcrMarkdownResponse":{"type":"object","properties":{"status":{"type":"string","example":"success"},"data":{"type":"object","properties":{"values":{"type":"object","properties":{"markdown":{"type":"string","description":"The assembled Markdown string."},"elements":{"type":"array","items":{"$ref":"#/components/schemas/MarkdownElement"},"description":"Content-only elements (default; omitted when includeElements: false) — coordinates and verification flags live in cells. OCR tokens no element claimed are recovered as a trailing paragraph (evidence.source: unclaimed_tokens)."}},"required":["markdown"]},"cells":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/Cell"},"description":"Path-keyed map — elements[3] is an element, elements[2].cells[1] a table cell. Omitted when includeElements: false."},"review":{"$ref":"#/components/schemas/Review"},"image":{"$ref":"#/components/schemas/ImageInfo"}},"required":["values","review","image"]},"message":{"type":"string"}},"required":["status","data"]},"OcrTextResponse":{"type":"object","properties":{"status":{"type":"string","example":"success"},"data":{"type":"object","properties":{"values":{"type":"object","properties":{"text":{"type":"string","description":"The full text — blocks joined in reading order."},"blocks":{"type":"array","items":{"type":"object","properties":{"text":{"type":"string"}},"required":["text"]},"description":"Content-only blocks (when includeBlocks: true) — coordinates and verification flags live in cells."}},"required":["text"]},"cells":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/Cell"},"description":"Path-keyed map (blocks[7]). Present when includeBlocks: true."},"review":{"$ref":"#/components/schemas/Review"},"image":{"$ref":"#/components/schemas/ImageInfo"},"source":{"type":"string","description":"\"llm\" (reading-order pass) | \"vision\" (automatic fallback when the LLM pass fails)."}},"required":["values","review","image"]},"message":{"type":"string"}},"required":["status","data"]},"UploadForm":{"type":"object","properties":{"path":{"type":"string","pattern":"^\\/(?:[^./#$\\[\\]/]+(?:\\/[^./#$\\[\\]/]+)*)?\\/?$","description":"Target sheet or doc bundle path.","example":"/invoices/2024/march"},"files":{"type":"array","items":{"type":"string","format":"binary"},"description":"Image file(s). Repeat the field for multiple. Max 20 files, 20MB each."},"wait":{"type":"boolean","description":"Sync mode — wait up to 30s per image and return `results` instead of `jobs`. Anything slower comes back as status:\"pending\"; poll GET /jobs/{jobId}."}},"required":["path","files"]},"UploadDirectForm":{"type":"object","properties":{"files":{"type":"array","items":{"type":"string","format":"binary"}}},"required":["files"]}},"parameters":{}},"paths":{"/health":{"get":{"summary":"Service health","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"version":{"type":"string"},"time":{"type":"number"},"engine":{"type":["object","null"],"properties":{"version":{"type":["string","null"]},"build":{"type":["object","null"],"properties":{"sha":{"type":["string","null"]},"deployed_at":{"type":["string","null"]}},"required":["sha","deployed_at"]},"changelog":{"type":["array","null"],"items":{"type":"object","properties":{"version":{"type":"string"},"date":{"type":"string"},"changes":{"type":"array","items":{"type":"string"}}},"required":["version","date","changes"]}}},"required":["version","build","changelog"]}},"required":["status","version","time","engine"]}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"402":{"description":"Payment Required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"413":{"description":"Payload Too Large","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"429":{"description":"Too Many Requests","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"500":{"description":"Internal Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"502":{"description":"OCR engine error (charge auto-refunded)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"504":{"description":"OCR engine timeout (charge auto-refunded)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}}}}},"/amount":{"get":{"summary":"Account balance and quota","security":[{"BearerAuth":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"402":{"description":"Payment Required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"413":{"description":"Payload Too Large","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"429":{"description":"Too Many Requests","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"500":{"description":"Internal Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"502":{"description":"OCR engine error (charge auto-refunded)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"504":{"description":"OCR engine timeout (charge auto-refunded)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}}}}},"/ocr/fields":{"post":{"summary":"Structured OCR (fields)","security":[{"BearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"image":{"type":"string","minLength":1,"description":"base64 or URL of the image. The JSON body caps at 28MB; base64 inflates a file by ≈1.33×, so that is roughly a 20MB original image. Over the cap returns 413 with details.limitBytes / details.receivedBytes."},"imageType":{"type":"string","enum":["base64","url"],"description":"Type of `image` — \"base64\" or \"url\". Required (also accepted via the deprecated alias `image_type`).","example":"url"},"image_type":{"type":"string","enum":["base64","url"],"description":"Deprecated alias of `imageType`.","example":"url","deprecated":true},"fields":{"type":"array","items":{"$ref":"#/components/schemas/FieldSpec"}},"prompt":{"type":"string"},"autoFields":{"type":"boolean","description":"When true, the LLM proposes a schema if fields is not provided."},"auto_fields":{"type":"boolean","description":"Deprecated alias of `autoFields`.","deprecated":true}},"required":["image"],"description":"OCR fields request"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OcrFieldsResponse"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"402":{"description":"Payment Required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"413":{"description":"Payload Too Large","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"429":{"description":"Too Many Requests","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"500":{"description":"Internal Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"502":{"description":"OCR engine error (charge auto-refunded)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"504":{"description":"OCR engine timeout (charge auto-refunded)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}}}}},"/ocr/markdown":{"post":{"summary":"Layout-preserving Markdown conversion","security":[{"BearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"image":{"type":"string","minLength":1,"description":"base64 or URL of the image. The JSON body caps at 28MB; base64 inflates a file by ≈1.33×, so that is roughly a 20MB original image. Over the cap returns 413 with details.limitBytes / details.receivedBytes."},"imageType":{"type":"string","enum":["base64","url"],"description":"Type of `image` — \"base64\" or \"url\". Required (also accepted via the deprecated alias `image_type`).","example":"url"},"image_type":{"type":"string","enum":["base64","url"],"description":"Deprecated alias of `imageType`.","example":"url","deprecated":true},"prompt":{"type":"string","description":"Optional extra instruction for the layout pass (e.g. keep table borders)."},"languageHints":{"type":"array","items":{"type":"string"},"description":"BCP-47-ish OCR language hints, e.g. [\"ja\",\"en\"]. Defaults to ja/ko/en."},"language_hints":{"type":"array","items":{"type":"string"},"description":"Deprecated alias of `languageHints`.","deprecated":true},"includeElements":{"type":"boolean","description":"Default true — the response carries the per-element list with boxes and text_verified. Set false for the assembled Markdown string only."},"include_elements":{"type":"boolean","description":"Deprecated alias of `includeElements`.","deprecated":true}},"required":["image"],"description":"Layout-preserving Markdown conversion request"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OcrMarkdownResponse"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"402":{"description":"Payment Required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"413":{"description":"Payload Too Large","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"429":{"description":"Too Many Requests","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"500":{"description":"Internal Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"502":{"description":"OCR engine error (charge auto-refunded)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"504":{"description":"OCR engine timeout (charge auto-refunded)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}}}}},"/ocr/text":{"post":{"summary":"Plain text extraction (reading-order text + optional block boxes)","security":[{"BearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"image":{"type":"string","minLength":1,"description":"base64 or URL of the image. The JSON body caps at 28MB; base64 inflates a file by ≈1.33×, so that is roughly a 20MB original image. Over the cap returns 413 with details.limitBytes / details.receivedBytes."},"imageType":{"type":"string","enum":["base64","url"],"description":"Type of `image` — \"base64\" or \"url\". Required (also accepted via the deprecated alias `image_type`).","example":"url"},"image_type":{"type":"string","enum":["base64","url"],"description":"Deprecated alias of `imageType`.","example":"url","deprecated":true},"languageHints":{"type":"array","items":{"type":"string"},"description":"BCP-47-ish OCR language hints, e.g. [\"ja\",\"en\"]. Defaults to ja/ko/en."},"language_hints":{"type":"array","items":{"type":"string"},"description":"Deprecated alias of `languageHints`.","deprecated":true},"useLlm":{"type":"boolean","description":"Default true — the model reads the image and puts the blocks in true reading order, rejoining wrapped lines. Set false for a raw OCR-order transcription."},"use_llm":{"type":"boolean","description":"Deprecated alias of `useLlm`.","deprecated":true},"includeBlocks":{"type":"boolean","description":"When true the response also carries `blocks` — per-block text with bbox/vertices and a text_verified flag."},"include_blocks":{"type":"boolean","description":"Deprecated alias of `includeBlocks`.","deprecated":true},"prompt":{"type":"string","description":"Custom transcription prompt prefix (optional)."}},"required":["image"],"description":"Plain text (reading-order text + optional per-block boxes) request"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OcrTextResponse"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"402":{"description":"Payment Required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"413":{"description":"Payload Too Large","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"429":{"description":"Too Many Requests","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"500":{"description":"Internal Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"502":{"description":"OCR engine error (charge auto-refunded)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"504":{"description":"OCR engine timeout (charge auto-refunded)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}}}}},"/space":{"get":{"summary":"List MySpace tree","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","pattern":"^\\/(?:[^./#$\\[\\]/]+(?:\\/[^./#$\\[\\]/]+)*)?\\/?$","default":"/","description":"Slash-separated path. Folders are addressed by name. Sheets can be addressed by name (must be unique within the parent folder) or by the uniqueKey returned by /create.","example":"/invoices/2024/march"},"required":false,"name":"path","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":10,"default":1},"required":false,"name":"depth","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"402":{"description":"Payment Required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"413":{"description":"Payload Too Large","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"429":{"description":"Too Many Requests","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"500":{"description":"Internal Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"502":{"description":"OCR engine error (charge auto-refunded)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"504":{"description":"OCR engine timeout (charge auto-refunded)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}}}}},"/create":{"post":{"summary":"Create folder, sheet, doc bundle, or memo","security":[{"BearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"path":{"type":"string","pattern":"^\\/(?:[^./#$\\[\\]/]+(?:\\/[^./#$\\[\\]/]+)*)?\\/?$","description":"parent folder path","example":"/invoices/2024/march"},"type":{"type":"string","enum":["folder","sheet","memo","doc"]},"name":{"type":"string","minLength":1},"text":{"type":"string"},"columns":{"type":"array","items":{"$ref":"#/components/schemas/ColumnSpec"}},"prompt":{"type":"string"},"mode":{"type":"string","enum":["markdown","text"],"description":"Doc bundles only. \"markdown\" (default) converts each page to layout-preserving Markdown; \"text\" keeps the raw text."}},"required":["path","type","name"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"402":{"description":"Payment Required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"413":{"description":"Payload Too Large","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"429":{"description":"Too Many Requests","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"500":{"description":"Internal Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"502":{"description":"OCR engine error (charge auto-refunded)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"504":{"description":"OCR engine timeout (charge auto-refunded)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}}}}},"/upload":{"post":{"summary":"Upload one or more images (multipart). Async by default.","security":[{"BearerAuth":[]}],"requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/UploadForm"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"402":{"description":"Payment Required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"413":{"description":"Payload Too Large","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"429":{"description":"Too Many Requests","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"500":{"description":"Internal Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"502":{"description":"OCR engine error (charge auto-refunded)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"504":{"description":"OCR engine timeout (charge auto-refunded)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}}}}},"/upload/ticket":{"post":{"summary":"Mint a short-lived upload link for a sheet or doc bundle. The bytes are then sent straight to /upload/direct — by an agent with a shell, or by a person on the returned pageUrl — so an LLM never has to carry them.","security":[{"BearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"path":{"type":"string","pattern":"^\\/(?:[^./#$\\[\\]/]+(?:\\/[^./#$\\[\\]/]+)*)?\\/?$","description":"Target sheet or doc bundle path.","example":"/invoices/2024/march"},"ttlSec":{"type":"integer","minimum":300,"maximum":86400,"description":"Link lifetime in seconds. Default 7200 (2h), max 86400 (24h)."},"maxFiles":{"type":"integer","minimum":1,"maximum":200,"description":"Total files the link may accept before it stops. Default 50."}},"required":["path"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"402":{"description":"Payment Required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"413":{"description":"Payload Too Large","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"429":{"description":"Too Many Requests","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"500":{"description":"Internal Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"502":{"description":"OCR engine error (charge auto-refunded)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"504":{"description":"OCR engine timeout (charge auto-refunded)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}}}}},"/upload/direct":{"post":{"summary":"Upload into a ticket's target (multipart). Authenticated by ?t=, not by an API key.","parameters":[{"schema":{"type":"string","minLength":20,"description":"Upload ticket from POST /upload/ticket."},"required":true,"name":"t","in":"query"},{"schema":{"type":"string","description":"PUT only — the filename, which becomes the row's name. Synthesized when omitted."},"required":false,"name":"name","in":"query"},{"schema":{"type":"string","description":"PUT only — MIME override. Sniffed from the bytes when omitted."},"required":false,"name":"type","in":"query"},{"schema":{"type":"string","enum":["0","1","true","false"],"description":"Wait for the OCR result (up to 30s per image) instead of returning jobs."},"required":false,"name":"wait","in":"query"}],"requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/UploadDirectForm"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"402":{"description":"Payment Required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"413":{"description":"Payload Too Large","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"429":{"description":"Too Many Requests","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"500":{"description":"Internal Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"502":{"description":"OCR engine error (charge auto-refunded)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"504":{"description":"OCR engine timeout (charge auto-refunded)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}}}},"put":{"summary":"Upload one file as a raw body, so `curl -T photo.jpg \"<uploadUrl>\"` works with no extra flags. Authenticated by ?t=, not by an API key.","parameters":[{"schema":{"type":"string","minLength":20,"description":"Upload ticket from POST /upload/ticket."},"required":true,"name":"t","in":"query"},{"schema":{"type":"string","description":"PUT only — the filename, which becomes the row's name. Synthesized when omitted."},"required":false,"name":"name","in":"query"},{"schema":{"type":"string","description":"PUT only — MIME override. Sniffed from the bytes when omitted."},"required":false,"name":"type","in":"query"},{"schema":{"type":"string","enum":["0","1","true","false"],"description":"Wait for the OCR result (up to 30s per image) instead of returning jobs."},"required":false,"name":"wait","in":"query"}],"requestBody":{"content":{"image/jpeg":{"schema":{"type":"string","format":"binary"}},"image/png":{"schema":{"type":"string","format":"binary"}},"image/webp":{"schema":{"type":"string","format":"binary"}},"image/tiff":{"schema":{"type":"string","format":"binary"}},"image/heic":{"schema":{"type":"string","format":"binary"}},"image/bmp":{"schema":{"type":"string","format":"binary"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"402":{"description":"Payment Required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"413":{"description":"Payload Too Large","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"429":{"description":"Too Many Requests","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"500":{"description":"Internal Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"502":{"description":"OCR engine error (charge auto-refunded)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"504":{"description":"OCR engine timeout (charge auto-refunded)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}}}}},"/remove":{"post":{"summary":"Remove folder, sheet, doc bundle, memo, or image (cascade), or one sheet row with `row`","security":[{"BearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"path":{"type":"string","pattern":"^\\/(?:[^./#$\\[\\]/]+(?:\\/[^./#$\\[\\]/]+)*)?\\/?$","description":"Slash-separated path. Folders are addressed by name. Sheets can be addressed by name (must be unique within the parent folder) or by the uniqueKey returned by /create.","example":"/invoices/2024/march"},"row":{"anyOf":[{"type":"integer"},{"type":"string","minLength":1}],"description":"[Sheets only] Delete one row instead of the sheet. rowKey, 0-based index, or a negative index from the end — the same addressing POST /edit uses. Removes the image and its OCR result. The scan was already performed and billed, so nothing is refunded."}},"required":["path"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"402":{"description":"Payment Required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"413":{"description":"Payload Too Large","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"429":{"description":"Too Many Requests","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"500":{"description":"Internal Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"502":{"description":"OCR engine error (charge auto-refunded)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"504":{"description":"OCR engine timeout (charge auto-refunded)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}}}}},"/view":{"get":{"summary":"View the contents of any item (folder, sheet, doc bundle, memo, image). The query parameters (where/sort/select/limit/offset/boxes) are sheet-only and are ignored on every other kind.","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","pattern":"^\\/(?:[^./#$\\[\\]/]+(?:\\/[^./#$\\[\\]/]+)*)?\\/?$","description":"Slash-separated path. Folders are addressed by name. Sheets can be addressed by name (must be unique within the parent folder) or by the uniqueKey returned by /create.","example":"/invoices/2024/march"},"required":true,"name":"path","in":"query"},{"schema":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}],"description":"[Sheets only] Row filter, e.g. `total>=40000` or `vendor~サクラ`. Repeatable; clauses are AND-ed. Operators: = != > >= < <= ~ (contains). Matches sheet columns plus name/ocrStatus. Ignored for folders, memos, images, and doc bundles."},"required":false,"name":"where","in":"query"},{"schema":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}],"description":"[Sheets only] Sort spec, e.g. `total:desc` or `-invoice_date`. Repeatable for tie-breaks."},"required":false,"name":"sort","in":"query"},{"schema":{"type":"string","description":"[Sheets only] Comma-separated column names to return (projection), e.g. `vendor,total`. Filters both `values` keys and `cells` paths (by their first segment)."},"required":false,"name":"select","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":500,"description":"[Sheets only] Max rows to return (1–500). Does not paginate doc bundle pages."},"required":false,"name":"limit","in":"query"},{"schema":{"type":["integer","null"],"minimum":0,"description":"[Sheets only] Rows to skip for pagination (pair with `limit`; see `nextOffset` in the response)."},"required":false,"name":"offset","in":"query"},{"schema":{"type":"string","enum":["0","1","true","false"],"description":"[Sheets only] Set `0`/`false` to drop the per-row `cells` map (boxes/quads) for a lean payload. `values`/`review` are kept. Doc bundle page cells are always returned."},"required":false,"name":"boxes","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"402":{"description":"Payment Required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"413":{"description":"Payload Too Large","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"429":{"description":"Too Many Requests","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"500":{"description":"Internal Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"502":{"description":"OCR engine error (charge auto-refunded)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"504":{"description":"OCR engine timeout (charge auto-refunded)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}}}}},"/edit":{"post":{"summary":"Edit a sheet row/column or memo text. Sheets and memos only — doc bundles (.md/.txt) are rejected.","security":[{"BearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"path":{"type":"string","pattern":"^\\/(?:[^./#$\\[\\]/]+(?:\\/[^./#$\\[\\]/]+)*)?\\/?$","description":"Slash-separated path. Folders are addressed by name. Sheets can be addressed by name (must be unique within the parent folder) or by the uniqueKey returned by /create.","example":"/invoices/2024/march"},"row":{"anyOf":[{"type":"integer"},{"type":"string","minLength":1}]},"column":{"anyOf":[{"type":"integer"},{"type":"string","minLength":1}],"description":"Column index or name. `\"values.<column>\"` (the v2 row shape) is accepted as an alias. `cells`/`review`/`image` are response metadata, not editable columns."},"value":{}},"required":["path","row","column"]},{"type":"object","properties":{"path":{"type":"string","pattern":"^\\/(?:[^./#$\\[\\]/]+(?:\\/[^./#$\\[\\]/]+)*)?\\/?$","description":"Slash-separated path. Folders are addressed by name. Sheets can be addressed by name (must be unique within the parent folder) or by the uniqueKey returned by /create.","example":"/invoices/2024/march"},"text":{"type":"string"}},"required":["path","text"]}]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"402":{"description":"Payment Required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"413":{"description":"Payload Too Large","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"429":{"description":"Too Many Requests","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"500":{"description":"Internal Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"502":{"description":"OCR engine error (charge auto-refunded)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"504":{"description":"OCR engine timeout (charge auto-refunded)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}}}}},"/jobs":{"get":{"summary":"Poll several OCR jobs at once. For a whole sheet, GET /view?where=ocrStatus!=done&limit=1 answers \"is the batch done\" in one call without tracking ids.","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}],"description":"Comma-separated or repeated jobIds. Max 50. Ids that cannot be read come back as status \"unknown\" rather than failing the whole batch."},"required":false,"name":"ids","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"402":{"description":"Payment Required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"413":{"description":"Payload Too Large","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"429":{"description":"Too Many Requests","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"500":{"description":"Internal Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"502":{"description":"OCR engine error (charge auto-refunded)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"504":{"description":"OCR engine timeout (charge auto-refunded)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}}}}},"/jobs/{jobId}":{"get":{"summary":"Poll OCR job status","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"From the POST /upload response (jobs[].jobId).","example":"job_abc123"},"required":true,"name":"jobId","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"402":{"description":"Payment Required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"413":{"description":"Payload Too Large","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"429":{"description":"Too Many Requests","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"500":{"description":"Internal Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"502":{"description":"OCR engine error (charge auto-refunded)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"504":{"description":"OCR engine timeout (charge auto-refunded)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}}}}},"/webhook":{"get":{"summary":"Get current webhook configuration","security":[{"BearerAuth":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"402":{"description":"Payment Required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"413":{"description":"Payload Too Large","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"429":{"description":"Too Many Requests","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"500":{"description":"Internal Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"502":{"description":"OCR engine error (charge auto-refunded)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"504":{"description":"OCR engine timeout (charge auto-refunded)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}}}},"put":{"summary":"Create or update space-wide webhook","security":[{"BearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"active":{"type":"boolean","default":true},"rotateSecret":{"type":"boolean"}},"required":["url"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"402":{"description":"Payment Required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"413":{"description":"Payload Too Large","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"429":{"description":"Too Many Requests","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"500":{"description":"Internal Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"502":{"description":"OCR engine error (charge auto-refunded)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"504":{"description":"OCR engine timeout (charge auto-refunded)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}}}},"delete":{"summary":"Remove webhook configuration","security":[{"BearerAuth":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"402":{"description":"Payment Required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"413":{"description":"Payload Too Large","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"429":{"description":"Too Many Requests","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"500":{"description":"Internal Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"502":{"description":"OCR engine error (charge auto-refunded)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"504":{"description":"OCR engine timeout (charge auto-refunded)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}}}}},"/webhook/test":{"post":{"summary":"Send a webhook.test event to the configured URL","security":[{"BearerAuth":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"402":{"description":"Payment Required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"413":{"description":"Payload Too Large","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"429":{"description":"Too Many Requests","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"500":{"description":"Internal Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"502":{"description":"OCR engine error (charge auto-refunded)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"504":{"description":"OCR engine timeout (charge auto-refunded)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}}}}},"/webhooks/deliveries":{"get":{"summary":"List recent webhook deliveries","security":[{"BearerAuth":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"402":{"description":"Payment Required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"413":{"description":"Payload Too Large","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"429":{"description":"Too Many Requests","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"500":{"description":"Internal Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"502":{"description":"OCR engine error (charge auto-refunded)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"504":{"description":"OCR engine timeout (charge auto-refunded)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}}}}},"/webhooks/deliveries/{deliveryId}":{"get":{"summary":"Get delivery detail (full payload + attempts)","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"From GET /webhooks/deliveries (items[].deliveryId).","example":"dlv_abc123"},"required":true,"name":"deliveryId","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"402":{"description":"Payment Required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"413":{"description":"Payload Too Large","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"429":{"description":"Too Many Requests","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"500":{"description":"Internal Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"502":{"description":"OCR engine error (charge auto-refunded)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"504":{"description":"OCR engine timeout (charge auto-refunded)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}}}}},"/webhooks/deliveries/{deliveryId}/redeliver":{"post":{"summary":"Manually redeliver a failed webhook (reuses the same deliveryId)","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"From GET /webhooks/deliveries (items[].deliveryId).","example":"dlv_abc123"},"required":true,"name":"deliveryId","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"402":{"description":"Payment Required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"413":{"description":"Payload Too Large","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"429":{"description":"Too Many Requests","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"500":{"description":"Internal Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"502":{"description":"OCR engine error (charge auto-refunded)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}},"504":{"description":"OCR engine timeout (charge auto-refunded)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]},"details":{}},"required":["error"]}}}}}}}},"webhooks":{}}