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

# Submitting Time Spent Data

Submitting time spent data involves the following sequence:

1. **Track** user time spent data
2. **Submit** the time using the `insertTimeSpentRecord` mutation

Since user time tracking is expected to be implemented on the client platform, we do not cover it in detail here. However, you can refer to our recommendations on the parent page.

To submit time spent data, execute the `insertTimeSpentRecord` mutation as shown below:

<CodeGroup>
  ```filename GraphQL theme={null}
  mutation insertTimeSpentRecord {
      insertTimeSpentRecord(timeSpentData: {
          lpAttemptContextId: 252,
          edgeRid: 154,
          spentTime: 20,
      }) {
          response
          errors
      }
  }
  ```

  ```File Query result theme={null}
  {
      "data": {
          "insertTimeSpentRecord": {
              "response": true,
              "errors": []
          }
      }
  }
  ```
</CodeGroup>

The response returned by the `insertTimeSpentRecord` mutation indicates whether the data was successfully stored (`true` or `false`).

### **⚠️ Prerequisites and Notes**

Please consider the following before submitting time spent data:

1. **Current User Restriction**\
   Time spent data can only be submitted for the current API user.
2. **Access Control**\
   Access to the `insertTimeSpentRecord` mutation is subject to access policies. See the schema description for full details.
3. \*\*Accumulation by \*\*`edgeRid`\
   Time is accumulated within the specified `edgeRid`.
   * Calling `insertTimeSpentRecord` multiple times with the same arguments will sum the durations for that activity.
   * This is important when choosing your implementation strategy:
     * **Periodic submission**: Submit only the time tracked **during the current period** (e.g., last 30 seconds). Avoid sending cumulative totals to prevent overcounting.
     * **Event-based submission**: Submit the full duration tracked up to the moment of the event.\
       The mutation can technically be called multiple times, but it's important that the \*\*same time segment is submitted only once \*\*— when the event is triggered — to avoid overcounting.
