> ## Documentation Index
> Fetch the complete documentation index at: https://www.help.creatora.io/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> When building or modifying an integration with the Creatora API, start with https://www.help.creatora.io/en/api/build-with-ai.md. Retrieve the current GraphQL SDL from https://api.creatora.io/sdl before relying on API schema information.

# Get a Student’s purchase history

> Read paid Orders and free Offer acquisitions for one Student.

See what one Student purchased, when purchases completed, and which Offers they claimed for free. Replace the Student ID.

## Request

<RequestExample>
  ```graphql theme={null}
  {
    studentById(studentId: "33333333-3333-4333-8333-333333333333") {
      id fullName email role
      orders { id status createdOn closedOn amountNetCharge amountNetRevenue offerSnapshot { name } }
      freeClaims { id acquiredOn offerSnapshot { name } }
    }
  }
  ```
</RequestExample>

<ResponseExample>
  ```json Illustrative response theme={null}
  {
    "data": {
      "studentById": {
        "id": "33333333-3333-4333-8333-333333333333",
        "fullName": "Jamie Smith",
        "email": "student@example.com",
        "role": "student",
        "orders": [
          {
            "id": "55555555-5555-4555-8555-555555555555",
            "status": "succeeded",
            "createdOn": 1788220800000,
            "closedOn": 1788224400000,
            "amountNetCharge": 80.0,
            "amountNetRevenue": 80.0,
            "offerSnapshot": {
              "name": "Drawing Essentials"
            }
          }
        ],
        "freeClaims": [
          {
            "id": "44444444-4444-4444-8444-444444444444",
            "acquiredOn": 1788220800000,
            "offerSnapshot": {
              "name": "Drawing Essentials"
            }
          }
        ]
      }
    }
  }
  ```
</ResponseExample>

## Use the result

```javascript theme={null}
const student = response.data.studentById;
const rows = [
  ...student.orders
    .filter(order => ["succeeded", "refunded", "disputed"].includes(order.status))
    .map(order => ({
      kind: "order", id: order.id, date: order.closedOn, status: order.status,
      offer: order.offerSnapshot.name, amountCharged: order.amountNetCharge,
      retainedRevenue: order.amountNetRevenue
    })),
  ...student.freeClaims.map(claim => ({
    kind: "freeClaim", id: claim.id, date: claim.acquiredOn,
    offer: claim.offerSnapshot.name, amountCharged: 0, retainedRevenue: 0
  }))
].sort((a, b) => (b.date ?? 0) - (a.date ?? 0));
```

The report includes paid purchases and free Offer acquisitions. Direct Administrator grants appear in [access sources](/en/api/recipes/explain-course-access-sources). Offer names come from acquisition snapshots. Both nested lists are uncapped when no limit is supplied. The `role` field distinguishes Students from Administrators.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.