{"openapi":"3.1.0","info":{"title":"AIDataParser API","version":"0.1.0","description":"Turn messy documents into clean, structured JSON. Built for AI agents."},"servers":[{"url":"https://aidataparser.com"}],"paths":{"/v1/keys":{"post":{"summary":"Create an account and issue an API key (50 free credits, no card).","operationId":"createApiKey","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["email"],"properties":{"email":{"type":"string","format":"email"}}}}}},"responses":{"201":{"description":"API key issued."},"400":{"description":"Invalid email."},"409":{"description":"An account already exists for this email; no key is issued. Keys are shown once, at signup or on the page after a credit purchase."}}}},"/v1/credits":{"get":{"summary":"Get the authenticated account's remaining credit balance (free, no charge).","operationId":"getCredits","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Current credit balance.","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"type":"string"},"email":{"type":"string"},"key_prefix":{"type":"string"},"credits_remaining":{"type":"integer"}}}}}},"401":{"description":"Missing or invalid API key."}}}},"/v1/schemas":{"get":{"summary":"List the built-in schema templates usable as `schema_id` (free, no auth).","operationId":"listSchemas","responses":{"200":{"description":"Available schema templates.","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"type":"string"},"count":{"type":"integer"},"templates":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"doc_type":{"type":"string"},"description":{"type":"string"},"fields":{"type":"array","items":{"type":"string"}},"schema":{"type":"object"}}}}}}}}}}}},"/v1/schemas/infer":{"post":{"summary":"Infer a reusable JSON Schema from a single sample document's text (1 credit).","operationId":"inferSchema","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["text"],"properties":{"text":{"type":"string","description":"A single representative sample of the document type, as text (max 200,000 chars)."},"doc_type":{"type":"string","description":"Optional hint for the kind of document (e.g. purchase order, lab report)."},"instructions":{"type":"string","description":"Optional guidance on which fields matter or how to shape the schema."}}}}}},"responses":{"200":{"description":"The inferred schema, ready to reuse as `schema` on /v1/parse/*.","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"type":"string"},"doc_type":{"type":"string","nullable":true},"schema":{"type":"object"},"fields":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"type":{"type":"string"},"description":{"type":"string","nullable":true}}}},"notes":{"type":"string","nullable":true},"model":{"type":"string"},"credits_charged":{"type":"integer"},"credits_remaining":{"type":"integer"}}}}}},"400":{"description":"Missing or empty `text`."},"402":{"description":"Insufficient credits."},"413":{"description":"`text` exceeds 200,000 chars."}}}},"/v1/validate":{"post":{"summary":"Validate a JSON object against a schema or schema_id template (free, no auth).","operationId":"validate","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"description":"The JSON value to validate."},"schema":{"type":"object","description":"JSON Schema to validate against. Takes precedence over schema_id."},"schema_id":{"type":"string","description":"Built-in template id to validate against instead of a schema (invoice, receipt, resume, bank_statement, purchase_order, business_card, packing_slip, contract). See GET /v1/schemas."}}}}}},"responses":{"200":{"description":"Validation result.","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"type":"string"},"valid":{"type":"boolean"},"error_count":{"type":"integer"},"errors":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"},"keyword":{"type":"string"}}}},"schema_id":{"type":"string"}}}}}},"400":{"description":"Missing `data`, missing schema/schema_id, or invalid schema_id."}}}},"/v1/parse/document":{"post":{"summary":"Extract structured JSON from a PDF or image.","operationId":"parseDocument","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","description":"http(s) URL to a PDF or image."},"base64":{"type":"string","description":"Base64-encoded file bytes."},"media_type":{"type":"string","description":"MIME type for base64 input (application/pdf, image/png, image/jpeg, image/gif, image/webp)."},"schema":{"type":"object","description":"Optional JSON Schema describing the desired output shape. When provided, output is guaranteed to match it."},"schema_id":{"type":"string","description":"Optional built-in template id (invoice, receipt, resume, bank_statement, purchase_order, business_card, packing_slip, contract) used instead of `schema`. See GET /v1/schemas."},"instructions":{"type":"string","description":"Optional natural-language extraction guidance."},"redact":{"type":"boolean","description":"When true, partially mask PII (emails, SSNs, cards, phones, IBANs, IPs) in the response."}}}},"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary"},"schema":{"type":"string","description":"JSON Schema as a string."},"schema_id":{"type":"string","description":"Built-in template id used instead of `schema` (see GET /v1/schemas)."},"instructions":{"type":"string"},"redact":{"type":"string","description":"\"true\" to partially mask PII in the response."}}}}}},"responses":{"200":{"description":"Structured extraction result.","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"type":"string"},"data":{"type":"object"},"confidence":{"type":"string","enum":["high","medium","low"]},"review_needed":{"type":"boolean"},"notes":{"type":["string","null"]},"model":{"type":"string"},"redacted":{"type":"boolean","description":"Present and true when PII masking was applied."},"credits_charged":{"type":"integer"},"credits_remaining":{"type":"integer"}}}}}},"401":{"description":"Missing or invalid API key."},"402":{"description":"Insufficient credits."},"415":{"description":"Unsupported media type."},"422":{"description":"Scanned/image-only PDF with no embedded text."}}}},"/v1/parse/text":{"post":{"summary":"Extract structured JSON from raw text.","operationId":"parseText","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["text"],"properties":{"text":{"type":"string","description":"Raw/messy text to extract from (scraped content, email bodies, chat logs, OCR output, pasted tables). Max 200000 chars."},"schema":{"type":"object","description":"Optional JSON Schema describing the desired output shape. When provided, output is guaranteed to match it."},"schema_id":{"type":"string","description":"Optional built-in template id (invoice, receipt, resume, bank_statement, purchase_order, business_card, packing_slip, contract) used instead of `schema`. See GET /v1/schemas."},"instructions":{"type":"string","description":"Optional natural-language extraction guidance."},"redact":{"type":"boolean","description":"When true, partially mask PII (emails, SSNs, cards, phones, IBANs, IPs) in the response."}}}}}},"responses":{"200":{"description":"Structured extraction result.","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"type":"string"},"data":{"type":"object"},"confidence":{"type":"string","enum":["high","medium","low"]},"review_needed":{"type":"boolean"},"notes":{"type":["string","null"]},"model":{"type":"string"},"redacted":{"type":"boolean","description":"Present and true when PII masking was applied."},"credits_charged":{"type":"integer"},"credits_remaining":{"type":"integer"}}}}}},"400":{"description":"Missing or empty `text`, or invalid schema_id."},"401":{"description":"Missing or invalid API key."},"402":{"description":"Insufficient credits."},"413":{"description":"`text` exceeds the 200000-char limit."}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}}}}