---
title: "Get credit spend attributed to saved agents"
method: GET
path: "/credits/usage/by_agent/"
tags: ["credits"]
---

# Get credit spend attributed to saved agents

`GET /credits/usage/by_agent/`

## Request

- Base URL: `https://api.getoneprofile.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://api.getoneprofile.ai/credits/usage/by_agent/`
- Auth: one of:
  - API key in header `X-API-Key`
  - HTTP bearer

Get credit spend grouped by the saved agent behind each column.

## Query parameters

- `start_time` string, date-time, required: Range start (ISO 8601)
- `end_time` string, date-time, required: Range end (ISO 8601)

## Response `200`

Successful Response

- CreditAttributionResponseSchema: Credit spend attributed to tables/columns or providers/accounts.
  - `entities` CreditAttributionEntitySchema[], required: Sorted by credits descending; includes an explicit unattributed entity.
    - `avg_cost_per_unit` number, nullable, required
    - `credits_refunded` number, required: Refunded portion, reported separately, in decimal credits.
    - `credits_spent` number, required: Net of any refunds sharing this attribution, in decimal credits.
    - `deleted` boolean: True when a table id no longer resolves to a live table. The row is kept so the credits stay accounted for, but the client must render the name as plain text rather than a link to a table that is gone.
    - `entry_count` integer, required
    - `id` string, uuid, nullable, required: Table id for table grouping; null otherwise.
    - `key` string, nullable, required: Provider key for provider grouping; null otherwise.
    - `name` string, required: Resolved display name.
    - `subentities` CreditAttributionSubentitySchema[], required: Drill-down rows sorted by credits descending.
      - `avg_cost_per_unit` number, nullable, required: credits_spent / units, in decimal credits; null when units is zero.
      - `credits_refunded` number, required: Refunded portion, reported separately, in decimal credits.
      - `credits_spent` number, required: Net of any refunds sharing this attribution, in decimal credits.
      - `entry_count` integer, required
      - `id` string, uuid, nullable, required: Column or integration id; null when unattributed.
      - `name` string, required: Resolved display name.
      - `units` integer, required: Count of items charged.
    - `units` integer, required
  - `subentity_breakdown_since` string, date-time, nullable, required: Drill-down rows cover only the detailed window when the range crosses the rollup boundary.
  - `total_credits_refunded` number, required: The organization refunded total row, in decimal credits.
  - `total_credits_spent` number, required: The organization total row, net of refunds, in decimal credits.
  - `unattributed_credits` number, required: In decimal credits.

## Other responses

- `401`: Unauthorized
- `403`: Forbidden
- `422`: Invalid request made to the API.
- `500`: Internal server error.
- `502`: Bad gateway error.
- `503`: Service unavailable.

---

[API](https://skmtc.dev/getoneprofile/apis/api-reference-oneprofile.md) · [All operations](https://skmtc.dev/getoneprofile/apis/api-reference-oneprofile/llms.txt) · [OpenAPI document](https://skmtc.dev/getoneprofile/apis/api-reference-oneprofile/revisions/4a6bd71e3f02?raw)
