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

# List AI credit transactions

> Returns the account's credit transactions, paginated. Requires scope: `credits:read`. Tenancy: resolved from the API key's tenant to its organization.



## OpenAPI

````yaml /api-reference/openapi.json get /api/v1/credits/transactions
openapi: 3.1.0
info:
  title: Railmail Public API
  version: v1
  description: >-
    REST API for managing the Railmail email marketing platform
    programmatically.


    ## Authentication

    Every request must carry a project-scoped API key, either in the `X-API-Key`
    header or as `Authorization: Bearer rm_...`. Keys have the format
    `rm_(live|test)_<random>`. A key resolves to exactly one project; all reads
    and writes are automatically isolated to that project and its tenant. A key
    cannot read or modify another project's data.


    ## Scopes

    Every key carries a set of scopes. Each operation requires a specific scope,
    documented in that operation's description (for example `Requires scope:
    subscribers:write`). A request whose key lacks the required scope returns
    `403`.


    The full scope taxonomy: `subscribers:read|write`, `topics:read|write`,
    `segments:read|write`, `campaigns:read|write`, `automations:read|write`,
    `custom_fields:read|write`, `sending_domains:read|write`, `consents:manage`,
    `suppressions:manage`, `reports:read`, `billing:read`, `credits:read`.


    ## Rate limiting

    Requests are limited to 60 per minute per key. The response carries
    `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset`. When
    exceeded, the API returns `429` with a `Retry-After` header.


    ## Errors

    All errors use RFC 7807 `application/problem+json` with `type`, `title`,
    `status`, `detail`, `instance`, `timestamp` and (for validation) `errors`.


    ## Canonical flow: add your users to your topics

    1. `GET /topics` to discover topic keys.

    2. `POST /subscribers` with `topicKeys` + `consent` to create a subscriber
    and subscribe in one call, OR `POST /subscribers/{email}/consents` to
    subscribe an existing subscriber.

    If a topic uses double opt-in, the consent is created `PENDING_CONFIRMATION`
    and the subscriber must confirm via the email they receive before they are
    subscribed.
  contact:
    name: Railmail
    url: https://railmail.app
servers:
  - url: https://api.railmail.app
    description: Production
security:
  - ApiKeyAuth: []
tags:
  - name: Subscribers
    description: Manage subscribers within the API key's project
  - name: Topics
    description: Manage subscription topics in the project
  - name: Consents
    description: Grant, read and revoke per-topic consent for a subscriber
  - name: Suppressions
    description: Manage the project suppression list
  - name: Campaigns
    description: Create, manage, schedule and send email campaigns
  - name: Segments
    description: Create, manage and populate subscriber segments
  - name: Custom Fields
    description: Define and manage subscriber custom field definitions
  - name: Automations
    description: Create, manage and control email automation workflows
  - name: Sending Domain
    description: Manage the project's custom sending domain and DNS verification
  - name: Campaign Reports
    description: Read campaign statistics, AI report, timeline and CSV export
  - name: Billing
    description: Read subscription, plans, invoices and usage for the account
  - name: AI Credits
    description: Read AI credit balance and transaction history for the account
  - name: Project
    description: Read the project the API key is scoped to
paths:
  /api/v1/credits/transactions:
    get:
      tags:
        - AI Credits
      summary: List AI credit transactions
      description: >-
        Returns the account's credit transactions, paginated. Requires scope:
        `credits:read`. Tenancy: resolved from the API key's tenant to its
        organization.
      operationId: getCreditTransactions
      parameters:
        - $ref: '#/components/parameters/PageParam'
        - $ref: '#/components/parameters/SizeParam'
      responses:
        '200':
          description: Paginated transactions
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaginatedCreditTransactionResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'
components:
  parameters:
    PageParam:
      name: page
      in: query
      required: false
      description: Zero-based page index.
      schema:
        type: integer
        minimum: 0
        default: 0
    SizeParam:
      name: size
      in: query
      required: false
      description: Page size, clamped to a maximum of 100.
      schema:
        type: integer
        minimum: 1
        maximum: 100
        default: 20
  schemas:
    PaginatedCreditTransactionResponse:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/CreditTransactionResponse'
        pagination:
          $ref: '#/components/schemas/PaginationMetadata'
    CreditTransactionResponse:
      type: object
      properties:
        id:
          type: string
          format: uuid
        type:
          type: string
          nullable: true
        amount:
          type: number
        balanceAfter:
          type: number
        referenceId:
          type: string
          format: uuid
          nullable: true
        description:
          type: string
          nullable: true
        createdAt:
          type: string
          format: date-time
    PaginationMetadata:
      type: object
      properties:
        page:
          type: integer
        size:
          type: integer
        totalElements:
          type: integer
          format: int64
        totalPages:
          type: integer
        hasNext:
          type: boolean
        hasPrevious:
          type: boolean
      required:
        - page
        - size
        - totalElements
        - totalPages
        - hasNext
        - hasPrevious
    ProblemDetail:
      type: object
      description: RFC 7807 problem details.
      properties:
        type:
          type: string
          format: uri
        title:
          type: string
        status:
          type: integer
        detail:
          type: string
        instance:
          type: string
          format: uri
        timestamp:
          type: string
          format: date-time
        errors:
          type: object
          additionalProperties:
            type: string
          description: Field-level validation errors, present on 400/422.
      required:
        - type
        - title
        - status
  responses:
    Unauthorized:
      description: Missing or invalid API key.
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/ProblemDetail'
    Forbidden:
      description: The API key lacks the required scope.
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/ProblemDetail'
    TooManyRequests:
      description: Rate limit exceeded.
      headers:
        Retry-After:
          description: Seconds to wait before retrying.
          schema:
            type: integer
        X-RateLimit-Limit:
          description: Requests allowed per minute.
          schema:
            type: integer
        X-RateLimit-Remaining:
          description: Requests remaining in the window.
          schema:
            type: integer
        X-RateLimit-Reset:
          description: Epoch seconds when the window resets.
          schema:
            type: integer
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/ProblemDetail'
    InternalError:
      description: Unexpected server error.
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/ProblemDetail'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: >-
        Project-scoped API key, format rm_(live|test)_... . May also be sent as
        `Authorization: Bearer rm_...`.

````