# Retrieve billing details

Retrieves billing and subscription details for the organization associated with the authenticated user.
Organizations can retrieve an account's billing details by passing `x-account-id`, but only for **self-managed** accounts — managed accounts don't have independent billing.

Endpoint: GET /v2/billing
Version: v2
Security: x-api-key

## Security:

  - `x-api-key` (unknown)
    apiKey in header x-api-key

## Header parameters:

  - `x-account-id` (integer)
    The ID of an account to perform this request against, instead of the organization tied to the API key.
Only relevant for organizations with accounts; omit this header to act on the organization associated with the authenticated credential.

## Response 200:

  - `200` (unknown)
    Successful response containing the organization's billing details.

## Response 200 fields (application/json):

  - `requestId` (string)
    Unique identifier for the request.
    Example: b0eac937-c25c-47a5-bb7e-552f6b860458

  - `status` (string)
    Indicates the status of the request.
    Example: success

  - `data` (object)
    Billing and subscription details for the organization.

  - `data.planName` (string)
    Name of the organization's current plan.
    Example: Analyst

  - `data.planStatus` (string)
    Current status of the organization's subscription.
    Enum: "trial", "active", "overdue", "cancelled"

  - `data.billingPeriod` (string)
    Billing frequency for the organization's subscription.
    Enum: "monthly", "quarterly", "yearly"

  - `data.billingEmail` (string)
    Email address to which invoices are sent.
    Example: payments@company.com

## Response 401:

  - `401` (unknown)
    Error response indicating that the API key is missing or invalid.

## Response 401 fields (application/json):

  - `requestId` (string)
    Unique identifier for the request.
    Example: b0eac937-c25c-47a5-bb7e-552f6b860458

  - `status` (string)
    Indicates the status of the request.
    Example: error

  - `errors` (array)
    Errors that occurred while processing the request.

  - `errors.code` (string)
    Machine-readable error code that identifies the type of error.
    Example: invalid_input

  - `errors.message` (string)
    Human-readable description of the error, including the underlying validation message when available.
    Example: The provided parameter is invalid.

  - `errors.field` (string)
    Name of the request field associated with the error, if applicable.
    Example: name

  - `errors.type` (string)
    Category or context of the error, such as validation or permission.
    Example: validation

