POST/api/v1/usage/exports

Queue a bulk usage export for one key

Queues a gzip JSONL file of every settled request made with one key in a half-open UTC range of at most 30 days, within the past 30 days. Answers 202 with Location and Retry-After: 5; poll the job until completed. Idempotency-Key replays the same job; reusing it for a different body is 409. One export may be active per organization at a time (429).

認証: AuthorizationヘッダーにBearer形式のAPIキー

ヘッダー

  • Idempotency-Keystring

    1 to 128 characters. Repeating a create with the same key returns the same job.

リクエストボディ

  • api_key_idstring必須

    The key whose requests to export.

  • start_atstring必須

    Inclusive start, with timezone.

  • end_atstring必須

    Exclusive end, with timezone; at most 30 days after start_at.

  • formatenum
    "jsonl"
    デフォルト: "jsonl"

レスポンス

  • 202

    The export job, queued (or the existing job for a repeated Idempotency-Key).

    レスポンス
    • idstring
    • statusenum
      "queued""running""completed""failed""expired"
    • api_key_idstring
    • start_atstring
    • end_atstring
    • created_atstring
    • formatenum
      "jsonl"
    • compressionenum
      "gzip"
    • schema_versionenum
      1
    • snapshot_atstring | null
    • row_countinteger | null
    • byte_sizeinteger | null

      Compressed file size, bytes.

    • sha256string | null

      Hex SHA-256 of the file.

    • expires_atstring | null
    • error_codestring | null
  • 401

    Missing, unknown or revoked API key.

    レスポンス
    • errorstring必須

      Human-readable message.

    • codestring

      Stable machine reason, when the route defines one (for example pro_required).

    • actionstring

      Stable remediation action, when the route defines one.

    • detailsobject

      Customer-safe string facts the caller needs to act (for example a suggested identifier).

  • 404

    The key is not one of your organization's keys.

    レスポンス
    • errorstring必須

      Human-readable message.

    • codestring

      Stable machine reason, when the route defines one (for example pro_required).

    • actionstring

      Stable remediation action, when the route defines one.

    • detailsobject

      Customer-safe string facts the caller needs to act (for example a suggested identifier).

  • 409

    The Idempotency-Key was used for a different export.

    レスポンス
    • errorstring必須

      Human-readable message.

    • codestring

      Stable machine reason, when the route defines one (for example pro_required).

    • actionstring

      Stable remediation action, when the route defines one.

    • detailsobject

      Customer-safe string facts the caller needs to act (for example a suggested identifier).

  • 422

    Range reversed, empty, longer than 30 days, outside the past 30 days, or an unknown field.

    レスポンス
    • errorstring必須

      Human-readable message.

    • codestring

      Stable machine reason, when the route defines one (for example pro_required).

    • actionstring

      Stable remediation action, when the route defines one.

    • detailsobject

      Customer-safe string facts the caller needs to act (for example a suggested identifier).

  • 429

    Another export is already active for this organization; wait for it to finish.

    レスポンス
    • errorstring必須

      Human-readable message.

    • codestring

      Stable machine reason, when the route defines one (for example pro_required).

    • actionstring

      Stable remediation action, when the route defines one.

    • detailsobject

      Customer-safe string facts the caller needs to act (for example a suggested identifier).

  • 503

    Usage exports are unavailable on this deployment.

    レスポンス
    • errorstring必須

      Human-readable message.

    • codestring

      Stable machine reason, when the route defines one (for example pro_required).

    • actionstring

      Stable remediation action, when the route defines one.

    • detailsobject

      Customer-safe string facts the caller needs to act (for example a suggested identifier).

リクエスト

curl -X POST https://api.experientiallabs.ai/api/v1/usage/exports \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "api_key_id": "0b9d4f6e-2a1c-4e8b-9f37-5c6d2e1a8b40",
  "start_at": "2026-10-20T00:00:00Z",
  "end_at": "2026-11-19T00:00:00Z",
  "format": "jsonl"
}'

レスポンス

{
  "id": "6e2b9c14-7d3a-4f01-8b5e-2c9a1d7f4e63",
  "status": "queued",
  "api_key_id": "0b9d4f6e-2a1c-4e8b-9f37-5c6d2e1a8b40",
  "start_at": "2026-10-20T00:00:00Z",
  "end_at": "2026-11-19T00:00:00Z",
  "created_at": "2026-11-19T16:02:44.118Z",
  "format": "jsonl",
  "compression": "gzip",
  "schema_version": 1,
  "snapshot_at": null,
  "row_count": null,
  "byte_size": null,
  "sha256": null,
  "expires_at": null,
  "error_code": null
}

https://api.experientiallabs.ai/api/v1/usage/exports