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

> Get credit usage for an agent in a space.

# Get credit usage for an agent in a space

The organization bot token must have the following scopes:

* `workflows:read`


## OpenAPI

````yaml openapi-adminApi.json GET /v1/spaces/{space_id}/agents/{agent_id}/credit_usage
openapi: 3.1.0
info:
  title: Notion Admin API
  version: 1.0.0
  termsOfService: >-
    https://notion.notion.site/Terms-and-Privacy-28ffdd083dc3473e9c2da6ec011b58ac
servers:
  - url: https://api.notion.com/admin
security:
  - bearerAuth: []
tags:
  - name: Exports
    description: Workspace export endpoints
  - name: Legal holds
    description: Legal hold endpoints
  - name: Managed users
    description: Managed user endpoints
paths:
  /v1/spaces/{space_id}/agents/{agent_id}/credit_usage:
    get:
      tags:
        - Admin API
      summary: Get credit usage for an agent in a space
      operationId: get-agent-credit-usage
      parameters:
        - $ref: '#/components/parameters/notionVersion'
        - name: agent_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: space_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: start_cursor
          in: query
          schema:
            type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  credit_per_billing_period_list:
                    type: array
                    items:
                      description: >-
                        Premium AI credits consumed by an agent in one monthly
                        billing period.
                      type: object
                      properties:
                        credits_used:
                          description: >-
                            Premium AI credits consumed by the agent in this
                            period (whole credits).
                          type: number
                        metrics_period_end_ms:
                          description: End of the billing period (epoch ms, exclusive).
                          type: number
                        metrics_period_start_ms:
                          description: Start of the billing period (epoch ms, inclusive).
                          type: number
                      required:
                        - credits_used
                        - metrics_period_end_ms
                        - metrics_period_start_ms
                  has_more:
                    description: Whether more billing periods are available.
                    type: boolean
                  id:
                    type: string
                    format: uuid
                  runs_completed:
                    description: >-
                      All-time count of finished (success or failure) runs for
                      this agent.
                    type: number
                  status:
                    description: >-
                      Agent status; same values as the list-agents endpoint's
                      'status' field.
                    type: string
                    enum:
                      - active
                      - credit_limit
                      - deleted
                      - disabled_by_notion
                      - disabled_due_to_lack_of_editors
                      - disabled_due_to_lack_of_full_access_members
                      - disabled_from_agent_settings
                      - disabled_from_api
                      - disabled_from_workspace_settings
                      - failure_limit
                      - internal_error
                      - mark_session_failed_autopause
                      - needs_review
                      - run_limit
                      - runaway_credit_usage
                      - tool_unavailable
                      - workspace_credit_limit
                  total_credits_used:
                    description: >-
                      All-time premium AI credits consumed by this agent across
                      every period.
                    type: number
                  type:
                    description: Custom agents vs database (autofill) agents.
                    type: string
                    enum:
                      - custom
                      - database_autofill
                  created_by_id:
                    type: string
                    format: uuid
                  credit_limit:
                    description: Enforced per-agent credit limit, if one is configured.
                    type: number
                  last_credit_usage_time:
                    description: >-
                      Epoch ms of the agent's most recent premium-credit usage;
                      omitted if the agent has never consumed credits.
                    type: number
                  name:
                    type: string
                  next_cursor:
                    type: string
                required:
                  - credit_per_billing_period_list
                  - has_more
                  - id
                  - runs_completed
                  - status
                  - total_credits_used
                  - type
        '400':
          description: The request body, path parameters, or query parameters are invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/adminApiError400'
              example:
                type: error
                code: validation_error
                status: 400
                message: The request body is invalid.
        '401':
          description: The request is missing a valid bearer token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/adminApiError401'
              example:
                type: error
                code: unauthorized
                status: 401
                message: Unauthorized.
        '403':
          description: >-
            The authenticated bot does not have access to the requested resource
            or scope.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/adminApiError403'
              example:
                type: error
                code: forbidden
                status: 403
                message: Forbidden.
        '404':
          description: The requested resource could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/adminApiError404'
              example:
                type: error
                code: not_found
                status: 404
                message: Not found.
        '429':
          description: The request was rate limited.
          headers:
            retry-after:
              description: Seconds to wait before retrying the request.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/adminApiError429'
              example:
                type: error
                code: rate_limited
                status: 429
                message: Rate limited.
        '500':
          description: An unexpected server error occurred.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/adminApiError500'
              example:
                type: error
                code: internal_server_error
                status: 500
                message: An unexpected error occurred.
components:
  parameters:
    notionVersion:
      name: Notion-Version
      in: header
      required: true
      schema:
        enum:
          - '2026-06-01'
      description: The Admin API version to use for this request.
  schemas:
    adminApiError400:
      type: object
      properties:
        type:
          enum:
            - error
        code:
          enum:
            - validation_error
        status:
          enum:
            - 400
        message:
          type: string
      required:
        - type
        - code
        - status
        - message
      additionalProperties: false
    adminApiError401:
      type: object
      properties:
        type:
          enum:
            - error
        code:
          enum:
            - unauthorized
        status:
          enum:
            - 401
        message:
          type: string
      required:
        - type
        - code
        - status
        - message
      additionalProperties: false
    adminApiError403:
      type: object
      properties:
        type:
          enum:
            - error
        code:
          enum:
            - missing_scope
            - forbidden
        status:
          enum:
            - 403
        message:
          type: string
      required:
        - type
        - code
        - status
        - message
      additionalProperties: false
    adminApiError404:
      type: object
      properties:
        type:
          enum:
            - error
        code:
          enum:
            - not_found
        status:
          enum:
            - 404
        message:
          type: string
      required:
        - type
        - code
        - status
        - message
      additionalProperties: false
    adminApiError429:
      type: object
      properties:
        type:
          enum:
            - error
        code:
          enum:
            - rate_limited
        status:
          enum:
            - 429
        message:
          type: string
      required:
        - type
        - code
        - status
        - message
      additionalProperties: false
    adminApiError500:
      type: object
      properties:
        type:
          enum:
            - error
        code:
          enum:
            - internal_server_error
        status:
          enum:
            - 500
        message:
          type: string
      required:
        - type
        - code
        - status
        - message
      additionalProperties: false
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````