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

# Get a reservation

> Read one reservation's status, held credits and expiry.

Returns the [reservation](https://docs.integrateledger.com/customers/reservations.md) a [check with `reserve`](https://docs.integrateledger.com/api-reference/usage/check) made under `requestId`, with its `status`: `held`, `settled` (a track charged it: see `settledCredits` and `uncoveredCredits`), `released`, or `expired` (held past its expiry, so it no longer holds anything). `availableCredits` is the customer's balance now, after every active reservation.

Reading never waits behind the customer's tracks, and its `availableCredits` doesn't yet include a renewal that is due until the next check or track grants it. An unknown `requestId` returns `404 reservation_not_found`.

Needs the **Credits** permission at Check.


## OpenAPI

````yaml openapi.json GET /v1/reservations/{requestId}
openapi: 3.1.0
info:
  title: Ledger API
  version: 0.1.0
servers:
  - url: https://api.integrateledger.com
    description: Hosted Ledger API
security: []
paths:
  /v1/reservations/{requestId}:
    get:
      tags:
        - Reservations
      summary: Get a reservation
      operationId: getReservation
      parameters:
        - schema:
            type: string
            minLength: 1
            maxLength: 255
            description: The request_id you sent with the check that reserved.
          required: true
          description: The request_id you sent with the check that reserved.
          name: requestId
          in: path
        - schema:
            type: string
            minLength: 1
            maxLength: 255
            description: Your ID for the customer, such as your user ID.
          required: true
          description: Your ID for the customer, such as your user ID.
          name: customerId
          in: query
      responses:
        '200':
          description: The reservation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Reservation'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReservationError'
        '401':
          description: Invalid Ledger API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReservationError'
        '403':
          $ref: '#/components/responses/InsufficientPermissions'
        '404':
          description: Customer or reservation not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReservationError'
        '429':
          $ref: '#/components/responses/RateLimited'
      security:
        - ApiKey: []
      x-codeSamples:
        - lang: python
          label: Python SDK
          source: |-
            import os
            from integrateledger import ledger

            client = ledger(api_key=os.environ["LEDGER_API_KEY"])
            client.get_reservation(customer_id="user_123", request_id="run_123")
        - lang: bash
          label: cURL
          source: >-
            curl --request GET
            'https://api.integrateledger.com/v1/reservations/run_123?customerId=user_123'
            \
              -H "Authorization: Bearer $LEDGER_API_KEY"
        - lang: typescript
          label: TypeScript SDK
          source: >-
            import ledger from "integrateledger";


            const client = new ledger({ apiKey: process.env.LEDGER_API_KEY ?? ""
            });

            await client.getReservation({ requestId: "run_123", customerId:
            "user_123" });
components:
  schemas:
    Reservation:
      type: object
      properties:
        requestId:
          type: string
        customerId:
          type: string
        entityId:
          type:
            - string
            - 'null'
          description: >-
            The entity the reservation holds for. Null: the customer's shared
            credits.
        featureId:
          type: string
        status:
          type: string
          enum:
            - held
            - settled
            - released
            - expired
          description: >-
            held: reserving credits. settled: a track charged it. released: let
            go without charging. expired: the hold lapsed before a track settled
            it.
        credits:
          type: integer
          exclusiveMinimum: 0
          description: >-
            Credits the reservation holds (or held); a metered feature's units
            for a metered one.
        settledCredits:
          type:
            - integer
            - 'null'
          minimum: 0
          description: >-
            What the settling track charged, from grants and overage. Null until
            settled.
        uncoveredCredits:
          type:
            - integer
            - 'null'
          minimum: 0
          description: >-
            Settled credits that couldn't be charged because the grants under
            the hold ended while it was held (a cancellation, for example). Null
            until settled.
        expiresAt:
          type: string
          format: date-time
        createdAt:
          type: string
          format: date-time
        availableCredits:
          type: integer
          minimum: 0
          description: >-
            The customer's prepaid credits after this request, less what active
            reservations hold.
        idempotent:
          type: boolean
          description: >-
            True when the request repeated one already applied and changed
            nothing.
      required:
        - requestId
        - customerId
        - entityId
        - featureId
        - status
        - credits
        - settledCredits
        - uncoveredCredits
        - expiresAt
        - createdAt
        - availableCredits
        - idempotent
    ReservationError:
      type: object
      properties:
        error:
          type: string
        message:
          type: string
          description: >-
            What went wrong and what to do about it, for a person or an agent to
            read. Every Ledger error has one. The wording can change: branch on
            `error`, not on this text.
          example: >-
            No customer "user_123" exists in this environment. Create it with
            POST /v1/customers, or check that the API key is for the right
            environment.
      required:
        - error
    InsufficientPermissionsError:
      type: object
      properties:
        error:
          type: string
          example: insufficient_permissions
        message:
          type: string
          description: >-
            What went wrong and what to do about it, for a person or an agent to
            read. Every Ledger error has one. The wording can change: branch on
            `error`, not on this text.
          example: >-
            No customer "user_123" exists in this environment. Create it with
            POST /v1/customers, or check that the API key is for the right
            environment.
        requiredScope:
          type: string
          example: customers:read
      required:
        - error
        - requiredScope
    RateLimitError:
      type: object
      properties:
        error:
          type: string
          example: rate_limited
        message:
          type: string
          description: >-
            What went wrong and what to do about it, for a person or an agent to
            read. Every Ledger error has one. The wording can change: branch on
            `error`, not on this text.
          example: >-
            No customer "user_123" exists in this environment. Create it with
            POST /v1/customers, or check that the API key is for the right
            environment.
      required:
        - error
  responses:
    InsufficientPermissions:
      description: >-
        The API key works but lacks the permission this endpoint needs, named in
        requiredScope. See the API keys guide.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/InsufficientPermissionsError'
    RateLimited:
      description: >-
        Too many requests. Wait Retry-After seconds, then retry. See the rate
        limits guide.
      headers:
        Retry-After:
          description: Seconds until a request is allowed again
          schema:
            type: integer
        RateLimit-Limit:
          description: 'The burst: requests allowed at once'
          schema:
            type: integer
        RateLimit-Remaining:
          description: Requests left right now
          schema:
            type: integer
        RateLimit-Reset:
          description: Seconds until the full burst is back
          schema:
            type: integer
        RateLimit-Policy:
          description: >-
            The sustained rate per second and the burst, such as
            200;w=1;burst=1000
          schema:
            type: string
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/RateLimitError'
  securitySchemes:
    ApiKey:
      type: http
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.