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

# Create Caliper Events

> Receives and processes Timeback events wrapped in an envelope. Events will be validated against the IMS Caliper Analytics specification and stored for further processing and analysis.



## OpenAPI

````yaml /openapi/beyond-ai/timeback-events-api.yaml post /caliper/event
openapi: 3.1.0
info:
  title: Timeback Events API
  version: 1.0.0
  description: >-
    # Documentation


    ## Overview


    The Timeback Profile extends the IMS Caliper Analytics® specification to
    enable precise tracking of student activities and time spent metrics in
    educational platforms. This profile provides specialized event types that
    capture educational engagement data in a format optimized for the Timeback
    platform.


    ## Why Use Timeback Profile?


    While the standard Caliper Analytics specification offers many generic event
    types, the Timeback Profile provides:


    - Event types specifically designed for the context of the Timeback platform
    APIs

    - Simplified structure for common educational platform analytics needs

    - Direct support for XP/rewards, time tracking, question metrics and others

    - Optimized integration with Timeback platform analytics (ETL)


    # Event Types


    The Timeback Profile currently supports two primary event types:


    ## 1. ActivityEvent


    Used to record student interaction with educational activities, including
    total questions answered, correct questions and so on...


    ### Example


    ```json

    {
      "id": "urn:uuid:c51570e4-f8ed-4c18-bb3a-dfe51b2cc594",
      "eventTime": "2024-04-24T14:12:00.000Z",
      "profile": "TimebackProfile",
      "type": "ActivityEvent",
      "actor": {
        "id": "https://api.alpha-1edtech.ai/ims/oneroster/rostering/v1p2/users/<userId>",
        "type": "TimebackUser",
        "email": "student.email@example.com"
      },
      "action": "Completed",
      "object": {
        "id": "https://api.alpha-1edtech.ai/ims/oneroster/rostering/v1p2/courses/component-resources/<sourcedId>",
        "type": "TimebackActivityContext",
        "subject": "Reading",
        "app": {
          "name": "PowerPath UI"
        },
        "activity": {
          "name": "Answered quiz"
        },
        "course": {
          "id": "https://api.alpha-1edtech.ai/ims/oneroster/rostering/v1p2/courses/<course-id>",
          "name": "Reading G3"
        },
        "process": false
      },
      "generated": {
        "id": "https://your-app-url.com/ims/metrics/collections/activity/1",
        "type": "TimebackActivityMetricsCollection",
        "items": [
          {
            "type": "totalQuestions",
            "value": 10
          },
          {
            "type": "correctQuestions",
            "value": 8
          },
          {
            "type": "xpEarned",
            "value": 100
          },
          {
            "type": "masteredUnits",
            "value": 2
          }
        ]
      }
    }

    ```


    ### Properties


    - **id**: (string _required_) Unique identifier for this event. Must be a
    UUID expressed as a URN `Pattern:^urn:uuid:(.*)$`

    - **eventTime**: (string _required_) ISO 8601 timestamp when the event
    occurred

    - **profile**: (string _required_) Always "TimebackProfile"

    - **type**: (string _required_) Always "ActivityEvent"

    - **actor**: (object _required_) The user performing the action (should
    always be a valid timeback user)
      - **id**: (string _required_) The OneRoster url representing the user (`https://api.alpha-1edtech.ai/ims/oneroster/rostering/v1p2/users/<userId>`)
      - **type**: (string _required_) Always "TimebackUser"
      - **email**: (string _required_) The current user email
    - **action**: (string _required_) The action that was performed by the user
    (for now we only support "Completed")

    - **object**: (object _required_) The activity being interacted with
    (TimebackActivityContext)
      - **id**: (string _required_) The unique URL that represents that lesson / activity. It should either be `https://api.alpha-1edtech.ai/ims/oneroster/rostering/v1p2/courses/component-resources/<sourcedId>` or the URL of the activity being tracked on the external app. If the app doesn't have an unique URL per activity, you might concatenate any unique identifier to the base URL.
      - **type**: (string _required_) Always "TimebackActivityContext"
      - **subject**": (string _required_) The subject of the course (Reading, Language, Vocabulary, Social Studies, Writing, Science, FastMath, Math, None)
      - **app**: (object) _only required for third-party apps_
        - **name**: (string) App name
      - **activity** (object)
        - **name**: (string) The title of the activity
      - **course**: (object _required_)
        - **id**: (string _required_) The OneRoster URL representing the course (`https://api.alpha-1edtech.ai/ims/oneroster/rostering/v1p2/courses/<course-id>`). Refer to the [Integration Guide](https://docs.google.com/document/d/1pqo0D2hpozv-OYom_-hRotLIm85S8vny2o1tUMh3wpU/edit?tab=t.7zbgofrooex2#heading=h.ihrw14h4ub2f) for instructions on retrieving the courses the student is currently enrolled in.
        - **name**: (string) The title of the course
      - **process**: (boolean) Default is false. A flag to identify if this Caliper event should be processed into an Assessment Result in OneRoster.
    - **generated**: (object _required_) The collection of metrics collected in
    the activity (TimebackActivityMetricsCollection)
      - **id**: (string _required_) The unique URN identifier representing this tracking action. This is not the same as `object.id` but could be derived from it.
      - **type**: (string _required_) Always "TimebackActivityMetricsCollection"
      - **attempt**: (integer) Default is 1. Use this along with `object.process = true` to guarantee a separate Assessment Result is written to OneRoster for the same user on the same activity. Repeated attempt numbers will overwrite the previous information.
      - **items**: (array _required_) The values you want to write in the analytics. Each entry is an object with type and value. The allowed types are: "totalQuestions", "correctQuestions", "xpEarned", and "masteredUnits".

    > [!warning]

    > The **process** property will create an Assessment Result on TimeBack. If
    you are already saving the result of the  activity/lesson on TimeBack and
    just want to record the student XP, you need to pass this property as false.


    > [!warning]

    > The course information(other than the id) passed to the event is used as a
    fallback if some field is not present in the TimeBack API. Keep in mind that
    the course on the API side should be considered the source of truth for the
    information on the reports.


    > [!caution]

    > The events **cannot** be modified after they have been sent. Make sure you
    are sending the correct information. If you send the wrong XP for a student,
    you can send another event with a negative XP to balance the student to the
    correct value. (e.g. if you send 10 XP wrongly and the student should only
    receive 5, you can send a new event with -5 XP)



    ## 2. TimeSpentEvent


    Used to record the time spent by the student in activities


    ### Example


    ```json

    {
      "id": "urn:uuid:c51570e4-f8ed-4c18-bb3a-dfe51b2cc594",
      "eventTime": "2024-04-24T14:12:00.000Z",
      "profile": "TimebackProfile",
      "type": "TimeSpentEvent",
      "actor": {
        "id": "https://api.alpha-1edtech.ai/ims/oneroster/rostering/v1p2/users/<userId>",
        "type": "TimebackUser",
        "email": "student.email@example.com"
      },
      "action": "SpentTime",
      "object": {
        "id": "https://api.alpha-1edtech.ai/ims/oneroster/rostering/v1p2/courses/component-resources/<sourcedId>",
        "type": "TimebackActivityContext",
        "subject": "Reading",
        "app": {
          "name": "PowerPath UI"
        },
        "activity": {
          "name": "Answered quiz"
        },
        "course": {
          "id": "https://api.alpha-1edtech.ai/ims/oneroster/rostering/v1p2/courses/<course-id>",
          "name": "Reading G3"
        }
      },
      "generated": {
        "id": "https://your-app-url.com/ims/metrics/collections/activity/1",
        "type": "TimebackTimeSpentMetricsCollection",
        "items": [
          {
            "type": "active",
            "value": 10 // in seconds
          },
          {
            "type": "waste",
            "value": 2, // in seconds
            "subType": "eating"
          },
          {
            "type": "inactive",
            "value": 2 // in seconds
          },
          {
            "type": "unknown",
            "value": 5 // in seconds
          },
          {
            "type": "anti-pattern",
            "value": 8 // in seconds
          }
        ]
      }
    }

    ```


    ### Required Properties


    - **id**: (string _required_) Unique identifier for this event. Must be a
    UUID expressed as a URN `Pattern:^urn:uuid:(.*)$`

    - **eventTime**: (string required) ISO 8601 timestamp when the event
    occurred

    - **profile**: (string _required_) Always "TimebackProfile"

    - **type**: (string _required_) Always "TimeSpentEvent"

    - **actor**: (object _required_) The user performing the action (should
    always be a valid timeback user)
      - **id**: (string _required_) The OneRoster URL representing the user (https://api.alpha-1edtech.ai/ims/oneroster/rostering/v1p2/users/<userId>)
      - **type**: (string _required_) Always "TimebackUser"
      - **email**: (string _required_) The current user email
    - **action**: (string _required_) The action that was performed by the user
    (for now we only support "SpentTime")

    - **object**: (object _required_) The activity being interacted with
    (TimebackActivityContext)
      - **id**: (string _required_) The unique URL that represents that lesson / activity. It should either be https://api.alpha-1edtech.ai/ims/oneroster/rostering/v1p2/courses/component-resources/<sourcedId> or the URL of the activity being tracked on the external app. If the app doesn't have an unique URL per activity, you might concatenate any unique identifier to the base URL.
      - **type**: (string _required_) Always "TimebackActivityContext"
      - **subject**: (string _required_) The subject of the course (Reading, Language, Vocabulary, Social Studies, Writing, Science, FastMath, Math, None)
      - **app**: (object) only required for third-party apps
        - **name**: (string) App name
      - **activity**: (object)
        - **name**: (string) The title of the activity
      - **course**: (object)
        - **id**: (string) The OneRoster URL representing the course (https://api.alpha-1edtech.ai/ims/oneroster/rostering/v1p2/courses/<course-id>). Refer to the Integration Guide for instructions on retrieving the courses the student is currently enrolled in.
        - **name**: (string) The title of the course
      - **generated**: (object _required_) The collection of timespent metrics collected in the activity
        - **id**: (string _required_) URL of the lesson/activity in your side.
        - **type**: (string _required_) Always "TimebackTimeSpentMetricsCollection"
        - **items**: (array _required_) The list of time metrics for the student in that activity
          - **type**: (enum _required_) One of the following: active, inactive, waste, unknown, anti-pattern.
          - **value**: (number _required_) time in seconds.
          - **subType**: (string) A more specific classification (e.g., "eating").


    All the values in the `generated.items` should be in seconds.


    # Examples


    In the event endpoints described in this documentation there are various
    examples

    of how to send these activity and time spent events.


    If your use-case isn't covered here please contact the timeback platform
    team.


    # Notes


    - Timeback/Oneroster Entities

      - If your app uses data (users, courses, resources, assessments...) from the Timeback platform APIs such as oneroster
      - it is useful (though not required) to send the "**id**" of the entities in the timeback events as the url in **oneroster** to get the information for the specific entity
      - Example: course (from oneroster) `https://api.alpha-1edtech.ai/ims/oneroster/rostering/v1p2/courses/<course-id-here>`

    - ActivityContext
      - In the activity context the "**course**" and "**activity**" fields are **optional**
      - You should provide them whenever possible and only leave them empty if you don't have access to this information.


    # Authentication


    ## Guide


    Most endpoints require authentication using the `Authorization: Bearer
    <token>` header.


    The token can be obtained with:


    ```

    curl -X POST
    https://prod-beyond-timeback-api-2-idp.auth.us-east-1.amazoncognito.com/oauth2/token
    \

    -H "Content-Type: application/x-www-form-urlencoded" \

    -d
    "grant_type=client_credentials&client_id=<your-client-id>&client_secret=<your-client-secret>"

    ```


    Use the correct IDP server depending on the environment you're using.


    IDP Server for this environment:

    ```text
      https://prod-beyond-timeback-api-2-idp.auth.us-east-1.amazoncognito.com
    ```


    Reach out to the platform team to get a client/secret pair for your
    application.
servers:
  - url: https://caliper.alpha-1edtech.ai
    description: Timeback Events API
security:
  - OAuth2: []
tags:
  - name: Caliper Events
    description: >-
      These are the endpoints to use when submitting and validating Caliper
      Events
paths:
  /caliper/event:
    post:
      tags:
        - Caliper Events
      summary: Create Caliper Events
      description: >-
        Receives and processes Timeback events wrapped in an envelope. Events
        will be validated against the IMS Caliper Analytics specification and
        stored for further processing and analysis.
      requestBody:
        description: The Caliper envelope containing events to process
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Envelope'
            examples:
              example1:
                summary: 1 - ActivityEvent - XP Earned
                description: >-
                  Example of a basic Timeback Activity event where the user
                  earns XP
                value:
                  sensor: https://alpharead.alpha.school
                  sendTime: <dynamic-timestamp>
                  dataVersion: http://purl.imsglobal.org/ctx/caliper/v1p2
                  data:
                    - id: urn:uuid:c51570e4-f8ed-4c18-bb3a-dfe51b2cc594
                      eventTime: '2024-04-24T14:12:00.000Z'
                      profile: TimebackProfile
                      type: ActivityEvent
                      actor:
                        id: >-
                          https://api.alpha-1edtech.ai/ims/oneroster/rostering/v1p2/users/<user-id>
                        type: TimebackUser
                        email: student.email@example.com
                      action: Completed
                      object:
                        id: >-
                          https://api.alpha-1edtech.ai/ims/oneroster/rostering/v1p2/courses/component-resources/<sourcedId>
                        type: TimebackActivityContext
                        subject: Reading
                        app:
                          name: PowerPath UI
                        activity:
                          name: Answered quiz
                        course:
                          id: >-
                            https://api.alpha-1edtech.ai/ims/oneroster/rostering/v1p2/courses/<course-id>
                          name: Reading G3
                      generated:
                        id: >-
                          https://your-app-url.com/ims/metrics/collections/activity/1
                        type: TimebackActivityMetricsCollection
                        items:
                          - type: xpEarned
                            value: 100
              example2:
                summary: 2 - ActivityEvent - Questions
                description: >-
                  Example of a basic Timeback Activity event where the user
                  answers questions
                value:
                  sensor: https://alpharead.alpha.school
                  sendTime: <dynamic-timestamp>
                  dataVersion: http://purl.imsglobal.org/ctx/caliper/v1p2
                  data:
                    - id: urn:uuid:c51570e4-f8ed-4c18-bb3a-dfe51b2cc594
                      eventTime: '2024-04-24T14:12:00.000Z'
                      profile: TimebackProfile
                      type: ActivityEvent
                      actor:
                        id: >-
                          https://api.alpha-1edtech.ai/ims/oneroster/rostering/v1p2/users/<userId>
                        type: TimebackUser
                        email: student.email@example.com
                      action: Completed
                      object:
                        id: >-
                          https://api.alpha-1edtech.ai/ims/oneroster/rostering/v1p2/courses/component-resources/<sourcedId>
                        type: TimebackActivityContext
                        subject: Reading
                        app:
                          name: PowerPath UI
                        activity:
                          id: >-
                            https://api.alpha-1edtech.ai/ims/oneroster/resources/v1p2/resources/<sourcedId>
                          name: PowerPath quiz
                        course:
                          id: >-
                            https://api.alpha-1edtech.ai/ims/oneroster/rostering/v1p2/courses/<course-id>
                          name: Reading G3
                      generated:
                        id: >-
                          https://your-app-url.com/ims/metrics/collections/activity/1
                        type: TimebackActivityMetricsCollection
                        items:
                          - type: totalQuestions
                            value: 10
                          - type: correctQuestions
                            value: 8
              example3:
                summary: 3 - ActivityEvent - Mastered Units
                description: >-
                  Example of a basic Timeback Activity event where the user
                  masters units
                value:
                  sensor: https://alpharead.alpha.school
                  sendTime: <dynamic-timestamp>
                  dataVersion: http://purl.imsglobal.org/ctx/caliper/v1p2
                  data:
                    - id: urn:uuid:c51570e4-f8ed-4c18-bb3a-dfe51b2cc594
                      eventTime: '2024-04-24T14:12:00.000Z'
                      profile: TimebackProfile
                      type: ActivityEvent
                      actor:
                        id: >-
                          https://api.alpha-1edtech.ai/ims/oneroster/rostering/v1p2/users/<userId>
                        type: TimebackUser
                        email: student.email@example.com
                      action: Completed
                      object:
                        id: >-
                          https://api.alpha-1edtech.ai/ims/oneroster/rostering/v1p2/courses/component-resources/<sourcedId>
                        type: TimebackActivityContext
                        subject: Reading
                        app:
                          name: PowerPath UI
                        activity:
                          id: >-
                            https://api.alpha-1edtech.ai/ims/oneroster/resources/v1p2/resources/<sourcedId>
                          name: PowerPath quiz
                        course:
                          id: >-
                            https://api.alpha-1edtech.ai/ims/oneroster/rostering/v1p2/courses/<course-id>
                          name: Reading G3
                      generated:
                        id: >-
                          https://your-app-url.com/ims/metrics/collections/activity/1
                        type: TimebackActivityMetricsCollection
                        items:
                          - type: masteredUnits
                            value: 2
              example4:
                summary: 4 - ActivityEvent - Slim
                description: >-
                  Example of a basic Timeback Activity event where the user
                  answers questions, some attributes such as course and activity
                  are ommited for brevity.
                value:
                  sensor: https://alpharead.alpha.school
                  sendTime: <dynamic-timestamp>
                  dataVersion: http://purl.imsglobal.org/ctx/caliper/v1p2
                  data:
                    - id: urn:uuid:c51570e4-f8ed-4c18-bb3a-dfe51b2cc594
                      eventTime: '2024-04-24T14:12:00.000Z'
                      profile: TimebackProfile
                      type: ActivityEvent
                      actor:
                        id: >-
                          https://api.alpha-1edtech.ai/ims/oneroster/rostering/v1p2/users/<userId>
                        type: TimebackUser
                        email: student.email@example.com
                      action: Completed
                      object:
                        id: >-
                          https://api.alpha-1edtech.ai/ims/oneroster/rostering/v1p2/courses/component-resources/<sourcedId>
                        type: TimebackActivityContext
                        subject: Reading
                        app:
                          name: PowerPath UI
                        activity:
                          name: Answered quiz
                        course:
                          id: >-
                            https://api.alpha-1edtech.ai/ims/oneroster/rostering/v1p2/courses/<course-id>
                          name: Reading G3
                      generated:
                        id: >-
                          https://your-app-url.com/ims/metrics/collections/activity/1
                        type: TimebackActivityMetricsCollection
                        items:
                          - type: totalQuestions
                            value: 10
                          - type: correctQuestions
                            value: 8
                          - type: xpEarned
                            value: 100
                          - type: masteredUnits
                            value: 2
              example5:
                summary: 5 - TimeSpentEvent - Active
                description: >-
                  Example of a basic Timeback TimeSpent event where the user
                  spent time on an activity
                value:
                  sensor: https://alpharead.alpha.school
                  sendTime: <dynamic-timestamp>
                  dataVersion: http://purl.imsglobal.org/ctx/caliper/v1p2
                  data:
                    - id: urn:uuid:c51570e4-f8ed-4c18-bb3a-dfe51b2cc594
                      eventTime: '2024-04-24T14:12:00.000Z'
                      profile: TimebackProfile
                      type: TimeSpentEvent
                      actor:
                        id: >-
                          https://api.alpha-1edtech.ai/ims/oneroster/rostering/v1p2/users/<userId>
                        type: TimebackUser
                        email: student.email@example.com
                      action: SpentTime
                      object:
                        id: >-
                          https://api.alpha-1edtech.ai/ims/oneroster/rostering/v1p2/courses/component-resources/<sourcedId>
                        type: TimebackActivityContext
                        subject: Reading
                        app:
                          name: PowerPath UI
                        activity:
                          name: Answered quiz
                        course:
                          id: >-
                            https://api.alpha-1edtech.ai/ims/oneroster/rostering/v1p2/courses/<course-id>
                          name: Reading G3
                      generated:
                        id: >-
                          https://your-app-url.com/ims/metrics/collections/activity/1
                        type: TimebackTimeSpentMetricsCollection
                        items:
                          - type: active
                            value: 10
              example6:
                summary: 6 - TimeSpentEvent - Inactive
                description: >-
                  Example of a basic Timeback TimeSpent event where the user was
                  inactive during the activity
                value:
                  sensor: https://alpharead.alpha.school
                  sendTime: <dynamic-timestamp>
                  dataVersion: http://purl.imsglobal.org/ctx/caliper/v1p2
                  data:
                    - id: urn:uuid:c51570e4-f8ed-4c18-bb3a-dfe51b2cc594
                      eventTime: '2024-04-24T14:12:00.000Z'
                      profile: TimebackProfile
                      type: TimeSpentEvent
                      actor:
                        id: >-
                          https://api.alpha-1edtech.ai/ims/oneroster/rostering/v1p2/users/<userId>
                        type: TimebackUser
                        email: student.email@example.com
                      action: SpentTime
                      object:
                        id: >-
                          https://api.alpha-1edtech.ai/ims/oneroster/rostering/v1p2/courses/component-resources/<sourcedId>
                        type: TimebackActivityContext
                        subject: Reading
                        app:
                          name: PowerPath UI
                        activity:
                          name: Answered quiz
                        course:
                          id: >-
                            https://api.alpha-1edtech.ai/ims/oneroster/rostering/v1p2/courses/<course-id>
                          name: Reading G3
                      generated:
                        id: >-
                          https://your-app-url.com/ims/metrics/collections/activity/1
                        type: TimebackTimeSpentMetricsCollection
                        items:
                          - type: inactive
                            value: 10
              example7:
                summary: 7 - TimeSpentEvent - Waste
                description: >-
                  Example of a basic Timeback TimeSpent event where the user
                  wasted time on an activity
                value:
                  sensor: https://alpharead.alpha.school
                  sendTime: <dynamic-timestamp>
                  dataVersion: http://purl.imsglobal.org/ctx/caliper/v1p2
                  data:
                    - id: urn:uuid:c51570e4-f8ed-4c18-bb3a-dfe51b2cc594
                      eventTime: '2024-04-24T14:12:00.000Z'
                      profile: TimebackProfile
                      type: TimeSpentEvent
                      actor:
                        id: >-
                          https://api.alpha-1edtech.ai/ims/oneroster/rostering/v1p2/users/<userId>
                        type: TimebackUser
                        email: student.email@example.com
                      action: SpentTime
                      object:
                        id: >-
                          https://api.alpha-1edtech.ai/ims/oneroster/rostering/v1p2/courses/component-resources/<sourcedId>
                        type: TimebackActivityContext
                        subject: Reading
                        app:
                          name: PowerPath UI
                        activity:
                          name: Answered quiz
                        course:
                          id: >-
                            https://api.alpha-1edtech.ai/ims/oneroster/rostering/v1p2/courses/<course-id>
                          name: Reading G3
                      generated:
                        id: >-
                          https://your-app-url.com/ims/metrics/collections/activity/1
                        type: TimebackTimeSpentMetricsCollection
                        items:
                          - type: waste
                            value: 10
                            subType: eating
              example8:
                summary: 8 - TimeSpentEvent - Slim
                description: >-
                  Example of a basic Timeback TimeSpent event where the user
                  spent time on an activity, 

                  some attributes such as course and activity are ommited for
                  brevity.
                value:
                  sensor: https://alpharead.alpha.school
                  sendTime: <dynamic-timestamp>
                  dataVersion: http://purl.imsglobal.org/ctx/caliper/v1p2
                  data:
                    - id: urn:uuid:c51570e4-f8ed-4c18-bb3a-dfe51b2cc594
                      eventTime: '2024-04-24T14:12:00.000Z'
                      profile: TimebackProfile
                      type: TimeSpentEvent
                      actor:
                        id: >-
                          https://api.alpha-1edtech.ai/ims/oneroster/rostering/v1p2/users/<userId>
                        type: TimebackUser
                        email: student.email@example.com
                      action: SpentTime
                      object:
                        id: >-
                          https://api.alpha-1edtech.ai/ims/oneroster/rostering/v1p2/courses/component-resources/<sourcedId>
                        type: TimebackActivityContext
                        subject: Reading
                        app:
                          name: PowerPath UI
                        activity:
                          name: Answered quiz
                        course:
                          id: >-
                            https://api.alpha-1edtech.ai/ims/oneroster/rostering/v1p2/courses/<course-id>
                          name: Reading G3
                      generated:
                        id: >-
                          https://your-app-url.com/ims/metrics/collections/activity/1
                        type: TimebackTimeSpentMetricsCollection
                        items:
                          - type: active
                            value: 10
                          - type: waste
                            value: 2
                            subType: eating
                          - type: inactive
                            value: 2
      responses:
        '200':
          description: The events were processed successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    const: success
                  message:
                    type: string
                  errors: {}
                required:
                  - status
                  - message
        '400':
          description: The request payload is invalid
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    const: error
                  message:
                    type: string
                  errors: {}
                required:
                  - status
                  - message
components:
  schemas:
    Envelope:
      type: object
      properties:
        sensor:
          type: string
          format: uri
          description: >-
            The sensor.id that uniquely identifies the Caliper Sensor. Should be
            in the form of an IRI
          example: https://example.edu/sensors/1
        sendTime:
          type: string
          format: date-time
          description: >-
            The time the data was sent, formatted as an ISO 8601 date and time
            in UTC
          example: '2023-08-15T14:12:00.000Z'
        dataVersion:
          type: string
          const: http://purl.imsglobal.org/ctx/caliper/v1p2
          description: >-
            The data format version. Indicates which version of the Caliper
            specification governs the form of the entities and events
          example: http://purl.imsglobal.org/ctx/caliper/v1p2
        data:
          type: array
          items:
            anyOf:
              - $ref: '#/components/schemas/Event'
              - $ref: '#/components/schemas/Entity'
          minItems: 1
          description: >-
            The data payload, consisting of an array where items are Caliper
            Events or Entities
          example:
            - id: urn:uuid:c51570e4-f8ed-4c18-bb3a-dfe51b2cc594
              type: Event
              actor: https://example.edu/users/554433
              action: Created
              object: >-
                https://example.edu/terms/201801/courses/7/sections/1/assignments/1
              eventTime: '2023-08-15T14:12:00.000Z'
      required:
        - sensor
        - sendTime
        - dataVersion
        - data
      description: |-
        # Envelope

        Represents a package containing events and entity data for ingestion
    Event:
      type: object
      properties:
        '@context':
          type: string
          format: uri
          default: http://purl.imsglobal.org/ctx/caliper/v1p2
          description: The context of the Caliper entity data
          example: http://purl.imsglobal.org/ctx/caliper/v1p2
        id:
          type: string
          pattern: ^urn:uuid:(.*)$
          description: Unique identifier for this event. Must be a UUID expressed as a URN
          example: urn:uuid:c51570e4-f8ed-4c18-bb3a-dfe51b2cc594
        type:
          type: string
          description: >-
            The type of this event. Must match the term specified in the Caliper
            information model
          example: Event
        actor:
          type:
            - string
            - object
          description: The agent who initiated the event
          example: https://example.edu/users/554433
        action:
          type: string
          description: The action or predicate that binds the actor to the object
          example: Created
        object:
          type:
            - string
            - object
          description: The object of the interaction
          example: https://example.edu/terms/201801/courses/7/sections/1/assignments/1
        eventTime:
          type: string
          format: date-time
          description: ISO 8601 datetime when this event occurred
          example: '2023-08-15T14:12:00.000Z'
        profile:
          allOf:
            - $ref: '#/components/schemas/AllProfiles'
          description: The profile that governs interpretation of this event
          example: AnnotationProfile
        edApp:
          type:
            - string
            - object
          description: The application context
          example: https://example.edu/apps/learning-management
        generated:
          type:
            - string
            - object
          description: Entity generated as a result of the interaction
          example: https://example.edu/users/554433/responses/1
        target:
          type:
            - string
            - object
          description: >-
            Entity that represents a particular segment or location within the
            object
          example: >-
            https://example.edu/terms/201801/courses/7/sections/1/assignments/1/items/1
        referrer:
          type:
            - string
            - object
          description: Entity that represents the referring context
          example: https://example.edu/terms/201801/courses/7/sections/1
        group:
          type:
            - string
            - object
          description: >-
            An Organization that represents the group context. Can be either a
            URI or an Organization entity object
          example:
            id: https://example.edu/terms/201801/courses/7/sections/1
            type: Organization
            extensions:
              info: other params should follow organization schema
        membership:
          type:
            - string
            - object
          description: >-
            The relationship between the action and the group in terms of roles
            and status
          example: https://example.edu/terms/201801/courses/7/sections/1/rosters/1
        session:
          type:
            - string
            - object
          description: The current user Session
          example: >-
            https://example.edu/sessions/1f6442a482de72ea6ad134943812bff564a76259
        federatedSession:
          type:
            - string
            - object
          description: >-
            If the Event occurs within the context of an LTI platform launch,
            the tool's LtiSession
          example: https://example.edu/lti-sessions/b533eb02823f31024765305dd3af7b5e
        extensions:
          type: object
          additionalProperties: {}
          description: Additional attributes not defined by the model
          example:
            customField: customValue
      required:
        - id
        - type
        - actor
        - action
        - object
        - eventTime
        - profile
      additionalProperties: false
      description: |-
        # Event

        Represents a Caliper Event that describes learning activities
    Entity:
      type: object
      properties:
        '@context':
          type: string
          format: uri
          default: http://purl.imsglobal.org/ctx/caliper/v1p2
          description: The context of the Caliper entity data
          example: http://purl.imsglobal.org/ctx/caliper/v1p2
        id:
          type: string
          format: uri
          description: >-
            The unique identifier for this entity. Must be a valid IRI and
            should be dereferenceable
          example: https://example.edu/entity/554433
        type:
          type: string
          description: >-
            The type of this entity. Must match the term specified in the
            Caliper information model
          example: Entity
        name:
          type: string
          description: A word or phrase by which the entity is known
          example: John Doe
        description:
          type: string
          description: A brief, written representation of the entity
          example: A student at Example University
        dateCreated:
          type: string
          format: date-time
          description: ISO 8601 datetime when this entity was created
          example: '2023-08-15T14:12:00.000Z'
        dateModified:
          type: string
          format: date-time
          description: ISO 8601 datetime when this entity was last modified
          example: '2023-08-15T14:12:00.000Z'
        extensions:
          type: object
          additionalProperties: {}
          description: Additional attributes not defined by the model
          example:
            customField: customValue
        otherIdentifiers:
          type: array
          items:
            type:
              - string
              - object
      required:
        - id
        - type
      additionalProperties: false
      description: >-
        # Entity


        Represents a generic Caliper Entity that participates in
        learning-related activities.

        Can be provided in an envelope for context.
    AllProfiles:
      type: string
      enum:
        - AnnotationProfile
        - AssessmentProfile
        - ToolUseProfile
        - GeneralProfile
        - FeedbackProfile
        - MediaProfile
        - SurveyProfile
        - ResourceManagementProfile
        - ForumProfile
        - AssignableProfile
        - GradingProfile
        - ReadingProfile
        - SessionProfile
        - SearchProfile
        - ToolLaunchProfile
        - TimebackProfile
      description: >-
        # Supported Profiles


        These are the profiles that this API currently supports.


        See the
        [specification](https://www.imsglobal.org/spec/caliper/v1p2#profiles-0)
        for a list of all profiles.
  securitySchemes:
    OAuth2:
      type: oauth2
      flows:
        clientCredentials:
          scopes:
            https://purl.imsglobal.org/spec/caliper/v1p1/scope/admin: Admin scope (can call all endpoints)
            https://purl.imsglobal.org/spec/caliper/v1p1/scope/webhook.create: Webhook create scope (can create and update webhooks)
            https://purl.imsglobal.org/spec/caliper/v1p1/scope/webhook.readonly: Webhook readonly scope (can read webhooks)
            https://purl.imsglobal.org/spec/caliper/v1p1/scope/event.create: Event create scope (can create events)
          tokenUrl: >-
            https://prod-beyond-timeback-api-2-idp.auth.us-east-1.amazoncognito.com/oauth2/token

````