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

# Reserve a slot

> Reserves a slot so it is no longer offered while your patient finishes the flow. Optional — you can book straight from a `slot_token` — but it closes the window in which two patients can pick the same time.

Send a `slot_token` from a slot search plus the `patient_id` you are reserving for. Scheduling pins one provider from the offer's eligible set. The window and provider come from the token; there is no way to name either directly.

Reservations last about five minutes — read `expires_at` rather than assuming a duration. Confirm by booking with the returned `reservation_id`, or release it.



## OpenAPI

````yaml /openapi.json post /reservations
openapi: 3.1.0
info:
  title: OpenLoop API
  version: 0.1.0
  description: >-
    Unified reference for the OpenLoop Patient (clinical) and Payments & Revenue
    APIs.
servers:
  - url: https://api.openloophealth.com/v0.1
    description: Production partner edge
  - url: https://api-staging.openloophealth.com/v0.1
    description: Staging partner edge (sandbox credentials)
security: []
paths:
  /reservations:
    post:
      tags:
        - Scheduling
      summary: Reserve a slot
      description: >-
        Reserves a slot so it is no longer offered while your patient finishes
        the flow. Optional — you can book straight from a `slot_token` — but it
        closes the window in which two patients can pick the same time.


        Send a `slot_token` from a slot search plus the `patient_id` you are
        reserving for. Scheduling pins one provider from the offer's eligible
        set. The window and provider come from the token; there is no way to
        name either directly.


        Reservations last about five minutes — read `expires_at` rather than
        assuming a duration. Confirm by booking with the returned
        `reservation_id`, or release it.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                slot_token:
                  type: string
                  minLength: 1
                  maxLength: 8192
                  description: A `slot_token` from a slot search, passed verbatim.
                patient_id:
                  type: string
                  format: uuid
                  description: >-
                    The patient, as returned by `POST /patients`. Required only
                    when the `slot_token` names no patient — that is, when the
                    slot search did not send `patient_id`. Otherwise optional: a
                    matching value is accepted, and a different one is a 400
                    (`slot_token.patient_mismatch`).
              required:
                - slot_token
      responses:
        '201':
          description: The slot is held.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SchedulingReservation'
        '400':
          description: >-
            Request validation failed, or the slot token has expired. Also
            `patient_id` missing for a token that names no patient, or differing
            from the token's patient (`slot_token.patient_mismatch`).
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/SchedulingProblem'
        '401':
          description: Missing or invalid bearer token.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/SchedulingProblem'
        '403':
          description: The slot token was issued for a different organization.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/SchedulingProblem'
        '404':
          description: >-
            The slot token references an appointment-type variant that no longer
            exists.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/SchedulingProblem'
        '409':
          description: >-
            The slot is no longer available to hold — someone else took it.
            Search again.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/SchedulingProblem'
        '422':
          description: '`slot_token.tampered` — the token failed integrity verification.'
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/SchedulingProblem'
        '500':
          description: >-
            A transient persistence error aborted the write; the request may be
            retried.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/SchedulingProblem'
      security:
        - serviceToken: []
        - userToken: []
components:
  schemas:
    SchedulingReservation:
      type: object
      description: >-
        A short-lived reservation on one slot. While it is live the slot is no
        longer offered.
      properties:
        reservation_id:
          type: string
          format: uuid
          description: Confirm with this id, or release it.
        expires_at:
          type: string
          format: date-time
          description: When the reservation lapses and the slot is offered again.
        start:
          type: string
          format: date-time
        end:
          type: string
          format: date-time
        appointment_type_id:
          type: string
          format: uuid
        duration_minutes:
          type: integer
          exclusiveMinimum: 0
      required:
        - reservation_id
        - expires_at
        - start
        - end
    SchedulingProblem:
      type: object
      description: >-
        RFC 7807 problem detail. Scheduling endpoints return errors as
        `application/problem+json`, not the platform `{ error, request_id }`
        envelope. `code` is the stable machine-readable identifier — branch on
        it, not on `detail`.
      properties:
        type:
          type: string
          description: Problem type URI. `about:blank` for the codes below.
        title:
          type: string
          description: Short human-readable summary, e.g. `Bad Request`.
        status:
          type: integer
          description: The HTTP status code, repeated in the body.
        detail:
          type: string
          description: Human-readable explanation of this occurrence.
        instance:
          type: string
        code:
          type: string
          description: >-
            Stable error identifier, e.g. `slot_search.window_too_large`,
            `appointment_list.offset_required`, `slot_token.tampered`.
          examples:
            - slot_search.window_too_large
        errors:
          type: array
          description: >-
            Field-level validation failures, when the error is a body/query
            validation failure.
          items:
            type: object
            properties:
              field:
                type: string
              message:
                type: string
              code:
                type: string
            required:
              - field
              - message
              - code
      required:
        - type
        - title
        - status
        - code
  securitySchemes:
    serviceToken:
      type: oauth2
      description: >-
        Service (M2M) access token issued by POST /auth/token using the
        client_credentials grant. Required scopes, where known, are listed on
        each operation below.
      flows:
        clientCredentials:
          tokenUrl: https://api.openloophealth.com/v0.1/auth/token
          scopes: {}
    userToken:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        User access token issued by POST /auth/token via the verification-code
        grant (after Verify a one-time code) or the refresh_token grant.

````

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