POST/api/orgs/{org_id}/spend/activity

支出アクティビティを一覧表示

レポートの全フィルターを適用したリクエスト単位(または試行単位)の行で、next_cursorによるキーセットページングです。メタデータのみで、保存されたボディは含みません。include_features: trueの場合、レスポンスはソース別のページになります。APIキーにはプロビジョニング権限とscope: orgが必要です。

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

パスパラメーター

  • org_idstring必須

    お客様の組織ID(uuid)。GET /api/whoamiで取得できます。

リクエストボディ

  • queryobject必須

    範囲を限定したレポートのスライスです。endは含みません。範囲は最大10年です。新しく読み取る場合はas_ofとsnapshot_idを省略します。レスポンスはこれらを固定した値で返すので、以降の読み取り(ページネーション、ビュー、系列、ファセット、アクティビティ、エクスポート)ではそのまま送り返してください。これですべてのパネルが同じスナップショットを読み取ります。

    query
    • startstring必須

      開始(含む)、UTCオフセット付き。

    • endstring必須

      終了(含まない)、UTCオフセット付き。startより後である必要があります。

    • time_zonestring

      日単位と月単位のバケットに使うIANAタイムゾーン。

      既定値: "UTC"
    • scopeany
      既定値: "org"
    • basisany
      既定値: "requests"
    • group_byany
      既定値: "model"
    • tag_keystring | null

      group_byがtagの場合にのみ必須です。

      既定値: null
    • grainany
      既定値: "day"
    • filtersarray<object>

      ディメンションごとにフィルターは最大1つです。

      既定値: []
      filters
      • dimensionenum必須

        グループ化とフィルターのディメンション。keyとmemberの値はuuidです。tagはgroup_by専用(tag_keyと併用)で、タグでフィルターするにはtagsを使用します。

        "model""key""member""end_user""provider""funding""surface""outcome""error""app""prompt""tag""source"
      • valuesarray<string>
        既定値: []
      • missingboolean

        このディメンションに値がない呼び出しも一致させます。

        既定値: false
      • excludeboolean

        条件を反転します。JSONのブール値である必要があります。

        既定値: false
    • tagsarray<object>

      タグキーごとに条件は最大1つです。

      既定値: []
      tags
      • keystring必須
      • valuesarray<string>
        既定値: []
      • missingboolean

        このタグキーがない呼び出しも一致させます。

        既定値: false
      • excludeboolean
        既定値: false
    • sortany
      既定値: "spend"
    • directionenum
      "asc""desc"
      既定値: "desc"
    • offsetinteger
      既定値: 0
    • limitinteger
      既定値: 50
    • as_ofstring | null

      レポートの締め時刻。最初の読み取り時にサーバーが設定します。未来の時刻やstartより前にはなりません。

      既定値: null
    • snapshot_idstring

      登録済みのスナップショットトークン。元のas_ofが必要です。未設定の場合はレスポンスから省略されます。

  • cursorobject | null
    既定値: null
    いずれか

    object

    • timestring必須
    • idstring必須
  • errors_onlyboolean
    既定値: false
  • include_featuresboolean

    機能の料金(使用量インテリジェンスのレポート)もsource: intelligenceの行として返します。この場合、すべての行にsourceが付きます。

    既定値: false

レスポンス

  • 200

    OK

  • 400

    無効な支出クエリ、またはクエリにこのルートが必要とする固定済みスナップショットがありません。

    レスポンス
    • errorstring必須

      人が読めるメッセージ。

    • codestring

      エンドポイントが定義している場合の、安定した機械可読の理由(例:pro_required)。

    • actionstring

      エンドポイントが定義している場合の、安定した対処アクション。

    • detailsobject

      呼び出し元が対処するために必要な、顧客に提示して安全な文字列情報(推奨される識別子など)。

  • 401

    APIキーがない、不明、または失効しています。

    レスポンス
    • errorstring必須

      人が読めるメッセージ。

    • codestring

      エンドポイントが定義している場合の、安定した機械可読の理由(例:pro_required)。

    • actionstring

      エンドポイントが定義している場合の、安定した対処アクション。

    • detailsobject

      呼び出し元が対処するために必要な、顧客に提示して安全な文字列情報(推奨される識別子など)。

  • 403

    キーがプロビジョニングキーではない(推論キーは読み取りを含むすべての支出エンドポイントで拒否されます)か、顧客プランキーです。

    レスポンス
    • errorstring必須

      人が読めるメッセージ。

    • codestring

      エンドポイントが定義している場合の、安定した機械可読の理由(例:pro_required)。

    • actionstring

      エンドポイントが定義している場合の、安定した対処アクション。

    • detailsobject

      呼び出し元が対処するために必要な、顧客に提示して安全な文字列情報(推奨される識別子など)。

  • 404

    組織がキー自身の組織ではありません(常に404で、403にはなりません)。

    レスポンス
    • errorstring必須

      人が読めるメッセージ。

    • codestring

      エンドポイントが定義している場合の、安定した機械可読の理由(例:pro_required)。

    • actionstring

      エンドポイントが定義している場合の、安定した対処アクション。

    • detailsobject

      呼び出し元が対処するために必要な、顧客に提示して安全な文字列情報(推奨される識別子など)。

  • 409

    スナップショット(as_of + snapshot_id)の有効期限が切れた(24時間)か、無効化されました。更新して、すべての射影をまとめて置き換えてください。

    レスポンス
    • errorstring必須

      人が読めるメッセージ。

    • codestring

      エンドポイントが定義している場合の、安定した機械可読の理由(例:pro_required)。

    • actionstring

      エンドポイントが定義している場合の、安定した対処アクション。

    • detailsobject

      呼び出し元が対処するために必要な、顧客に提示して安全な文字列情報(推奨される識別子など)。

  • 422

    ボディがスキーマ検証に失敗した({detail:[...]})、またはレポートが処理上限を超えました(report_too_large、series_too_large、export_too_large)。

  • 503

    レポート機能が利用できない、初期化中、または上限付きの読み取りがタイムアウトしました。データが空という意味ではありません。再試行するか範囲を狭めてください。

    レスポンス
    • errorstring必須

      人が読めるメッセージ。

    • codestring

      エンドポイントが定義している場合の、安定した機械可読の理由(例:pro_required)。

    • actionstring

      エンドポイントが定義している場合の、安定した対処アクション。

    • detailsobject

      呼び出し元が対処するために必要な、顧客に提示して安全な文字列情報(推奨される識別子など)。

リクエスト

curl -X POST 'https://api.experientiallabs.ai/api/orgs/3f6c2a1e-8b7d-4c2a-9e51-6a0d4b2f7c10/spend/activity' \
  -H "Authorization: Bearer <YOUR_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
  "query": {
    "start": "2026-11-01T00:00:00Z",
    "end": "2026-11-08T00:00:00Z",
    "time_zone": "UTC",
    "scope": "org",
    "basis": "requests",
    "group_by": "model",
    "grain": "day",
    "filters": [],
    "tags": [],
    "sort": "spend",
    "direction": "desc",
    "offset": 0,
    "limit": 50,
    "as_of": "2026-11-19T14:02:11.418Z",
    "snapshot_id": "c1e7a4d2-5b3f-4e8a-9d61-2f0b7c3a9e45"
  },
  "cursor": null,
  "errors_only": false,
  "include_features": false
}'

レスポンス

{
  "query": {
    "start": "2026-11-01T00:00:00Z",
    "end": "2026-11-08T00:00:00Z",
    "time_zone": "UTC",
    "scope": "org",
    "basis": "requests",
    "group_by": "model",
    "grain": "day",
    "filters": [],
    "tags": [],
    "sort": "spend",
    "direction": "desc",
    "offset": 0,
    "limit": 50,
    "tag_key": null,
    "as_of": "2026-11-19T14:02:11.418Z",
    "snapshot_id": "c1e7a4d2-5b3f-4e8a-9d61-2f0b7c3a9e45"
  },
  "coverage": {
    "as_of": "2026-11-19T14:02:11.418Z",
    "projected_through": "2026-11-08T00:00:00Z",
    "complete": true,
    "pending_requests": 0,
    "includes_pre_admission_rejections": false
  },
  "rows": [
    {
      "id": "req_01JDX4K9T2V7",
      "request_id": "req_01JDX4K9T2V7",
      "created_at": "2026-11-03T09:41:07.212Z",
      "dimensions": {
        "model": "gpt-6-luna",
        "key": "00000000-0000-4000-8000-000000000001",
        "provider": "openai",
        "funding": "platform_funded",
        "surface": "chat",
        "outcome": "completed"
      },
      "tags": {
        "team": "search"
      },
      "figures": {
        "count": 1,
        "rejected_count": 0,
        "errors": 0,
        "input_tokens": 5120,
        "output_tokens": 418,
        "cached_input_tokens": 4096,
        "reasoning_tokens": 0,
        "paid_nano_usd": "2710000",
        "byok_nano_usd": "0",
        "free_nano_usd": "0",
        "unknown_usage_count": 0
      },
      "detail": {
        "model": "gpt-6-luna",
        "provider": "openai",
        "lane": "platform_funded",
        "api_key_id": "9b1e3f20-6a4c-4d8e-a2f7-0c5d8e1b3a64",
        "key_label": "Acme backend",
        "status": "completed",
        "attempt_count": 1,
        "pricing_known": true,
        "latency_ms": 2140,
        "ttft_ms": 388,
        "tools_used": [],
        "failure_class": null,
        "error_message": null,
        "prompt_group": "4f1c9a2e7b30",
        "conversation_group": null,
        "attribution_label": null,
        "usage_evidence": {
          "usage_source": "observed",
          "input_tokens": 5120,
          "output_tokens": 418,
          "cached_input_tokens": 4096,
          "reasoning_tokens": 0,
          "no_dispatch": false,
          "cache_write_input_tokens": 0
        }
      }
    }
  ],
  "next_cursor": {
    "time": "2026-11-03T09:41:07.212Z",
    "id": "req_01JDX4K9T2V7"
  }
}

https://api.experientiallabs.ai/api/orgs/3f6c2a1e-8b7d-4c2a-9e51-6a0d4b2f7c10/spend/activity