# invoices query


`invoices` is a GraphQL query of the Chameleoon MAX API. Send it as `POST https://max-api.chameleoon.sk/api/v1/graphql` with your API key, see [Chameleoon MAX](/chameleoon-max).

Returns a page of invoices that match a filter, newest issued first. Use it to browse or
reconcile the invoices imported from the accounting system.

- Requires the `invoice.read` permission.
- Invoices outside your API key's scope are left out.

Pass exactly one of `first` or `last`, from 1 to 250. `first` (with `after`) pages forward;
`last` (with `before`) pages backward. `last` alone returns the last page.

A page costs 2 + first (or last) × the cost of one node.

## Arguments

- `filter`: [`InvoiceFilter`](/chameleoon-max/type/invoice-filter)
- `first`: `Int`
- `after`: `String`
- `last`: `Int`
- `before`: `String`

## Returns

[`InvoiceConnection!`](/chameleoon-max/type/invoice-connection): a page of [`Invoice`](/chameleoon-max/type/invoice).

## Example

**Query**

```graphql
query invoices($first: Int) {
  invoices(first: $first) {
    edges {
      cursor
    }
    nodes {
      id
      direction
      kind
      status
      failureReason
      source
    }
    pageInfo {
      hasNextPage
      hasPreviousPage
      startCursor
      endCursor
    }
  }
}
```

**Variables**

```json
{
  "first": 10
}
```

**Response**

```json
{
  "data": {
    "invoices": {
      "edges": [
        {
          "cursor": "example"
        }
      ],
      "nodes": [
        {
          "id": "00000000-0000-4000-8000-000000000001",
          "direction": "ISSUED",
          "kind": "INVOICE",
          "status": "PENDING",
          "failureReason": "example",
          "source": "example"
        }
      ],
      "pageInfo": {
        "hasNextPage": true,
        "hasPreviousPage": true,
        "startCursor": "example",
        "endCursor": "example"
      }
    }
  }
}
```

Values are illustrative: replace IDs and codes with your own before you send the call.
