---
title: "Import integration statistics"
method: POST
path: "/api/v2/bulk/integrations/{integrationId}/stats"
tags: ["Integrations"]
---

# Import integration statistics

`POST /api/v2/bulk/integrations/{integrationId}/stats`

> 🔑
>
> Required OAuth scope: `integrations:bulk`.

> 🚜
>
> This endpoint processes up to 10,000 objects asynchronously. For more information, see the [Bulk operations guide](https://360learning.readme.io/docs/bulk-operations-1).

Imports multiple integration statistics in bulk based on the provided `integrationId`.
This endpoint will:
- Create a new attempt if any of the following is true: `forceNew` is set to `true`; no attempt currently exists for the course and user; or `firstActivityAt` is later than the `lastActivityAt` or `completedAt` of all existing attempts.
- Update existing non-completed attempts if `firstActivityAt` is earlier than the `lastActivityAt` or `completedAt` of those attempts.

Upon submission, the request is queued. Use the provided URL in the response header to check the status of the bulk operation.

## Path parameters

- `integrationId` string, ObjectId, required

## Headers

- `360-api-version` 'v2.0', required

## Request body

- ImportExternalStatisticsBody
  - `input` ImportExternalStatisticsDTO[], required — An array of objects, each specifying details for external statistics to be imported.
    - `courseIdentifier` CourseIdentifierDTO, required
      - `type` 'externalId' | 'internalId', required — Type of course identifier. `externalId`: identifier used on the external platform. `internalId`: internal identifier used on 360Learning platform.
      - `value` string, required — Value of the course identifier given the type provided.
    - `forceNew` boolean — Determine whether the statistics should force the creation of a new attempt (`true`) or update any existing one based on the couple `(courseIdentifier.value, userIdentifier.value)` (`false`). Default to `false`.
    - `userIdentifier` UserIdentifierDTO, required
      - `type` 'mail' | 'internalId', required — Type of user identifier. `mail`: learner mail. `internalId`: learner internal identifier used on 360Learning platform.
      - `value` string, required — Value of the user identifier given the type provided.
    - `lang` 'bg' | 'cs' | 'da' | 'de' | 'el' | 'en' | 'es' | 'fi' | 'fr' | 'hr' | 'ht_HT' | 'hu' | 'id' | 'it' | 'ja' | 'kar_MM' | 'ko' | 'lt' | 'mh_MH' | 'nl' | 'nl_BE' | 'no' | 'pl' | 'pt' | 'ro' | 'ru' | 'rw_RW' | 'sk' | 'sl' | 'so_SO' | 'sv' | 'sw_KE' | 'th' | 'ti_ET' | 'tr' | 'uk' | 'zh' | 'am_ET' | 'bn' | 'bs' | 'ca' | 'cy' | 'en_CA' | 'en_GB' | 'es_AR' | 'es_MX' | 'et' | 'fr_CA' | 'gu' | 'he_IL' | 'hy' | 'kk' | 'km' | 'lo' | 'lv' | 'mi' | 'mn_MN' | 'mr' | 'ms' | 'my_MM' | 'nn_NO' | 'or' | 'pa' | 'pt_BR' | 'pt_MZ' | 'rn_BI' | 'si' | 'ta' | 'te' | 'tl_PH' | 'ur' | 'uz' | 'yo_NG' | 'zh_tw' | 'el' | 'hi' | 'sr' | 'ar' | 'vi' | 'zh_HANT' — The language in which the learner played the course.
    - `progress` number, required — The progress percentage of the learner, expressed as an integer (0-100).
    - `score` number — The score (0-100) of the learner for the external course.
    - `result` 'success' | 'failed' — The result of the learner on the course: `failed` or `success`.
    - `timeSpent` number, required — The total time in milliseconds the learner spent playing the external course.
    - `firstActivityAt` string, date-time, required — The date when the learner first interacted with the external course, expressed in ISO 8601 format.
    - `lastActivityAt` string, date-time, required — The date when the learner last interacted with the external course, expressed in ISO 8601 format. If progress is set to 100%, this will be the completion date of the course.

## Response `202`

The operation is successfully created.

## Other responses

- `400` — The server cannot or will not process the request due to something that is perceived to be a client error.
- `401` — The given access token is either missing, invalid, has expired, or has been revoked.
- `403` — The given access token does not have the required OAuth scope to execute the request.
- `404` — The given `integrationId` does not correspond to any existing integration.
- `429` — The maximum number of concurrent operations has been reached.
- `503` — The bulk API is temporarily disabled.

---

[API](https://skmtc.dev/360learning/apis/core-api.md) · [All operations](https://skmtc.dev/360learning/apis/core-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/360learning/core-api/revisions/94b691b0b72c/schema)
