{"components":{"schemas":{"Combined":{"properties":{"accounts":{"items":{"type":"object"},"type":"array"},"counts":{"type":"object"},"downloads":{"$ref":"#/components/schemas/Downloads"},"problems":{"items":{"properties":{"kind":{"enum":["gap","carry_over","chain_break","totals"],"type":"string"},"text":{"type":"string"}},"type":"object"},"type":"array"},"removed":{"items":{"type":"object"},"type":"array"},"statement_ids":{"items":{"type":"string"},"type":"array"},"statements":{"items":{"type":"object"},"type":"array"}},"type":"object"},"Downloads":{"description":"Signed links that work without the API key until expires_at.","properties":{"csv":{"format":"uri","type":"string"},"expires_at":{"format":"date-time","type":"string"},"xlsx":{"format":"uri","type":"string"}},"type":"object"},"Error":{"properties":{"error":{"additionalProperties":true,"properties":{"attempts_left":{"type":"integer"},"code":{"enum":["missing_key","invalid_key","revoked_key","rate_limited","too_many_jobs","monthly_limit","capacity","busy","no_file","empty_file","file_too_large","too_many_pages","unsupported_type","infected","password_required","password_wrong","password_attempts","unreadable","not_found","not_ready","failed","bad_request","method_not_allowed","server_error"],"type":"string"},"message":{"type":"string"},"pages_left":{"type":"integer"},"retry_after":{"type":"integer"},"upgrade_url":{"type":"string"}},"required":["code","message"],"type":"object"}},"required":["error"],"type":"object"},"Result":{"properties":{"account":{"properties":{"last4":{"type":["string","null"]},"masked":{"type":["string","null"]}},"type":"object"},"bank":{"type":["string","null"]},"checks":{"properties":{"balance_checks":{"type":"integer"},"balance_failures":{"type":"integer"},"newest_first":{"type":"boolean"},"rows":{"type":"integer"},"rows_flagged":{"type":"integer"},"rows_passed":{"type":"integer"},"sign_fixes":{"type":"integer"},"status":{"enum":["reconciled","check","unverified"],"type":"string"},"totals":{"type":"object"}},"type":"object"},"closing_balance":{"type":["number","null"]},"currency":{"type":["string","null"]},"money_in_total":{"type":["number","null"]},"money_out_total":{"type":["number","null"]},"ocr_pages":{"type":"integer"},"opening_balance":{"type":["number","null"]},"pages":{"type":"integer"},"period":{"properties":{"end":{"type":["string","null"]},"start":{"type":["string","null"]}},"type":"object"},"printed_totals":{"type":"object"},"statement_type":{"enum":["bank","credit_card"],"type":"string"},"transactions":{"items":{"$ref":"#/components/schemas/Transaction"},"type":"array"}},"type":"object"},"Statement":{"properties":{"created_at":{"format":"date-time","type":"string"},"downloads":{"$ref":"#/components/schemas/Downloads"},"error":{"type":"object"},"expires_at":{"format":"date-time","type":"string"},"id":{"type":"string"},"kind":{"enum":["pdf","jpeg","png","heic"],"type":"string"},"links":{"type":"object"},"object":{"const":"statement"},"pages":{"type":"integer"},"pages_done":{"type":"integer"},"result":{"$ref":"#/components/schemas/Result"},"status":{"enum":["queued","running","done","failed"],"type":"string"},"usage":{"$ref":"#/components/schemas/Usage"}},"required":["id","status"],"type":"object"},"Transaction":{"properties":{"amount":{"description":"Signed: money in positive.","type":"number"},"balance":{"type":["number","null"]},"date":{"format":"date","type":["string","null"]},"description":{"type":"string"},"flags":{"items":{"type":"string"},"type":"array"},"money_in":{"type":["number","null"]},"money_out":{"type":["number","null"]},"notes":{"items":{"type":"string"},"type":"array"},"page":{"type":"integer"},"row":{"type":"integer"}},"type":"object"},"Usage":{"properties":{"free_pages":{"type":"integer"},"free_pages_left":{"type":"integer"},"free_pages_used":{"type":"integer"},"month":{"type":"string"},"pages_left":{"type":"integer"},"pages_per_file":{"type":"integer"},"plan":{"type":["object","null"]},"resets":{"type":"string"},"upgrade_url":{"type":"string"}},"type":"object"}},"securitySchemes":{"apiKey":{"in":"header","name":"X-API-Key","type":"apiKey"},"bearer":{"description":"Authorization: Bearer dfk_...","scheme":"bearer","type":"http"}}},"externalDocs":{"url":"https://docfig.com/api"},"info":{"contact":{"email":"hello@docfig.com","name":"DocFig","url":"https://docfig.com/api"},"description":"Upload a bank or credit card statement (PDF, scanned PDF, or a JPG, PNG or HEIC photo). DocFig reads every transaction and checks each row against the running balance and the printed totals. Results are held in memory and deleted one hour after upload. Free: 100 pages a month per account.","license":{"name":"Proprietary service; SDKs are MIT","url":"https://docfig.com/terms"},"summary":"Bank statement PDFs to checked JSON, Excel and CSV.","termsOfService":"https://docfig.com/terms","title":"DocFig API","version":"1.0.0"},"openapi":"3.1.0","paths":{"/v1/combine":{"post":{"description":"Append .xlsx or .csv to the path (or ?format=) for the combined workbook.","operationId":"combineStatements","requestBody":{"content":{"application/json":{"schema":{"properties":{"statements":{"items":{"type":"string"},"maxItems":24,"minItems":1,"type":"array"}},"required":["statements"],"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Combined"}}},"description":"Combined accounts, problems and removed duplicates."},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Bad request body."},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Missing, invalid or revoked API key."},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Unknown ids."},"409":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Some statements are not done."},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Rate limit reached (see Retry-After)."}},"summary":"Combine converted statements: gaps, overlaps, duplicates, carry-over"}},"/v1/files/{token}":{"get":{"description":"The xlsx and csv links in a result's `downloads` work without the API key until `expires_at` (one hour after upload, or sooner if the result is deleted). Share them only with people who may see the statement.","operationId":"downloadSigned","parameters":[{"in":"path","name":"token","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{},"text/csv":{}},"description":"The Excel or CSV file."},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Invalid or expired link, or the result was deleted."},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Too many downloads from this address."}},"security":[],"summary":"Download with a signed link (no key)"}},"/v1/statements":{"post":{"operationId":"createStatement","requestBody":{"content":{"multipart/form-data":{"schema":{"properties":{"file":{"contentMediaType":"application/octet-stream","description":"PDF, JPG, PNG or HEIC, up to 20 MB and 100 pages.","type":"string"},"password":{"description":"Password for a locked PDF. Used once in memory, never stored or logged.","type":"string"}},"required":["file"],"type":"object"}}},"required":true},"responses":{"202":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Statement"}}},"description":"Accepted; poll the statement until status is done.","headers":{"Location":{"schema":{"type":"string"}}}},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"No file, or an empty one."},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Missing, invalid or revoked API key."},"413":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"File too large or too many pages."},"415":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Unsupported file type."},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"password_required, password_wrong, unreadable or infected."},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Rate limit reached (see Retry-After)."},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Daily capacity reached or converter busy."}},"summary":"Upload a statement to convert"}},"/v1/statements/{id}":{"delete":{"operationId":"deleteStatement","parameters":[{"description":"Statement id from POST /v1/statements.","in":"path","name":"id","required":true,"schema":{"pattern":"^st_[A-Za-z0-9_-]{20,40}$","type":"string"}}],"responses":{"204":{"description":"Deleted."},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Missing, invalid or revoked API key."},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Unknown or expired."},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Rate limit reached (see Retry-After)."}},"summary":"Delete the result now"},"get":{"operationId":"getStatement","parameters":[{"description":"Statement id from POST /v1/statements.","in":"path","name":"id","required":true,"schema":{"pattern":"^st_[A-Za-z0-9_-]{20,40}$","type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Statement"}}},"description":"The statement."},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Missing, invalid or revoked API key."},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Unknown or expired (results are deleted after one hour)."},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Rate limit reached (see Retry-After)."}},"summary":"Status and, when done, the result"}},"/v1/statements/{id}.csv":{"get":{"operationId":"downloadStatementCsv","parameters":[{"description":"Statement id from POST /v1/statements.","in":"path","name":"id","required":true,"schema":{"pattern":"^st_[A-Za-z0-9_-]{20,40}$","type":"string"}}],"responses":{"200":{"content":{"text/csv":{"schema":{"type":"string"}}},"description":"CSV file."},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Missing, invalid or revoked API key."},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Unknown or expired."},"409":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Not converted yet, or failed."},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Rate limit reached (see Retry-After)."}},"summary":"CSV, same as the website"}},"/v1/statements/{id}.xlsx":{"get":{"operationId":"downloadStatementXlsx","parameters":[{"description":"Statement id from POST /v1/statements.","in":"path","name":"id","required":true,"schema":{"pattern":"^st_[A-Za-z0-9_-]{20,40}$","type":"string"}}],"responses":{"200":{"content":{"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{"schema":{"contentMediaType":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","type":"string"}}},"description":"XLSX file."},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Missing, invalid or revoked API key."},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Unknown or expired."},"409":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Not converted yet, or failed."},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Rate limit reached (see Retry-After)."}},"summary":"Excel workbook, same as the website"}},"/v1/usage":{"get":{"operationId":"getUsage","responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Usage"}}},"description":"Usage."},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Missing, invalid or revoked API key."},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Rate limit reached (see Retry-After)."}},"summary":"Pages used and left this month"}}},"security":[{"bearer":[]},{"apiKey":[]}],"servers":[{"url":"https://docfig.com"}]}
