> For the complete documentation index, see [llms.txt](https://docs.uptiq.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.uptiq.ai/cookbooks/platform-admin/agents-and-evidence/export-activity-for-review.md).

# Export activity data

No single export call — pull each dataset's own endpoint and assemble the file yourself.

There's no API equivalent of the UI's **Export** feature as a whole — no single call that takes a dataset list, a schedule, and an email or webhook delivery the way [Export activity data](https://docs.uptiq.ai/platform-guides/admin/agents-and-evidence/export-activity-data) does. What exists instead is a `GET` endpoint per dataset; you fetch each one and assemble the file your reviewer needs yourself, and handle delivery and scheduling in your own systems.

## At a glance

| Item               | Value                                                |
| ------------------ | ---------------------------------------------------- |
| ⚙️ Feature         | Activity data export                                 |
| 🌍 Environment     | `QA`                                                 |
| ⌘ API endpoint     | One `GET` endpoint per dataset                       |
| ✅ Supported method | Fetch datasets and assemble delivery in your systems |

{% columns %}
{% column %}

#### What you can do

Fetch individual datasets for a custom export workflow.
{% endcolumn %}

{% column %}

#### What isn't available

No API provides combined, scheduled, or delivered exports.
{% endcolumn %}
{% endcolumns %}

{% hint style="info" %}
**Most datasets have a real source. One doesn't.** Five of the UI task's seven datasets map to a genuine endpoint below. **Audit Trails does not** — see [Review the audit trail](/cookbooks/platform-admin/agents-and-evidence/show-who-changed-what.md) for why, and don't substitute `/audit-logs/export` for it; that exports HTTP traffic logs, a different feature entirely.
{% endhint %}

## Before you start

Your API key needs read access to whichever datasets you're pulling — permissions vary per service; see each linked recipe.

## Dataset sources

| UI dataset         | Endpoint                                                                                                                              | Recipe                                                                                           |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
| Credit Usage       | `GET /accounts/credits/{balance,history,usage/trends,usage/top-consumers}`                                                            | [Review credit usage](/cookbooks/platform-admin/cost/find-what-used-credits.md)                  |
| AI Gateway Logs    | `GET /audit-logs/ai-gateway`                                                                                                          | —                                                                                                |
| Platform Analytics | `GET /platform-analytics-events/records`, `/counts` — **`eventName` is required**; without it the call returns `400 VALIDATION_ERROR` | —                                                                                                |
| App Analytics      | `GET /projects/analytics`, `/projects/{id}/analytics`                                                                                 | —                                                                                                |
| Agent Analytics    | `GET /agents/analytics/stats`, `/by-agent`, `/execution-stats`                                                                        | —                                                                                                |
| Eval Results       | `GET /agents/{agentId}/eval/runs` — evaluation runs, not a dedicated export                                                           | —                                                                                                |
| **Audit Trails**   | **None.**                                                                                                                             | [Review the audit trail](/cookbooks/platform-admin/agents-and-evidence/show-who-changed-what.md) |

## Worked example — AI Gateway Logs

## Code snippets

{% tabs %}
{% tab title="cURL" %}

```bash
curl "https://api-builder-qa.uptiq.dev/identity-hub/audit-logs/ai-gateway?from=2026-09-01&to=2026-09-21" \
  -H "x-platform-key: YOUR_API_KEY" \
  -H "accountid: YOUR_ACCOUNT_ID"
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const res = await fetch(
  "https://api-builder-qa.uptiq.dev/identity-hub/audit-logs/ai-gateway?from=2026-09-01&to=2026-09-21",
  {
    headers: {
      "x-platform-key": process.env.UPTIQ_API_KEY,
      accountid: process.env.UPTIQ_ACCOUNT_ID,
    },
  }
);
const { data } = await res.json();
```

{% endtab %}

{% tab title="Python" %}

```python
import os, requests

res = requests.get(
    "https://api-builder-qa.uptiq.dev/identity-hub/audit-logs/ai-gateway",
    params={"from": "2026-09-01", "to": "2026-09-21"},
    headers={
        "x-platform-key": os.environ["UPTIQ_API_KEY"],
        "accountid": os.environ["UPTIQ_ACCOUNT_ID"],
    },
)
logs = res.json()["data"]
```

{% endtab %}
{% endtabs %}

## Response

| Result     | What it means                                    | Next action                                    |
| ---------- | ------------------------------------------------ | ---------------------------------------------- |
| ✅ `200 OK` | The API returns logs in `data.logs`, not `data`. | Transform the records into your export format. |

{% hint style="success" %}
**Verified against QA on 22 September 2026.** Field names and nesting are exactly as returned; identifiers and figures are placeholders.
{% endhint %}

```json
{
  "message": "AI gateway logs fetched successfully.",
  "data": {
    "logs": [
      {
        "id": "1789712139022201400",
        "timestamp": "2026-09-18T06:15:39.022Z",
        "model": "gemini-2.5-flash",
        "provider": "Google",
        "forName": "Agent Executor",
        "forKind": "agent",
        "status": "success",
        "inputTokens": 482,
        "outputTokens": 398,
        "totalTokens": 880,
        "costUsd": 0.0014245,
        "credits": 2.849,
        "durationMs": 2523
      }
    ]
  }
}
```

This is the most detailed cost record the platform exposes: per call it gives the model, the provider, token counts, USD cost, credits and latency. `thoughtTokens` appears only for models that report reasoning tokens, so treat it as optional.

`forKind` / `forName` say what spent the credits — and unlike [top consumers](/cookbooks/platform-admin/cost/find-what-used-credits.md), `forName` is a readable label rather than a repeated UUID.

The traffic audit logs at `GET /audit-logs` use the same nesting, plus pagination:

```json
{
  "message": "Traffic audit logs fetched successfully.",
  "data": { "logs": [], "pagination": { "hasMore": false } }
}
```

## Developer notes

| Situation                  | What to do                                                                                                                       |
| -------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| Deliver CSV or PDF         | Transform the JSON yourself. These endpoints don't accept a `format` parameter.                                                  |
| Schedule recurring exports | Build scheduling and delivery in your systems, or use the UI export feature.                                                     |
| Pull several datasets      | Handle every endpoint's pagination independently. Some use `currentPage` and `pageSize`; others use `pageNumber` and `pageSize`. |

## Related

* [Export activity data](https://docs.uptiq.ai/platform-guides/admin/agents-and-evidence/export-activity-data) — as a screen, with real scheduling and delivery
* [Review credit usage](/cookbooks/platform-admin/cost/find-what-used-credits.md)
* [Review the audit trail](/cookbooks/platform-admin/agents-and-evidence/show-who-changed-what.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.uptiq.ai/cookbooks/platform-admin/agents-and-evidence/export-activity-for-review.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
