{"components":{"schemas":{"Analysis":{"properties":{"counts":{"properties":{"dropped":{"type":"integer"},"proposed":{"type":"integer"},"verified":{"type":"integer"}},"type":"object"},"created":{"type":"string"},"expires":{"type":["string","null"]},"html":{"type":"string"},"id":{"type":"string"},"links":{"type":["object","null"]},"pdf_base64":{"description":"present only when include_pdf was set","type":["string","null"]},"seal":{"$ref":"#/components/schemas/SealBundle"},"signed":{"type":"boolean"},"stored":{"type":"boolean"},"tier":{"enum":["written","deterministic","plain"]}},"required":["id","tier","created","counts","signed","seal","html","stored"],"type":"object"},"Error":{"properties":{"error":{"properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"],"type":"object"}},"required":["error"],"type":"object"},"Job":{"properties":{"agreed_by":{"description":"the ISO date given at acceptance, if any","format":"date","type":["string","null"]},"assigned_role":{"description":"always 'analysis' - the only real worker role today","type":"string"},"created":{"format":"date-time","type":"string"},"error":{"description":"present once status is failed","type":"string"},"id":{"type":"string"},"links":{"description":"present once status is done","type":["object","null"]},"report_id":{"description":"present once status is done","type":"string"},"status":{"enum":["pending","running","done","failed","escalated"]}},"required":["id","status","created"],"type":"object"},"Review":{"description":"null until reviewed","properties":{"approved":{"type":["boolean","null"]},"at":{"format":"date-time","type":"string"},"caller":{"type":"string"}},"type":["object","null"]},"SealBundle":{"description":"analystos-seal/1; specified in https://analystos.dev/docs/seal.md","properties":{"facts":{"items":{"$ref":"#/components/schemas/SealFact"},"type":"array"},"format":{"const":"analystos-seal/1"},"payload":{"description":"signed fields; see docs/seal.md. model_id, caller_id and code_version are optional (absent in seals made before Slice 83)","properties":{"caller_id":{"description":"the API-key name that made the run; (cli) or (legacy-access-code) outside /api/v1; null if unstated","type":["string","null"]},"code_version":{"description":"the deployed code version (ANALYSTOS_CODE_VERSION or the Vercel commit SHA); null if the deployment does not say","type":["string","null"]},"model_id":{"description":"the model the run asked (ANALYSTOS_MODEL)","type":["string","null"]}},"type":"object"},"report":{"type":["object","null"]},"signature":{"type":["object","null"]}},"required":["format","payload","facts"],"type":"object"},"SealFact":{"description":"One sealed fact: `facts[].record` of an analystos-seal/1 bundle. Discriminated by `type`.","oneOf":[{"description":"A claim backed by an exact substring of the document.","properties":{"citation":{"description":"exact text from the document","type":"string"},"display":{"enum":["inline","stat"]},"format":{"enum":["usd","percent","number","text"]},"gaap_status":{"enum":["gaap","non_gaap","n/a"]},"horizon":{"enum":["reported","guidance","projected"]},"label":{"type":["string","null"]},"sentence":{"description":"with a value: the sentence, holding one {value} placeholder","type":"string"},"text":{"description":"without a value: the quoted text itself","type":"string"},"type":{"const":"quote"},"value":{"description":"present when the quote carries a figure; must equal a number `citation` spells","pattern":"^-?[0-9]+(\\.[0-9]+)?([eE][+-]?[0-9]+)?$","type":"string"}},"required":["type","citation"],"type":"object"},{"description":"A figure recomputed from cited operands.","properties":{"citation":{"items":{"type":"string"},"type":"array"},"display":{"enum":["inline","stat"]},"format":{"enum":["usd","percent","number","text"]},"gaap_status":{"enum":["gaap","non_gaap","n/a"]},"horizon":{"enum":["reported","guidance","projected"]},"label":{"type":["string","null"]},"operands":{"description":"in the order given; `citation[i]` is operand i","items":{"description":"a number, sealed as a string (rule 1)","pattern":"^-?[0-9]+(\\.[0-9]+)?([eE][+-]?[0-9]+)?$","type":"string"},"type":"array"},"operation":{"enum":["sum","average","ratio","growth_percent","percent_of_total","difference","remainder"]},"sentence":{"type":"string"},"total":{"anyOf":[{"description":"a number, sealed as a string (rule 1)","pattern":"^-?[0-9]+(\\.[0-9]+)?([eE][+-]?[0-9]+)?$","type":"string"},{"type":"null"}],"description":"the denominator for percent_of_total, else null; its citation follows the operands'"},"type":{"const":"computed"},"value":{"description":"the result; must recompute from `operands` (and `total`)","pattern":"^-?[0-9]+(\\.[0-9]+)?([eE][+-]?[0-9]+)?$","type":"string"}},"required":["type","operation","value","operands","total","citation"],"type":"object"},{"description":"A timeline item; every part is a substring of the document.","properties":{"citation":{"description":"equals `what`","type":"string"},"date":{"description":"empty when the document gave none","type":"string"},"gaap_status":{"enum":["gaap","non_gaap","n/a"]},"horizon":{"enum":["reported","guidance","projected"]},"milestones":{"items":{"properties":{"date":{"type":"string"},"detail":{"type":"string"}},"required":["date","detail"],"type":"object"},"type":"array"},"next_step":{"type":"string"},"status":{"type":"string"},"type":{"const":"event"},"what":{"type":"string"}},"required":["type","what","citation"],"type":"object"},{"description":"Connective text with no figure.","properties":{"gaap_status":{"enum":["gaap","non_gaap","n/a"]},"horizon":{"enum":["reported","guidance","projected"]},"text":{"description":"carries no figure: the pipeline refuses a digit outside a calendar reference","type":"string"},"type":{"const":"prose"}},"required":["type","text"],"type":"object"}]},"Verification":{"properties":{"authentic":{"type":"boolean"},"checks":{"items":{"properties":{"detail":{"type":"string"},"name":{"type":"string"},"status":{"enum":["pass","fail","skipped"]}},"required":["name","status","detail"],"type":"object"},"type":"array"},"content_checked":{"type":"boolean"},"ok":{"type":"boolean"}},"required":["ok","authentic","content_checked","checks"],"type":"object"}},"securitySchemes":{"bearerAuth":{"description":"Per-caller API key (aos_...)","scheme":"bearer","type":"http"}}},"info":{"description":"Analyze a document into a report whose every figure is a verified quote or a recomputed calculation, sealed so anyone can re-verify it offline (see https://analystos.dev/docs/seal.md).","title":"AnalystOS API","version":"1"},"openapi":"3.1.0","paths":{"/api/v1":{"get":{"operationId":"index","responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"The index"}},"security":[],"summary":"Machine-readable index"}},"/api/v1/analyses":{"post":{"description":"Synchronous: runs the whole pipeline, bounded by the platform's function time limit. The upload is deleted when the request ends. Document text is sent to Anthropic's API.","operationId":"createAnalysis","requestBody":{"content":{"multipart/form-data":{"schema":{"properties":{"file":{"description":"csv, xlsx, docx, pptx or pdf; at most 10 MB","format":"binary","type":"string"},"include_pdf":{"description":"also return the generated PDF as pdf_base64","type":"boolean"},"title":{"type":"string"}},"required":["file"],"type":"object"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Analysis"}}},"description":"Analyzed"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"no file"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"missing or invalid API key"},"415":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"unsupported file type"},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"the document could not be analyzed"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"rate limited"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"no API keys configured, or the seal key is malformed"}},"security":[{"bearerAuth":[]}],"summary":"Analyze one uploaded document"}},"/api/v1/jobs":{"post":{"description":"Returns immediately with a pending job id; no model calls yet. Call POST /jobs/{id}/run to actually run it, then GET /jobs/{id} (or poll it directly) for the result. An optional agreed_by date (ISO, YYYY-MM-DD) records when this engagement was agreed to deliver by - used only to compute the coordination measure, never enforced. See https://analystos.dev/docs/api.md#async-jobs for why this is not a background worker.","operationId":"createJob","requestBody":{"content":{"multipart/form-data":{"schema":{"properties":{"agreed_by":{"description":"ISO date (YYYY-MM-DD); 400 if malformed","format":"date","type":"string"},"file":{"description":"csv, xlsx, docx, pptx or pdf; at most 10 MB","format":"binary","type":"string"},"title":{"type":"string"}},"required":["file"],"type":"object"}}},"required":true},"responses":{"202":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"}}},"description":"Pending"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"no file, or a malformed agreed_by date"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"missing or invalid API key"},"415":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"unsupported file type"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"rate limited"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"no API keys or no job storage configured"}},"security":[{"bearerAuth":[]}],"summary":"Submit one document for async analysis"}},"/api/v1/jobs/{id}":{"get":{"operationId":"getJob","parameters":[{"description":"The 32-hex job id.","in":"path","name":"id","required":true,"schema":{"pattern":"^[0-9a-f]{32}$","type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"}}},"description":"The job's status"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"missing or invalid API key"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"not found"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"storage not configured"}},"security":[{"bearerAuth":[]}],"summary":"Poll a job's status (never executes anything)"}},"/api/v1/jobs/{id}/escalate":{"post":{"description":"Moves a pending job to escalated, which blocks it from running until someone else resolves it by hand - this endpoint has no review queue or notification of its own, it only stops automatic progress. Idempotent once already escalated; 409 from any other status.","operationId":"escalateJob","parameters":[{"description":"The 32-hex job id.","in":"path","name":"id","required":true,"schema":{"pattern":"^[0-9a-f]{32}$","type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"}}},"description":"The job's status, now escalated"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"missing or invalid API key"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"not found"},"409":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"only a pending job can be escalated"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"rate limited"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"no job storage configured"}},"security":[{"bearerAuth":[]}],"summary":"Flag a pending job for a human - coordination's escalate verb"}},"/api/v1/jobs/{id}/run":{"post":{"description":"One bounded call, same time ceiling as POST /analyses - not a background worker (see docs/api.md#async-jobs). Calling this again on a running/done/failed job just returns its current status. An escalated job is also refused - it stays as it is until a human deals with it.","operationId":"runJob","parameters":[{"description":"The 32-hex job id.","in":"path","name":"id","required":true,"schema":{"pattern":"^[0-9a-f]{32}$","type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"}}},"description":"The job's status once this call returns"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"missing or invalid API key"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"not found"},"409":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"the job's upload is missing"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"rate limited"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"no job storage, or the seal key is malformed"}},"security":[{"bearerAuth":[]}],"summary":"Run a pending job (idempotent once no longer pending)"}},"/api/v1/links":{"post":{"operationId":"createLink","requestBody":{"content":{"application/json":{"schema":{"properties":{"format":{"enum":["html","pdf","seal"],"type":"string"},"id":{"type":"string"},"ttl_seconds":{"maximum":604800,"minimum":60,"type":"integer"}},"required":["id"],"type":"object"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"properties":{"expires":{"format":"date-time","type":"string"},"format":{"type":"string"},"id":{"type":"string"},"url":{"type":"string"}},"type":"object"}}},"description":"The link"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"unauthorized"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"not found"},"410":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"expired"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"storage or link secret not configured"}},"security":[{"bearerAuth":[]}],"summary":"Issue an expiring signed link to one report and one format"}},"/api/v1/openapi.json":{"get":{"operationId":"openapi","responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"OpenAPI 3.1"}},"security":[],"summary":"This document"}},"/api/v1/reports/{id}":{"get":{"description":"Bearer key of the caller who created it, or a signed link (?exp=&sig=&format=). Somebody else's report is indistinguishable from a missing one.","operationId":"getReport","parameters":[{"description":"The 64-hex report id (SHA-256 of the sealed payload).","in":"path","name":"id","required":true,"schema":{"pattern":"^[0-9a-f]{64}$","type":"string"}},{"in":"query","name":"format","required":false,"schema":{"default":"html","enum":["html","pdf","seal"],"type":"string"}},{"in":"query","name":"exp","required":false,"schema":{"type":"integer"}},{"in":"query","name":"sig","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SealBundle"}},"application/pdf":{"schema":{"format":"binary","type":"string"}},"text/html":{"schema":{"type":"string"}}},"description":"The report"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"missing or invalid API key"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"invalid link"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"not found"},"410":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"expired"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"storage not configured"}},"security":[{"bearerAuth":[]},{}],"summary":"Fetch a stored report, its PDF or its seal"}},"/api/v1/reports/{id}/review":{"post":{"description":"Same ownership rule as GET /reports/{id}: only the key that created the report may review it. Idempotent - reviewing again overwrites who/when/approved.","operationId":"reviewReport","parameters":[{"description":"The 64-hex report id (SHA-256 of the sealed payload).","in":"path","name":"id","required":true,"schema":{"pattern":"^[0-9a-f]{64}$","type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"approved":{"type":["boolean","null"]}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"id":{"type":"string"},"reviewed":{"$ref":"#/components/schemas/Review"}},"type":"object"}}},"description":"Recorded"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"approved must be a boolean"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"missing or invalid API key"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"not found"},"410":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"expired"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"storage not configured"}},"security":[{"bearerAuth":[]}],"summary":"Record that a human reviewed a delivered report"}},"/api/v1/verify":{"post":{"operationId":"verifySeal","requestBody":{"content":{"application/json":{"schema":{"properties":{"bundle":{"$ref":"#/components/schemas/SealBundle"},"public_key":{"description":"base64url Ed25519 key you trust; without it the result is never `authentic`","type":"string"},"text":{"description":"the extracted text, to check content","type":"string"}},"required":["bundle"],"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Verification"}}},"description":"Verification result"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"bad request"}},"security":[],"summary":"Verify a seal bundle (stateless)"}},"/api/v1/verify/{id}":{"get":{"operationId":"getSealMetadata","parameters":[{"description":"The 64-hex report id (SHA-256 of the sealed payload).","in":"path","name":"id","required":true,"schema":{"pattern":"^[0-9a-f]{64}$","type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"Payload, signature info and review state"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"not found"},"410":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"expired"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"storage not configured"}},"security":[],"summary":"Seal metadata for a stored report (never the report)"}}},"servers":[{"url":"https://analystos.dev"}]}
