Ask Wafeq's AI to process this file: it reads the file and books what it is, such as a draft bill or expense, then links the records to the file. The request returns 202 with the file at status queued; follow the status field to processed or failed, and read the booked records with ?expand=entities. A file can be processed again only after a run that booked nothing (failed with no linked record from that run). With an API key the AI acts as the organization's owner (or an admin); with an OAuth token it acts as the member who granted the token, with that member's permissions, and the token needs both the bills.write and expenses.write scopes. Files that arrived in the inbox are processed there and are refused here.
400The file type cannot be read: send a PDF, an image or an e-invoice XML.
402The organization's AI allowance is spent or missing.
403The OAuth token lacks the bills.write or expenses.write scope, the acting member or the plan cannot book any record, or no member can act for the organization.
409The file is already queued, being processed or processed, a failed run already booked records from it, or it belongs to an inbox document.