Export Assistant Usage

This endpoint exports assistant usage data including message counts per assistant, active user counts, and usage trends over time.

cURL
curl --request POST \
  --url https://api.langdock.com/export/assistants \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "from": {
    "date": "2024-01-01T00:00:00.000Z",
    "timezone": "UTC"
  },
  "to": {
    "date": "2024-01-31T23:59:59.999Z",
    "timezone": "UTC"
  }
}
'
Example successful response (200)
{
  "success": true,
  "data": {
    "filePath": "assistants-usage/workspace-id/assistants-usage-2024-01-01-2024-01-31-abc12345.csv",
    "downloadUrl": "https://storage.example.com/signed-url",
    "dataType": "assistants",
    "recordCount": 1250,
    "dateRange": {
      "from": "2024-01-01T00:00:00.000Z",
      "to": "2024-01-31T23:59:59.999Z"
    }
  }
}

Data included

The assistant export contains:

  • Number of messages per assistant

  • Active users per assistant

  • Usage trends over time

  • Assistant configuration details

  • Performance metrics

chevron-rightAdditional informationhashtag

For details on prerequisites, rate limits, and export size limits, please refer to the main Usage Export API documentation.

Endpoint

POST /export/assistants

Headers

  • Authorization (string, required)

    • API key as Bearer token with USAGE_EXPORT_API scope. Format: "Bearer YOUR_API_KEY"

  • Content-Type: application/json

circle-info

Include the Authorization header with a Bearer token that has the USAGE_EXPORT_API scope.

Body (application/json)

Request body for usage export endpoints.

  • from (object, required) — Start date and timezone for the export

    • from.date (string, required) — Start date in ISO 8601 format. Example: "2024-01-01T00:00:00.000Z"

    • from.timezone (string, required) — Timezone for the date range. Example: "UTC"

  • to (object, required) — End date and timezone for the export

    • to.date (string, required) — End date in ISO 8601 format. Example: "2024-01-31T23:59:59.999Z"

    • to.timezone (string, required) — Timezone for the date range. Example: "UTC"

Responses

  • 200 application/json — Export successful

Response schema (successful response):

  • success (boolean, required) — Indicates if the export was successful. Example: true

  • data (object, required) — Export data information

    • data.filePath (string, required) — Path to the generated export file. Example: "assistants-usage/workspace-id/assistants-usage-2024-01-01-2024-01-31-abc12345.csv"

    • data.downloadUrl (string, required) — Signed URL to download the export file. Example: "https://storage.example.com/signed-url"

    • data.dataType (enum, required) — Type of data exported. Available options: assistants, users, workflows, projects, models. Example: "assistants"

    • data.recordCount (integer, required) — Number of records in the export. Example: 1250

    • data.dateRange (object, required) — Actual date range of the exported data

      • data.dateRange.from (string, required) — Start date of the export. Example: "2024-01-01T00:00:00.000Z"

      • data.dateRange.to (string, required) — End date of the export. Example: "2024-01-31T23:59:59.999Z"

  • Export User Usage: https://docs.langdock.com/api-endpoints/usage-export/export-users

  • Export Workflow Usage: https://docs.langdock.com/api-endpoints/usage-export/export-workflows