# Search draft invoice histories Advanced draft invoice history filtering with custom GraphQL where clauses and dynamic ordering Supports client, invoice, job filtering and draftInvoice approvedAt date range. Real Example: bash curl --location 'https://{{host}}/v1/draft_invoice_histories/search' \ --header 'Authorization: bearer {{token}}' \ --header 'Content-Type: application/json' \ --data '{ "pageSize": 1, "where": { "_and": [ { "_or": [ { "clientId": { "_in": [1001, 1002] } }, { "jobId": { "_in": [2001, 2002] } } ] }, { "active": { "_eq": true } }, { "createdAt": { "_gte": "1900-01-01T00:00:00Z" } }, { "activityType": { "_in": [ "DRAFT_INVOICE_CREATED", "DRAFT_INVOICE_RECONCILED" ] } } ] }, "orderBy": [ { "clientId": "asc" }, { "createdAt": "desc" } ] }' Endpoint: POST /gql/v1/draft_invoice_histories/search Version: 1.0.0 Security: BearerAuth ## Request fields (application/json): - `pageSize` (integer) - `where` (object) GraphQL-style where clause for complex filtering Example: {"_and":[{"_or":[{"clientId":{"_in":[1001,1002]}},{"jobId":{"_in":[2001,2002]}}]},{"active":{"_eq":true}},{"createdAt":{"_gte":"1900-01-01T00:00:00Z"}},{"activityType":{"_in":["DRAFT_INVOICE_CREATED","DRAFT_INVOICE_RECONCILED"]}}]} - `orderBy` (array) Dynamic ordering specifications Example: [{"clientId":"asc"},{"createdAt":"desc"}] ## Response 200 fields (application/json): - `draftInvoices` (array) - `draftInvoices.clientId` (integer) Client identifier Example: 7720 - `draftInvoices.invoiceId` (integer) Invoice identifier Example: 125890 - `draftInvoices.jobId` (integer) Associated job/project identifier Example: 2514 - `draftInvoices.client` (object) Client summary information - `draftInvoices.client.active` (boolean) Example: true - `draftInvoices.client.clientRef` (string) Example: "TF-2024-789" - `draftInvoices.client.name` (string) Example: "TechFlow Enterprises" - `draftInvoices.client.pmsRef` (string) Example: "240815" - `draftInvoices.draftInvoice` (object) Draft invoice metadata - `draftInvoices.draftInvoice.approvedAt` (string) Example: "2024-03-15T14:32:18+00:00" - `draftInvoices.draftInvoice.arTranId` (integer) Example: 125890 - `draftInvoices.draftInvoice.approverStaffId` (integer) Example: 301 - `draftInvoices.draftInvoice.approvedByStaffId` (integer) Example: 301 - `draftInvoices.draftInvoice.invoiceId` (integer) Example: 125890 - `draftInvoices.draftInvoice.isActive` (boolean) Example: true - `draftInvoices.draftInvoice.pms_invoice_number` (string) Example: "INV-2024-4850" - `draftInvoices.draftInvoice.status` (string) Example: "APPROVED" - `total` (object) - `total.aggregate` (object) - `total.aggregate.count` (integer) Total number of draft invoice history records matching criteria Example: 94 ## Response 400 fields ## Response 401 fields ## Response 500 fields