{"openapi":"3.1.0","info":{"title":"Lookdocu API","version":"1","description":"Lookdocu public API, organized by module (token scopes: extract, check, sign). Docs: /docs/api."},"servers":[{"url":"/api/v1"}],"security":[{"bearer":[]},{"apiKey":[]}],"tags":[{"name":"General"},{"name":"Extract Data","description":"scope extract"},{"name":"Direct Extract","description":"scope extract; paths and JSON of the former Document AI service (e-invoice), errors as problem+json"},{"name":"Parse (LLM-ready)","description":"scope extract; PDF or scans to blocks in reading order with page boxes, Markdown and chunks"},{"name":"Review Document","description":"scope check"},{"name":"Signatures","description":"scope sign"}],"paths":{"/usage":{"get":{"tags":["General"],"summary":"Monthly usage per module and remaining credits","parameters":[{"name":"month","in":"query","schema":{"type":"string","pattern":"^\\d{4}-\\d{2}$"},"description":"YYYY-MM (default: this month, Jakarta time)"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Usage"}}}},"401":{"$ref":"#/components/responses/E401"},"429":{"$ref":"#/components/responses/E429"}}}},"/templates":{"get":{"tags":["Extract Data"],"summary":"Built-in and account templates","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Template"}}}}}}},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"429":{"$ref":"#/components/responses/E429"}}}},"/extractions":{"post":{"tags":["Extract Data"],"summary":"Submit one document to be read in the background","requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"template":{"type":"string","description":"Template id (GET /templates)"},"file":{"type":"array","items":{"type":"string","format":"binary"},"description":"One PDF, or 1-5 JPG/PNG images"},"name":{"type":"string"},"keep_days":{"type":"integer","enum":[1,7,30],"description":"Retention of the original files (days)"}},"required":["template","file"]}}}},"responses":{"202":{"description":"Accepted, queued for reading","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Extraction"}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"402":{"$ref":"#/components/responses/E402"},"403":{"$ref":"#/components/responses/E403"},"413":{"$ref":"#/components/responses/E413"},"429":{"$ref":"#/components/responses/E429"}}}},"/extractions/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"get":{"tags":["Extract Data"],"summary":"Extraction result","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Extraction"}}}},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"429":{"$ref":"#/components/responses/E429"}}},"delete":{"tags":["Extract Data"],"summary":"Delete extraction","responses":{"200":{"description":"Deleted","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"const":"extraction"},"deleted":{"const":true}}}}}},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"429":{"$ref":"#/components/responses/E429"}}}},"/classify":{"post":{"tags":["Extract Data"],"summary":"Classify a document (type, calibrated score, template), optionally splitting a combined PDF","description":"Synchronous. Under the confidence threshold the type is \"needs_review\" and alternatives[0] holds the best guess. Credits: 1 per document classified; with split=true, 1 per segment found (the account needs 1 per page available beforehand, as each page may be a document).","requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"array","items":{"type":"string","format":"binary"},"description":"One PDF (split: max 30 pages), or 1-5 JPG/PNG images of one document"},"split":{"type":"boolean","description":"Find the documents a combined PDF holds (segments)"},"categories":{"type":"string","description":"JSON array of up to 20 extra types: [{\"id\", \"name\", \"description\"}]"}},"required":["file"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Classification"}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"402":{"$ref":"#/components/responses/E402"},"403":{"$ref":"#/components/responses/E403"},"413":{"$ref":"#/components/responses/E413"},"422":{"$ref":"#/components/responses/E422"},"429":{"$ref":"#/components/responses/E429"},"502":{"$ref":"#/components/responses/E502"},"503":{"$ref":"#/components/responses/E503"},"504":{"$ref":"#/components/responses/E504"}}}},"/extract":{"post":{"tags":["Direct Extract"],"summary":"Read one document (synchronous); 1 credit per page image","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["images","fields"],"properties":{"images":{"type":"array","minItems":1,"maxItems":30,"items":{"type":"string"},"description":"Page images in order: URL from POST /images, an http(s) URL, or a data URI (JPEG/PNG/WebP, max 16 MB)"},"fields":{"type":"array","minItems":1,"maxItems":100,"items":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"description":{"type":"string"}}}},"context":{"type":"string","maxLength":4000},"language":{"type":"string","description":"Summary language, e.g. id, en (default id)"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractResult"}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"402":{"$ref":"#/components/responses/E402"},"403":{"$ref":"#/components/responses/E403"},"413":{"$ref":"#/components/responses/E413"},"422":{"$ref":"#/components/responses/E422"},"429":{"$ref":"#/components/responses/E429"},"502":{"$ref":"#/components/responses/E502"},"503":{"$ref":"#/components/responses/E503"},"504":{"$ref":"#/components/responses/E504"}}}},"/extract/bulk":{"post":{"tags":["Direct Extract"],"summary":"Read up to 50 documents; status per document","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["documents"],"properties":{"documents":{"type":"array","minItems":1,"maxItems":50,"items":{"allOf":[{"type":"object","required":["images","fields"],"properties":{"images":{"type":"array","minItems":1,"maxItems":30,"items":{"type":"string"},"description":"Page images in order: URL from POST /images, an http(s) URL, or a data URI (JPEG/PNG/WebP, max 16 MB)"},"fields":{"type":"array","minItems":1,"maxItems":100,"items":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"description":{"type":"string"}}}},"context":{"type":"string","maxLength":4000},"language":{"type":"string","description":"Summary language, e.g. id, en (default id)"}}},{"type":"object","properties":{"id":{"type":"string","maxLength":200}}}]}},"language":{"type":"string"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"results":{"type":"array","items":{"type":"object","required":["index","status"],"properties":{"index":{"type":"integer"},"id":{"type":"string"},"status":{"enum":["ok","error"]},"result":{"$ref":"#/components/schemas/ExtractResult"},"error":{"type":"object","properties":{"kind":{"enum":["upstream","timeout","rate_limited","bad_output","internal"]},"message":{"type":"string"},"retryable":{"type":"boolean"}}}}}},"stats":{"type":"object","properties":{"total":{"type":"integer"},"succeeded":{"type":"integer"},"failed":{"type":"integer"}}},"durationMs":{"type":"integer"}}}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"402":{"$ref":"#/components/responses/E402"},"403":{"$ref":"#/components/responses/E403"},"413":{"$ref":"#/components/responses/E413"},"429":{"$ref":"#/components/responses/E429"},"503":{"$ref":"#/components/responses/E503"}}}},"/chat":{"post":{"tags":["Direct Extract"],"summary":"Ask about extraction results sent by the caller; 1 credit","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string","maxLength":4000},"context":{"description":"One document, or isBulk: true with documents","allOf":[{"type":"object","properties":{"fileName":{"type":"string"},"documentType":{"type":"array","items":{"type":"string"}},"summary":{"type":"string"},"essentialInformation":{"type":"string"},"parsed":{"type":"object","additionalProperties":true}}},{"type":"object","properties":{"isBulk":{"type":"boolean"},"documents":{"type":"array","maxItems":200,"items":{"type":"object","properties":{"fileName":{"type":"string"},"documentType":{"type":"array","items":{"type":"string"}},"summary":{"type":"string"},"essentialInformation":{"type":"string"},"parsed":{"type":"object","additionalProperties":true}}}}}}]},"stream":{"type":"boolean","description":"true: Server-Sent Events data: {\"delta\"} … data: [DONE]"}}}}}},"responses":{"200":{"description":"Answer (JSON), or an SSE stream when stream: true","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}},"text/event-stream":{"schema":{"type":"string"}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"402":{"$ref":"#/components/responses/E402"},"403":{"$ref":"#/components/responses/E403"},"413":{"$ref":"#/components/responses/E413"},"422":{"$ref":"#/components/responses/E422"},"429":{"$ref":"#/components/responses/E429"},"502":{"$ref":"#/components/responses/E502"},"503":{"$ref":"#/components/responses/E503"},"504":{"$ref":"#/components/responses/E504"}}}},"/images":{"post":{"tags":["Direct Extract"],"summary":"Upload a page image (kept 24 hours); use its url in images","requestBody":{"required":true,"content":{"image/jpeg":{"schema":{"type":"string","format":"binary"}},"image/png":{"schema":{"type":"string","format":"binary"}},"image/webp":{"schema":{"type":"string","format":"binary"}}}},"responses":{"201":{"description":"Stored","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"url":{"type":"string","format":"uri"}}}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"413":{"$ref":"#/components/responses/E413"},"415":{"$ref":"#/components/responses/E415"},"429":{"$ref":"#/components/responses/E429"}}}},"/images/{id}":{"get":{"tags":["Direct Extract"],"summary":"An uploaded image (no token; its id is the key)","security":[],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","pattern":"^[0-9a-f]{64}$"}}],"responses":{"200":{"description":"Image","content":{"image/*":{"schema":{"type":"string","format":"binary"}}}},"404":{"$ref":"#/components/responses/E404"}}}},"/parse":{"post":{"tags":["Parse (LLM-ready)"],"summary":"Parse a PDF or page images into blocks, Markdown and chunks (in the background)","description":"One PDF (max 50 pages; text or scanned) or 1-10 JPG/PNG page images in page order. Answered 202 with the job; poll GET /parse/{id} or listen for parse.done / parse.failed. Credits: 1 per page where the AI model checked a table whose structure the geometry was unsure of; text-layer and OCR pages are free. Without credits (or AI) the job still runs and such tables are flagged in warnings. Results are kept 3 days.","requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"array","items":{"type":"string","format":"binary"},"description":"One PDF, or 1-10 JPG/PNG page images (max 8000 px per side)"},"chunk_size":{"type":"integer","minimum":100,"maximum":4000,"default":500,"description":"Approximate tokens per chunk"},"split":{"type":"boolean","description":"Also tell the documents in a combined file apart (result.documents); 1 credit per document found"},"name":{"type":"string"}},"required":["file"]}}}},"responses":{"202":{"description":"Accepted, queued","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Parse"}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"413":{"$ref":"#/components/responses/E413"},"415":{"$ref":"#/components/responses/E415"},"429":{"$ref":"#/components/responses/E429"}}}},"/parse/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"get":{"tags":["Parse (LLM-ready)"],"summary":"Parse job and, when done, its result","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Parse"}}}},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"429":{"$ref":"#/components/responses/E429"}}},"delete":{"tags":["Parse (LLM-ready)"],"summary":"Delete the job and its result now","responses":{"200":{"description":"Deleted","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"const":"parse"},"deleted":{"const":true}}}}}},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"429":{"$ref":"#/components/responses/E429"}}}},"/checks":{"post":{"tags":["Review Document"],"summary":"Review a document: automatic findings and AI analysis","requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"array","items":{"type":"string","format":"binary"},"description":"1-10 PDFs (one document)"},"name":{"type":"string"},"ai":{"type":"string","enum":["true","false"],"description":"false: rule checks only, no credits"}},"required":["file"]}}}},"responses":{"202":{"description":"Accepted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Check"}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"402":{"$ref":"#/components/responses/E402"},"403":{"$ref":"#/components/responses/E403"},"413":{"$ref":"#/components/responses/E413"},"429":{"$ref":"#/components/responses/E429"}}}},"/checks/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"get":{"tags":["Review Document"],"summary":"Review result","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Check"}}}},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"429":{"$ref":"#/components/responses/E429"}}},"delete":{"tags":["Review Document"],"summary":"Delete","responses":{"200":{"description":"Deleted","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"const":"check"},"deleted":{"const":true}}}}}},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"429":{"$ref":"#/components/responses/E429"}}}},"/checks/{id}/ask":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"post":{"tags":["Review Document"],"summary":"Ask the document; 1 credit","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["question"],"properties":{"question":{"type":"string","maxLength":500},"history":{"type":"array","items":{"type":"object","properties":{"role":{"enum":["user","assistant"]},"content":{"type":"string"}}}}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"answer":{"type":"string"},"citations":{"type":"array","items":{"type":"object","properties":{"quote":{"type":["string","null"]},"file":{"type":"integer","minimum":1},"page":{"type":"integer","minimum":1}}}}}}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"402":{"$ref":"#/components/responses/E402"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"409":{"$ref":"#/components/responses/E409"},"422":{"$ref":"#/components/responses/E422"},"429":{"$ref":"#/components/responses/E429"},"502":{"$ref":"#/components/responses/E502"},"504":{"$ref":"#/components/responses/E504"}}}},"/documents":{"get":{"tags":["Signatures"],"summary":"List signing documents","parameters":[{"name":"status","in":"query","schema":{"$ref":"#/components/schemas/DocumentStatus"}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"const":"list"},"data":{"type":"array","items":{"type":"object","properties":{"object":{"const":"document"},"id":{"type":"string"},"title":{"type":"string"},"status":{"$ref":"#/components/schemas/DocumentStatus"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"completed_at":{"type":["string","null"],"format":"date-time"}}}}}}}}},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"429":{"$ref":"#/components/responses/E429"}}},"post":{"tags":["Signatures"],"summary":"Create a document (and send it with send: true, all or nothing)","requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"array","items":{"type":"string","format":"binary"},"description":"1-10 PDFs"},"data":{"type":"string","contentMediaType":"application/json","contentSchema":{"$ref":"#/components/schemas/DocumentInput"}}},"required":["file","data"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Document"}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"402":{"$ref":"#/components/responses/E402"},"403":{"$ref":"#/components/responses/E403"},"409":{"$ref":"#/components/responses/E409"},"413":{"$ref":"#/components/responses/E413"},"429":{"$ref":"#/components/responses/E429"}}}},"/documents/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"get":{"tags":["Signatures"],"summary":"Document and recipient status","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Document"}}}},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"429":{"$ref":"#/components/responses/E429"}}},"delete":{"tags":["Signatures"],"summary":"Delete document","responses":{"200":{"description":"Deleted","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"const":"document"},"deleted":{"const":true}}}}}},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"429":{"$ref":"#/components/responses/E429"}}}},"/documents/{id}/send":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"post":{"tags":["Signatures"],"summary":"Send a draft to its recipients","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Document"}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"409":{"$ref":"#/components/responses/E409"},"429":{"$ref":"#/components/responses/E429"}}}},"/documents/{id}/cancel":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"post":{"tags":["Signatures"],"summary":"Cancel a pending document","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","maxLength":500}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Document"}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"409":{"$ref":"#/components/responses/E409"},"429":{"$ref":"#/components/responses/E429"}}}},"/stamps":{"get":{"tags":["Signatures"],"summary":"Stamps this token may use (their ids go in stamp fields)","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"const":"list"},"data":{"type":"array","items":{"type":"object","properties":{"object":{"const":"stamp"},"id":{"type":"string","format":"uuid"},"company":{"type":"string"},"subtitle":{"type":"string"},"shape":{"enum":["round","rect"]},"own":{"type":"boolean","description":"false: a stamp of the owner of a team where this account is an admin"}}}}}}}}},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"429":{"$ref":"#/components/responses/E429"}}}},"/documents/{id}/files/{n}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"n","in":"path","required":true,"schema":{"type":"integer","minimum":1},"description":"File number, starting at 1"}],"get":{"tags":["Signatures"],"summary":"Download a PDF (signed or original)","parameters":[{"name":"version","in":"query","schema":{"enum":["signed","original"],"default":"signed"}},{"name":"certificate","in":"query","schema":{"enum":["true","false"],"default":"true"},"description":"false: without the certificate pages"}],"responses":{"200":{"description":"PDF","content":{"application/pdf":{"schema":{"type":"string","format":"binary"}}}},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"409":{"$ref":"#/components/responses/E409"},"429":{"$ref":"#/components/responses/E429"}}}}},"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","description":"An ld_… token from the API Tokens menu"},"apiKey":{"type":"apiKey","in":"header","name":"X-API-Key"}},"responses":{"E400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"E401":{"description":"Token invalid, expired, or revoked","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"E402":{"description":"Not enough AI credits, or document storage is full (code: \"storage_full\")","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"E403":{"description":"Token lacks permission for this module","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"E404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"E409":{"description":"Not allowed in the current status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"E413":{"description":"Request too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"E415":{"description":"Unsupported file type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"E422":{"description":"Unusable AI answer (retryable)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"E429":{"description":"Too many requests (120/minute per token)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"E502":{"description":"AI provider failed (retryable)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"E503":{"description":"AI features are not enabled on this server","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"E504":{"description":"AI provider timed out (retryable)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"schemas":{"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"title":{"type":"string","description":"Direct Extract (problem+json)"},"status":{"type":"integer"},"detail":{"type":"string"}}},"Usage":{"type":"object","properties":{"object":{"const":"usage"},"month":{"type":"string"},"extract":{"$ref":"#/components/schemas/UsageModule"},"check":{"$ref":"#/components/schemas/UsageModule"},"sign":{"$ref":"#/components/schemas/UsageModule"},"parse":{"$ref":"#/components/schemas/UsageModule"},"credits":{"type":"object","properties":{"plan":{"type":"string"},"plan_credits":{"type":"integer"},"plan_left":{"type":"integer"},"balance":{"type":"integer"},"available":{"type":"integer"}}}}},"Parse":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"object":{"const":"parse"},"status":{"enum":["queued","processing","done","failed"]},"name":{"type":"string"},"page_count":{"type":"integer"},"usage":{"type":"object","properties":{"pages":{"type":"integer"},"model_pages":{"type":"integer"},"credits":{"type":"integer"}}},"warnings":{"type":"array","items":{"type":"string"},"description":"e.g. tables the AI model could not check"},"error":{"type":["string","null"]},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"expires_at":{"type":"string","format":"date-time","description":"The job and its result are deleted after this"},"pages":{"type":["array","null"],"items":{"$ref":"#/components/schemas/ParsePage"},"description":"null until done"},"markdown":{"type":["string","null"],"description":"The body as Markdown (headers/footers left out, continued tables joined, <!-- page N --> markers)"},"chunks":{"type":["array","null"],"items":{"$ref":"#/components/schemas/Chunk"}},"documents":{"type":"array","description":"When the file holds several documents: their pages and type","items":{"type":"object","properties":{"pages":{"type":"array","items":{"type":"integer"}},"type":{"type":"string"},"score":{"type":"number"}}}}}},"ParsePage":{"type":"object","properties":{"page":{"type":"integer","minimum":1},"width":{"type":"number","description":"PDF points, or pixels for images"},"height":{"type":"number"},"text_source":{"enum":["text_layer","ocr"]},"quality":{"type":"object","description":"OCR pages only: how well the page could be read; low = true adds a warning and marks the page's blocks unverified","properties":{"ocr_confidence":{"type":"number"},"text_coverage":{"type":"number"},"low":{"type":"boolean"}}},"blocks":{"type":"array","items":{"$ref":"#/components/schemas/Block"},"description":"In reading order"}}},"Box":{"type":"array","items":{"type":"number","minimum":0,"maximum":1},"minItems":4,"maxItems":4,"description":"[x0, y0, x1, y1] as fractions of the page, from the top left"},"Block":{"type":"object","required":["id","type","text","bbox","confidence","verified"],"properties":{"id":{"type":"string","description":"p<page>-b<n>"},"type":{"enum":["heading","paragraph","list_item","table","key_value","checkbox","signature","stamp","image","header","footer"]},"text":{"type":"string"},"bbox":{"$ref":"#/components/schemas/Box"},"level":{"type":"integer","description":"heading: 1 is the largest"},"key":{"type":"string"},"value":{"type":"string"},"checked":{"type":"boolean"},"table":{"type":"object","properties":{"header_rows":{"type":"integer"},"continues":{"type":"string","description":"Block id of the table this one continues (previous page)"},"rows":{"type":"array","items":{"type":"array","items":{"$ref":"#/components/schemas/Cell"}},"description":"As in HTML: positions covered by row_span/col_span are left out"}}},"confidence":{"type":"number","minimum":0,"maximum":1},"verified":{"type":"boolean","description":"Text layer: every word stands on the page under bbox. OCR: read with enough confidence on a page that is not low quality. false: flagged"}}},"Cell":{"type":"object","properties":{"text":{"type":"string"},"bbox":{"$ref":"#/components/schemas/Box"},"row_span":{"type":"integer","minimum":2},"col_span":{"type":"integer","minimum":2},"verified":{"type":"boolean"}}},"Chunk":{"type":"object","properties":{"text":{"type":"string","description":"Markdown"},"pages":{"type":"array","items":{"type":"integer"}},"heading_path":{"type":"array","items":{"type":"string"}},"blocks":{"type":"array","items":{"type":"string"},"description":"Block ids: the evidence"}}},"UsageModule":{"type":"object","properties":{"pages":{"type":"integer"},"documents":{"type":"integer"},"api":{"type":"object","properties":{"pages":{"type":"integer"},"documents":{"type":"integer"}}},"web":{"type":"object","properties":{"pages":{"type":"integer"},"documents":{"type":"integer"}}}}},"Field":{"type":"object","required":["key","label","type"],"properties":{"key":{"type":"string"},"label":{"type":"string"},"type":{"enum":["text","number","money","date","nik","npwp","email","phone","table"]},"hint":{"type":"string"},"required":{"type":"boolean"},"columns":{"type":"array","items":{"$ref":"#/components/schemas/Field"}},"after":{"type":"string"}}},"Template":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":["string","null"]},"fields":{"type":"array","items":{"$ref":"#/components/schemas/Field"}},"builtin":{"type":"boolean"}}},"Extraction":{"type":"object","properties":{"id":{"type":"string"},"object":{"const":"extraction"},"status":{"enum":["waiting","processing","done","failed","needs_review"],"description":"needs_review: an Auto-detect document from the app waiting for its type"},"name":{"type":"string"},"template":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}}},"pages":{"type":["integer","null"]},"document_type":{"type":["string","null"]},"data":{"type":["object","null"],"additionalProperties":true,"description":"Normalized values, by field key"},"confidence":{"type":["object","null"],"additionalProperties":true},"checks":{"type":["array","null"],"items":{"type":"object","properties":{"field":{"type":"string"},"severity":{"enum":["tinggi","sedang","rendah"]},"message":{"type":"string"}}}},"corrected":{"type":"boolean"},"error":{"type":["string","null"]},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"Guess":{"type":"object","properties":{"value":{"type":"string","description":"Type id, or \"needs_review\""},"label":{"type":"string"},"score":{"type":"number","minimum":0,"maximum":1}}},"Classification":{"type":"object","properties":{"object":{"const":"classification"},"name":{"type":"string"},"pages":{"type":"integer"},"type":{"$ref":"#/components/schemas/Guess"},"alternatives":{"type":"array","items":{"$ref":"#/components/schemas/Guess"}},"template":{"type":["string","null"],"description":"Template id to extract with (POST /extractions), or null"},"segments":{"type":"array","description":"With split=true: the documents found, in page order","items":{"type":"object","properties":{"pages":{"type":"array","items":{"type":"integer","minimum":1}},"type":{"$ref":"#/components/schemas/Guess"},"alternatives":{"type":"array","items":{"$ref":"#/components/schemas/Guess"}},"template":{"type":["string","null"]}}}},"credits":{"type":"integer","description":"Credits charged"}}},"ExtractResult":{"type":"object","properties":{"parsed":{"type":"object","additionalProperties":{"type":"string"}},"summary":{"type":"string"},"essentialInformation":{"type":"string","description":"Markdown"},"documentType":{"type":"array","items":{"type":"string"}},"stats":{"type":"object","properties":{"fieldCompleteness":{"type":"integer","minimum":0,"maximum":100}}},"durationMs":{"type":"integer"}}},"Check":{"type":"object","properties":{"id":{"type":"string"},"object":{"const":"check"},"status":{"enum":["queued","processing","done","failed"]},"name":{"type":"string"},"files":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"pages":{"type":["integer","null"]}}}},"findings":{"type":"array","items":{"type":"object","properties":{"severity":{"enum":["tinggi","sedang","rendah","info"]},"kind":{"type":"string"},"title":{"type":"string"},"detail":{"type":"string"},"quote":{"type":["string","null"]},"file":{"type":"integer","minimum":1},"page":{"type":"integer","minimum":1}}}},"review":{"type":["object","null"],"properties":{"summary":{"type":"string"},"parties":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"role":{"type":"string"}}}},"terms":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"text":{"type":"string"},"quote":{"type":["string","null"]},"file":{"type":"integer","minimum":1},"page":{"type":"integer","minimum":1}}}},"obligations":{"type":"array","items":{"type":"object","properties":{"party":{"type":"string"},"text":{"type":"string"},"quote":{"type":["string","null"]},"file":{"type":"integer","minimum":1},"page":{"type":"integer","minimum":1}}}},"findings":{"type":"array","items":{"type":"object","properties":{"severity":{"enum":["tinggi","sedang","rendah"]},"category":{"type":"string"},"title":{"type":"string"},"detail":{"type":"string"},"suggestion":{"type":"string"},"quote":{"type":["string","null"]},"file":{"type":"integer","minimum":1},"page":{"type":"integer","minimum":1}}}}}},"ai":{"type":"boolean"},"error":{"type":["string","null"]},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"DocumentStatus":{"enum":["draft","pending","completed","declined","cancelled","expired"]},"DocumentInput":{"type":"object","required":["recipients"],"properties":{"title":{"type":"string"},"message":{"type":"string","maxLength":1000},"recipients":{"type":"array","minItems":1,"maxItems":20,"items":{"type":"object","required":["email"],"properties":{"email":{"type":"string","format":"email"},"name":{"type":"string"},"role":{"enum":["signer","approver","viewer","cc"],"default":"signer"},"auth":{"enum":["link","account"],"default":"link"}}}},"fields":{"type":"array","maxItems":500,"description":"Position: anchor (text in the PDF; the field goes just below it), or page + x + y (fractions 0..1 from the top left)","items":{"type":"object","required":["type"],"properties":{"recipient":{"type":"string","format":"email","description":"Required, except for stamp (the sender's stamp)"},"type":{"enum":["signature","initials","name","email","date","text","stamp"]},"stamp_id":{"type":"string","format":"uuid","description":"Required for stamp: an id from GET /stamps"},"file":{"type":"integer","minimum":1,"default":1},"page":{"type":"integer","minimum":1},"x":{"type":"number"},"y":{"type":"number"},"w":{"type":"number"},"h":{"type":"number"},"anchor":{"type":"string"},"offset":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"}}},"label":{"type":"string"},"required":{"type":"boolean"}}}},"signing_order":{"type":"boolean"},"expires_on":{"type":"string","format":"date","description":"End of that day, Jakarta time"},"remind_days":{"enum":[1,2,3,7]},"send":{"type":"boolean"},"send_email":{"type":"boolean","default":true},"ai_review":{"type":"boolean","default":false}}},"Document":{"type":"object","properties":{"id":{"type":"string"},"object":{"const":"document"},"status":{"$ref":"#/components/schemas/DocumentStatus"},"title":{"type":"string"},"message":{"type":["string","null"]},"signing_order":{"type":"boolean"},"expires_at":{"type":["string","null"],"format":"date-time"},"remind_days":{"type":["integer","null"]},"send_email":{"type":"boolean"},"cancel_reason":{"type":["string","null"]},"files":{"type":"array","items":{"type":"object","properties":{"file":{"type":"integer"},"name":{"type":"string"},"sha256":{"type":"string"},"signed":{"type":"boolean"}}}},"recipients":{"type":"array","items":{"type":"object","properties":{"email":{"type":"string"},"name":{"type":"string"},"role":{"enum":["signer","approver","viewer","cc"]},"auth":{"enum":["link","account"]},"status":{"enum":["waiting","sent","done","declined"]},"sent_at":{"type":["string","null"],"format":"date-time"},"done_at":{"type":["string","null"],"format":"date-time"},"declined_at":{"type":["string","null"],"format":"date-time"},"decline_reason":{"type":["string","null"]},"sign_url":{"type":["string","null"],"format":"uri"}}}},"fields":{"type":"array","items":{"type":"object","properties":{"recipient":{"type":"string"},"type":{"type":"string"},"file":{"type":"integer"},"page":{"type":"integer"},"x":{"type":"number"},"y":{"type":"number"},"w":{"type":"number"},"h":{"type":"number"},"label":{"type":["string","null"]},"required":{"type":"boolean"},"filled":{"type":"boolean"},"value":{"type":["string","null"],"description":"null for signatures and initials; for stamp: the stamp code (verifiable at /verifikasi) once the document is completed"}}}},"completed_at":{"type":["string","null"],"format":"date-time"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}}}}}