Skip to content

Search invoices

Request

Advanced invoice filtering with custom GraphQL where clauses and dynamic ordering

Supports invoiceNumber text matching, status filtering, and date ranges.

Real Example:

curl --location 'https://{{host}}/v1/invoices/search' \
--header 'Authorization: bearer {{token}}' \
--header 'Content-Type: application/json' \
--data '{
  "pageSize": 1,
  "where": {
    "_and": [
      {
        "_or": [
          {
            "invoiceNumber": {
              "_ilike": "%2024%"
            }
          },
          {
            "description": {
              "_ilike": "%service%"
            }
          }
        ]
      },
      {
        "status": {
          "_in": ["POSTED", "CLOSED"]
        }
      },
      {
        "createdAt": {
          "_gte": "1900-01-01T00:00:00Z"
        }
      },
      {
        "dueDate": {
          "_gte": "2024-01-01T00:00:00Z"
        }
      }
    ]
  },
  "orderBy": [
    {
      "invoiceNumber": "asc"
    },
    {
      "createdAt": "desc"
    }
  ]
}'
Security
BearerAuth
Bodyapplication/json
pageSizeinteger, [ 1 .. 1000 ]
Default:1
whereobject

GraphQL-style where clause for complex invoice filtering

Example:
{ "_and": [ {}, {}, {}, {} ] }
orderByArray of objects

Dynamic ordering specifications

Example:
[ { "invoiceNumber": "asc" }, { "createdAt": "desc" } ]
curl -i -X POST \
  https://api.doc.aiwyn.ai/_mock/bundle/gql/v1/invoices/search \
  -H 'Authorization: Bearer <YOUR_JWT_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "pageSize": 1,
    "where": {
      "_and": [
        {
          "_or": [
            {
              "invoiceNumber": {
                "_ilike": "%2024%"
              }
            },
            {
              "description": {
                "_ilike": "%service%"
              }
            }
          ]
        },
        {
          "status": {
            "_in": [
              "POSTED",
              "CLOSED"
            ]
          }
        },
        {
          "createdAt": {
            "_gte": "1900-01-01T00:00:00Z"
          }
        },
        {
          "dueDate": {
            "_gte": "2024-01-01T00:00:00Z"
          }
        }
      ]
    },
    "orderBy": [
      {
        "invoiceNumber": "asc"
      },
      {
        "createdAt": "desc"
      }
    ]
  }'

Responses

Successfully retrieved filtered invoices

Bodyapplication/json
invoicesArray of objects
totalobject
Response
{ "invoices": [ {} ], "total": { "aggregate": {} } }