> ## Documentation Index
> Fetch the complete documentation index at: https://dev.writer.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Retrieve usage for an entity

> Retrieve cost and token usage for one user, team, playbook, or billing group for one month. The response has the same shape as the scope breakdown with a single row. An entity with no usage in the month returns one row with zero cost and zero tokens. When a team filter applies, from `team_id` or a legacy team API key, a user or playbook with no usage in that team returns an empty `data` array and a `pagination.total` of `0` instead, including one that isn't in the team.

> [!NOTE]
>
> Use an organization API key (**All teams**). An existing legacy team key can read the `team`, `user`, and `playbook` scopes for its own team only. See [Export usage and spend](https://dev.writer.com/home/consumption-export.md) for examples, pagination, and error handling.


## OpenAPI

````yaml get /api/billing/v1/organization/{organizationId}/consumption/breakdown/{scope}/{scopeId}
openapi: 3.0.3
info:
  title: Consumption API
  version: '1.0'
  description: >-
    Read monthly cost and token usage for an organization by user, team,
    playbook, or billing group.
servers:
  - url: https://api.writer.com
security:
  - bearerAuth: []
tags:
  - name: Consumption API
paths:
  /api/billing/v1/organization/{organizationId}/consumption/breakdown/{scope}/{scopeId}:
    get:
      tags:
        - Consumption API
      summary: Retrieve usage for an entity
      description: >-
        Retrieve cost and token usage for one user, team, playbook, or billing
        group for one month. The response has the same shape as the scope
        breakdown with a single row. An entity with no usage in the month
        returns one row with zero cost and zero tokens. When a team filter
        applies, from `team_id` or a legacy team API key, a user or playbook
        with no usage in that team returns an empty `data` array and a
        `pagination.total` of `0` instead, including one that isn't in the team.
      operationId: getConsumptionBreakdownEntity
      parameters:
        - $ref: '#/components/parameters/organization_id'
        - $ref: '#/components/parameters/scope'
        - $ref: '#/components/parameters/scope_id'
        - $ref: '#/components/parameters/month'
        - $ref: '#/components/parameters/team_id'
      responses:
        '200':
          description: A breakdown page with one row.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/consumption_breakdown_page'
              example:
                scope: team
                currency: USD
                data:
                  - scope_id: '8'
                    scope_name: Marketing
                    cost_in_cents: 5320
                    total_tokens: 1925000
                pagination:
                  limit: 50
                  offset: 0
                  total: 1
        '400':
          $ref: '#/components/responses/bad_request'
        '401':
          $ref: '#/components/responses/unauthorized'
        '403':
          $ref: '#/components/responses/forbidden'
components:
  parameters:
    organization_id:
      name: organizationId
      in: path
      required: true
      description: ID of the organization the API key belongs to.
      schema:
        type: integer
        format: int64
    scope:
      name: scope
      in: path
      required: true
      description: >-
        Dimension to report on. The scope must be enabled in the Consumption
        view for your organization.
      schema:
        type: string
        enum:
          - user
          - team
          - playbook
          - billing_group
    scope_id:
      name: scopeId
      in: path
      required: true
      description: >-
        ID of one entity in the scope. User, team, and billing group IDs are
        integers. Playbook IDs are strings.
      schema:
        type: string
    month:
      name: month
      in: query
      required: true
      description: Calendar month to read, in UTC, in `YYYY-MM` format.
      schema:
        type: string
        pattern: ^[0-9]{4}-[0-9]{2}$
        example: 2026-10
    team_id:
      name: team_id
      in: query
      required: false
      description: >-
        ID of one team. Limits the `user` and `playbook` scopes to usage in that
        team. Any other scope returns `400`. A legacy team API key can pass only
        its own team's ID.
      schema:
        type: integer
        format: int64
        minimum: 1
  schemas:
    consumption_breakdown_page:
      type: object
      required:
        - scope
        - currency
        - data
        - pagination
      properties:
        scope:
          type: string
          enum:
            - user
            - team
            - playbook
            - billing_group
          description: The scope from the path.
        currency:
          type: string
          description: Currency of `cost_in_cents`.
          example: USD
        data:
          type: array
          items:
            $ref: '#/components/schemas/consumption_breakdown_row'
        pagination:
          $ref: '#/components/schemas/consumption_pagination'
    consumption_breakdown_row:
      type: object
      required:
        - scope_id
        - scope_name
        - cost_in_cents
        - total_tokens
      properties:
        scope_id:
          type: string
          description: >-
            Entity ID. User, team, and billing group IDs are integers sent as
            strings.
        scope_name:
          type: string
          description: >-
            Display name of the entity. For a user, the first and last name, or
            the email address when the user has no name.
        cost_in_cents:
          type: integer
          format: int64
          description: Cost for the month, rounded to the nearest cent.
        total_tokens:
          type: integer
          format: int64
          description: Tokens used in the month.
    consumption_pagination:
      type: object
      required:
        - limit
        - offset
        - total
      properties:
        limit:
          type: integer
          description: Page size used for this response.
        offset:
          type: integer
          format: int64
          description: Rows skipped before this page.
        total:
          type: integer
          description: Total rows across all pages.
    consumption_error:
      type: object
      properties:
        tpe:
          type: string
          description: Error category.
        errors:
          type: array
          items:
            type: object
            properties:
              key:
                type: string
                description: Field or error key.
              description:
                type: string
                description: Readable description of the error.
  responses:
    bad_request:
      description: >-
        The month is missing, malformed, or earlier than the first month with
        consumption data. The scope is unknown, the scope ID is malformed, or
        `limit` or `offset` is out of range. `team_id` isn't a positive integer,
        or is sent with a scope other than `user` or `playbook`.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/consumption_error'
    unauthorized:
      description: The API key is missing or invalid.
    forbidden:
      description: >-
        The API key belongs to a different organization, is a user key, or can't
        read the requested scope or team, such as a legacy team key that passes
        another team's `team_id`. The scope isn't enabled for the organization.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/consumption_error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Bearer authentication header of the form `Bearer <token>`, where
        `<token>` is your [Writer API
        key](https://dev.writer.com/api-reference/api-keys). User keys can't
        read consumption data.

````