> ## 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.

# Grant and check Course access

> Give an existing Student direct Course access and verify the grant.

Grant an existing Student access to an existing Course as a controlled Administrator action. This grants access directly, without registering a purchase or an Order.

Replace the email and Course ID below. Confirm the returned account is the intended Student and that the Course is correct.

## Request

```graphql theme={null}
{
  students(email: { equals: "student@example.com" }) {
    id fullName email role coursesOwned { id name }
  }
  courseById(courseId: "22222222-2222-4222-8222-222222222222") { id name status }
}
```

```json Illustrative response theme={null}
{
  "data": {
    "students": [
      {
        "id": "33333333-3333-4333-8333-333333333333",
        "fullName": "Jamie Smith",
        "email": "student@example.com",
        "role": "student",
        "coursesOwned": []
      }
    ],
    "courseById": {
      "id": "22222222-2222-4222-8222-222222222222",
      "name": "Drawing Essentials",
      "status": "published"
    }
  }
}
```

If the Course already appears in `coursesOwned`, keep the existing access and stop. Otherwise, use the returned Student ID:

## Grant access

```graphql theme={null}
mutation {
  grantCourseOwnershipToStudent(courseId: "22222222-2222-4222-8222-222222222222", studentId: "33333333-3333-4333-8333-333333333333")
}
```

```json Illustrative response theme={null}
{
  "data": {
    "grantCourseOwnershipToStudent": "OK"
  }
}
```

The mutation returns `"OK"`. Read the Student’s current access to confirm the grant:

## Check access

```graphql theme={null}
{
  studentById(studentId: "33333333-3333-4333-8333-333333333333") {
    id coursesOwned { id name ownershipGrantSources { sourceName grantedOn } }
  }
}
```

```json Illustrative response theme={null}
{
  "data": {
    "studentById": {
      "id": "33333333-3333-4333-8333-333333333333",
      "coursesOwned": [
        {
          "id": "22222222-2222-4222-8222-222222222222",
          "name": "Drawing Essentials",
          "ownershipGrantSources": [
            {
              "sourceName": "administrator",
              "grantedOn": 1788220800000
            }
          ]
        }
      ]
    }
  }
}
```

Select the Course by `id`. A source named `administrator` records the direct grant; other sources may also provide access. After a timeout or unclear result, read the access sources before retrying: a repeated direct grant can fail. This workflow covers controlled Administrator grants; automated external-checkout callbacks need separate retry handling.


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