{"openapi":"3.1.0","info":{"title":"POST /api/v1/bills/{bill_id}/submit-for-ap-approval","version":"1.0.0","description":"Submit bill for AP approval"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/bills/{bill_id}/submit-for-ap-approval":{"post":{"tags":["bills"],"summary":"Submit bill for AP approval","description":"Manually route a forecasted bill into the firm's AP approval workflow. Use when a bill was approved before the workflow was provisioned or when automatic routing did not run. The bill moves from 'forecasted' to 'pending_approval' and posts to 'received' only once an approver signs off.","operationId":"submit_bill_for_ap_approval_api_v1_bills__bill_id__submit_for_ap_approval_post","parameters":[{"name":"bill_id","in":"path","required":true,"schema":{"type":"string","title":"Bill Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"x-business-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Business-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillReceivedRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_SubmitBillForApApprovalResponse_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"detail":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"example":{"detail":"Not authenticated"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"example":{"detail":"Not enough permissions"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"detail":"Resource not found"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"BillReceivedRequest":{"properties":{"bill_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Bill Id","description":"UUID of the bill (set automatically from URL path)."},"amount":{"type":"integer","exclusiveMinimum":0.0,"title":"Amount","description":"Actual bill amount in cents. Must be greater than 0."},"ledger_id":{"type":"string","title":"Ledger Id","description":"UUID of the expense ledger account to categorize this bill. Required for creating the journal entry."},"s3_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"S3 Key","description":"S3 key of the bill document."},"journal_entry_date":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string","format":"date"},{"type":"string"},{"type":"null"}],"title":"Journal Entry Date","description":"Date for the accounting journal entry (ISO 8601 or YYYY-MM-DD)."},"received_on":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string","format":"date"},{"type":"string"},{"type":"null"}],"title":"Received On","description":"Date the bill/goods were received (ISO 8601 or YYYY-MM-DD)."},"due_on":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string","format":"date"},{"type":"string"},{"type":"null"}],"title":"Due On","description":"Payment due date (ISO 8601 or YYYY-MM-DD)."}},"type":"object","required":["amount","ledger_id"],"title":"BillReceivedRequest","description":"Schema for marking a bill as received and creating journal entries.\n\nWhen a bill is marked as received, accounting journal entries are created\nto record the liability (Accounts Payable).","example":{"amount":250000,"due_on":"2024-01-31T00:00:00Z","journal_entry_date":"2024-01-15T00:00:00Z","ledger_id":"019ab37c-led1-7000-8000-000000000001","received_on":"2024-01-15T00:00:00Z"}},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"SubmitBillForApApprovalResponse":{"properties":{"execution_id":{"type":"string","title":"Execution Id","description":"Started workflow execution UUID"},"bill_id":{"type":"string","title":"Bill Id","description":"Bill UUID submitted for approval"}},"type":"object","required":["execution_id","bill_id"],"title":"SubmitBillForApApprovalResponse","description":"Response when manually routing a bill into the AP approval workflow."},"SuccessEnvelope_SubmitBillForApApprovalResponse_":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message"},"code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code"},"data":{"anyOf":[{"$ref":"#/components/schemas/SubmitBillForApApprovalResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[SubmitBillForApApprovalResponse]"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}},"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Token","description":"API token authentication. Format: `Bearer dz_...`"}}},"security":[{"BearerAuth":[]}]}