> ## Documentation Index
> Fetch the complete documentation index at: https://docs.opigno.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Calendar Events

> Retrieve calendar events for authenticated users with date range filtering, pagination, and sorting capabilities

The `getCalendarEvents` query allows you to retrieve calendar events for authenticated users. This endpoint returns both user-specific personal events and publicly accessible events that are visible to all authenticated (non-anonymous) users.

<Info>
  * You must have `AUTHENTICATED` scope to access calendar events. Anonymous users cannot retrieve calendar data.
  * The request should contains а valid date(s) boundary for calendar events collection.
  * The API user context must be present and valid - otherwise, access is denied.
</Info>

The following arguments can be used in the query:

| Argument   | Type                | Description                                                                                                                              |
| :--------- | :------------------ | :--------------------------------------------------------------------------------------------------------------------------------------- |
| `fromDate` | `DateTime`          | **Required**. The beginning boundary of calendar events date range. Date should be compliant to ISO 8601.                                |
| `toDate`   | `DateTime`          | The ending boundary of calendar events date range. Date should be compliant to ISO 8601.                                                 |
| `type`     | `CalendarEventType` | Returns results that come after the specified cursor. Should be used together with `first` parameter. Cannot be used if `before` is set. |
| `after`    | `Cursor`            | Returns the elements that come before the specified cursor.                                                                              |
| `before`   | `Cursor`            | Returns results that come before the specified cursor. Should be used together with `last` parameter. Cannot be used if `after` is set.  |
| `first`    | `Integer`           | Returns up to the first N elements from the list. Required if `after` parameter is set. Cannot be used together with `last`.             |
| `last`     | `Integer`           | Returns up to the first N elements from the list. Required if `before` parameter is set. Cannot be used together with `first`.           |

## Available CalendarEvents

The API includes an automatic calendar events generation according to next actions:

* Scheduled Live session
* Available Live session spots of Live Session Bucket, that relates to started Training

<Note>
  **Note:** Additional event variations will be made available through the API in future updates.
</Note>

## Examples

### Basic Calendar Events Query

<CodeGroup>
  ```graphql GraphQL Query theme={null}
  query getCalendarEvents {
    getCalendarEvents(
      first: 5,
      fromDate: "2025-07-01T00:00:00",
      toDate: "2025-12-31T23:59:59"
    ) {
      edges {
        node {
          id
          type
          label
          description
          location
          startDatetime
          endDatetime
        }
      }
      pageInfo {
        hasNextPage
        startCursor
        endCursor
      }
    }
  }
  ```

  ```json Response theme={null}
  {
    "data": {
      "getCalendarEvents": {
        "edges": [
          {
            "node": {
              "id": "4",
              "type": "PERSONAL",
              "label": "Soft skills training",
              "description": null,
              "location": "Chodovská 1430/3a, 141 00 Praha 4, Czechia",
              "startDatetime": "2025-07-03T14:00:00",
              "endDatetime": "2025-07-03T18:20:00"
            }
          },
          {
            "node": {
              "id": "11",
              "type": "PERSONAL",
              "label": "Coaching session",
              "description": "Coaching session at zoom",
              "location": "https://zoom.us/j/94396010301",
              "startDatetime": "2025-07-04T15:55:00",
              "endDatetime": "2025-07-04T16:55:00"
            }
          },
          {
            "node": {
              "id": "13",
              "type": "PUBLIC",
              "label": "Global Forgiveness Day",
              "description": "The day serves as an annual reminder that peace often begins with small personal acts of forgiveness.",
              "location": null,
              "startDatetime": "2025-07-07T12:00:00",
              "endDatetime": "2025-07-07T16:30:00"
            }
          }
        ],
        "pageInfo": {
          "hasNextPage": true,
          "startCursor": "TzozMzoiRHJ1cGFsXG9waWdub19hcGlcV3JhcHBlcnNcQ3Vyc29yIjo0OntzOjE0OiIAKgBiYWNraW5nVHlwZSI7czoyMToib3BpZ25vX2NhbGVuZGFyX2V2ZW50IjtzOjEyOiIAKgBiYWNraW5nSWQiO2k6NDtzOjEwOiIAKgBzb3J0S2V5IjtzOjE0OiJzdGFydF9kYXRldGltZSI7czoxMjoiACoAc29ydFZhbHVlIjtzOjIzOiIyMDI0LTA3LTAzIDE3OjIwOjAwIFVUQyI7fQ==",
          "endCursor": "TzozMzoiRHJ1cGFsXG9waWdub19hcGlcV3JhcHBlcnNcQ3Vyc29yIjo0OntzOjE0OiIAKgBiYWNraW5nVHlwZSI7czoyMToib3BpZ25vX2NhbGVuZGFyX2V2ZW50IjtzOjEyOiIAKgBiYWNraW5nSWQiO2k6MTE7czoxMDoiACoAc29ydEtleSI7czoxNDoic3RhcnRfZGF0ZXRpbWUiO3M6MTI6IgAqAHNvcnRWYWx1ZSI7czoyMzoiMjAyNC0wNy0wNCAyMDozMTowMCBVVEMiO30="
        }
      }
    }
  }
  ```
</CodeGroup>

### Calendar events CTA

Calendar events may include dedicated **Call to Action (CTA)** objects that define the actions available to the current user, such as registering for a Live Session.

<CodeGroup>
  ```graphql GraphQL Query theme={null}
  query getCalendarEvents {
    getCalendarEvents(first: 3, fromDate: "2025-07-09T00:00:00", toDate: "2025-07-09T23:59:59") {
      edges {
        node {
          id
          type
          label
          startDatetime
          endDatetime
          cta {
            title
            actionId
            arguments {
              key
              value
            }
            metadata {
              key
              value
            }
          }
        }
      }
    }
  }
  ```

  ```json Response theme={null}
  {
    "data": {
      "getCalendarEvents": {
        "edges": [
          {
            "node": {
              "id": "18",
              "type": "PERSONAL",
              "label": "Assessments review session",
              "startDatetime": "2025-07-09T17:00:00",
              "endDatetime": "2025-07-09T18:00:00",
              "cta": [
                {
                  "title": "Register",
                  "actionId": "REGISTER_TO_LIVE_SESSION",
                  "arguments": [
                    {
                      "key": "liveSessionId",
                      "value": "39"
                    }
                  ],
                  "metadata": [
                    {
                      "key": "type",
                      "value": "button"
                    }
                  ]
                }
              ]
            }
          }
        ]
      }
    }
  }
  ```
</CodeGroup>

The Call to Action (CTA) object in the example above represents an available action for the calendar event within the currently authenticated user context.
This action can be executed via a separate mutation call to register the user for the associated live session:

<CodeGroup>
  ```graphql GraphQL Query theme={null}
  mutation registerToLiveSession {
    registerToLiveSession(liveSessionId: 39) {
      errors
      response {
        id
      }
    }
  }
  ```

  ```json Response theme={null}
  {
    "data": {
      "registerToLiveSession": {
        "errors": [],
        "response": {
          "id": "8"
        }
      }
    }
  }
  ```
</CodeGroup>

Calendar events may also include bookmark CTAs with action ID `TOGGLE_BOOKMARK` that allow users to bookmark/unbookmark events.

### Filtering by Event Type

<CodeGroup>
  ```graphql GraphQL Query theme={null}
  query getPublicEvents {
    getCalendarEvents(
      first: 10,
      fromDate: "2025-07-01T00:00:00",
      toDate: "2025-12-31T23:59:59",
      type: PUBLIC
    ) {
      edges {
        node {
          id
          type
          label
          description
          startDatetime
          endDatetime
        }
      }
    }
  }
  ```

  ```json Response theme={null}
  {
    "data": {
      "getCalendarEvents": {
        "edges": [
          {
            "node": {
              "id": "13",
              "type": "PUBLIC",
              "label": "Global Forgiveness Day",
              "description": "The day serves as an annual reminder that peace often begins with small personal acts of forgiveness.",
              "location": null,
              "startDatetime": "2025-07-07T12:00:00",
              "endDatetime": "2025-07-07T16:30:00"
            }
          },
          {
            "node": {
              "id": "15",
              "type": "PUBLIC",
              "label": "Team Building Workshop",
              "description": "Annual team building event for all employees",
              "location": "Main Conference Hall",
              "startDatetime": "2025-08-15T09:00:00",
              "endDatetime": "2025-08-15T17:00:00"
            }
          }
        ]
      }
    }
  }
  ```
</CodeGroup>

### Pagination Example

<CodeGroup>
  ```graphql GraphQL Query theme={null}
  query getCalendarEventsPaginated {
    getCalendarEvents(
      first: 3,
      fromDate: "2025-07-01T00:00:00",
      toDate: "2025-12-31T23:59:59",
      after: "TzozMzoiRHJ1cGFsXG9waWdub19hcGlcV3JhcHBlcnNcQ3Vyc29yIjo0OntzOjE0OiIAKgBiYWNraW5nVHlwZSI7czoyMToib3BpZ25vX2NhbGVuZGFyX2V2ZW50IjtzOjEyOiIAKgBiYWNraW5nSWQiO2k6NDtzOjEwOiIAKgBzb3J0S2V5IjtzOjE0OiJzdGFydF9kYXRldGltZSI7czoxMjoiACoAc29ydFZhbHVlIjtzOjIzOiIyMDI0LTA3LTAzIDE3OjIwOjAwIFVUQyI7fQ=="
    ) {
      edges {
        node {
          id
          label
          startDatetime
          endDatetime
        }
      }
      pageInfo {
        hasNextPage
        hasPreviousPage
        startCursor
        endCursor
      }
    }
  }
  ```

  ```json Response theme={null}
  {
    "data": {
      "getCalendarEvents": {
        "edges": [
          {
            "node": {
              "id": "14",
              "label": "Coaching session",
              "startDatetime": "2025-07-08T10:30:00",
              "endDatetime": "2025-07-08T14:00:00"
            }
          },
          {
            "node": {
              "id": "16",
              "label": "Coaching session",
              "startDatetime": "2025-07-08T15:00:00",
              "endDatetime": "2025-07-08T18:30:00"
            }
          },
          {
            "node": {
              "id": "17",
              "label": "Product Review Meeting",
              "startDatetime": "2025-07-09T11:00:00",
              "endDatetime": "2025-07-09T12:30:00"
            }
          }
        ],
        "pageInfo": {
          "hasNextPage": true,
          "hasPreviousPage": true,
          "startCursor": "TzozMzoiRHJ1cGFsXG9waWdub19hcGlcV3JhcHBlcnNcQ3Vyc29yIjo0OntzOjE0OiIAKgBiYWNraW5nVHlwZSI7czoyMToib3BpZ25vX2NhbGVuZGFyX2V2ZW50IjtzOjEyOiIAKgBiYWNraW5nSWQiO2k6MTQ7czoxMDoiACoAc29ydEtleSI7czoxNDoic3RhcnRfZGF0ZXRpbWUiO3M6MTI6IgAqAHNvcnRWYWx1ZSI7czoyMzoiMjAyNC0wNy0wOCAxNDowMDowMCBVVEMiO30=",
          "endCursor": "TzozMzoiRHJ1cGFsXG9waWdub19hcGlcV3JhcHBlcnNcQ3Vyc29yIjo0OntzOjE0OiIAKgBiYWNraW5nVHlwZSI7czoyMToib3BpZ25vX2NhbGVuZGFyX2V2ZW50IjtzOjEyOiIAKgBiYWNraW5nSWQiO2k6MTc7czoxMDoiACoAc29ydEtleSI7czoxNDoic3RhcnRfZGF0ZXRpbWUiO3M6MTI6IgAqAHNvcnRWYWx1ZSI7czoyMzoiMjAyNC0wNy0wOSAxMjozMDowMCBVVEMiO30="
        }
      }
    }
  }
  ```
</CodeGroup>

## Related Features

The `getCalendarEvents` query supports the same advanced features as other catalog queries:

<CardGroup cols={2}>
  <Card title="Pagination" icon="arrow-right" href="/OpignoEnterpriseAPI/PaginatingCatalogItems">
    Learn how to efficiently navigate through large sets of calendar events using cursor-based pagination.
  </Card>

  <Card title="Authentication" icon="key" href="/OpignoEnterpriseAPI/ConsumerUserAuthentication">
    Understand the authentication requirements and how to properly authenticate your requests.
  </Card>
</CardGroup>

## Error Handling

<Warning>
  If you don't provide a `fromDate` parameter, the query will return an error. Always specify a date range for optimal performance.
</Warning>

Common error scenarios and solutions:

<AccordionGroup>
  <Accordion title="Authentication Errors">
    * **401 Unauthorized**: Ensure you're using a valid authentication token with `AUTHENTICATED` scope
    * **403 Forbidden**: Verify your user account has the necessary permissions to access calendar data
  </Accordion>

  <Accordion title="Date Format Errors">
    * **Invalid date format**: Use ISO 8601 format (e.g., "2025-07-01T00:00:00Z")
    * **Invalid date range**: Ensure `fromDate` is before `toDate`
    * **Future dates only**: Some implementations may restrict access to events in the distant future
  </Accordion>

  <Accordion title="Pagination Errors">
    * **Missing cursor parameter**: When using `after`, you must also specify `first`
    * **Invalid cursor**: Ensure cursor values are valid and not expired
    * **Conflicting parameters**: Don't use both `first`/`after` and `last`/`before` together
  </Accordion>
</AccordionGroup>

<Note>
  Calendar events are cached for performance. If you don't see recently added events, wait a few minutes for the cache to refresh, or contact support if the issue persists.
</Note>
