# Historic data via GraphQL

Where as it is possible to get some data from our API for historic Customers, Cards or Transactions - its not always optimal due to the volume / Throttling limits. Typically we would recommend using data exports to get historic data and then enabling real time web hooks to keep the data in sync going forward.

### Get Transactions

You can get a list of historic orders, and narrow down by created\_at. This will return all orders on a specific day

This call also supports [pagination](/graphql/pagination-throttling.md), so you can easily chunk up the requests as needed.

```graphql
{
  Orders(
    page: 1
    limit: 10
    created_at: "2025-02-03 00:00:00"
  ) {
    data {
      LineItems {
        id
        created_at
        Transaction {
            merchant_transaction_reference
        }
        Card {
            card_reference
            balance
            expiry_time
        }
      }
    }
  }
}
```

### Get Orders

You can get all historic orders from the API. The limitations to this request is that you cannot specific a date, and the results are sorted by 'Card ID' - so new transactions can appear at any page within the results rather than at the end.

```graphql
{
  LineItems(
    page: 1
    limit: 10
  ) {
    data {
        id,
        created_at,
        value,
        LineItemType
        {
            name,
        }
        Transaction{
            merchant_transaction_reference,
            Merchant
            {
                name
            }
            Unit
            {
                name
                id
            }
        }
        Card
        {
            id,
            Account{
                name,
                id
            }
            card_reference,
            pin,
            balance,
            expiry_time,
            card_alias_card_reference
            product_name
        }
    }
  }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.usetoggle.com/partner-guides/crm/historic-data-via-graphql.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
