> ## 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.

# Retrieve an appointment

> Returns one of your appointments, including the assigned provider and the current status and outcome.

The two audit logs are sub-objects of the appointment, opted into per request: `state_history=true` adds the status-transition log, `reschedule_history=true` adds the reschedule chain. Each arrives as a nested `{ items, after?, before? }` page, oldest first — no `request_id` inside, since the enclosing response already carries one. Omit the flags and neither log is read or returned — this is one request, not three, and you pay only for the parts you ask for.

Neither log has an intrinsic bound, so page them with `history_limit` plus the matching `*_history_cursor`.



## OpenAPI

````yaml /openapi.json get /appointments/{id}
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:
  /appointments/{id}:
    get:
      tags:
        - Scheduling
      summary: Retrieve an appointment
      description: >-
        Returns one of your appointments, including the assigned provider and
        the current status and outcome.


        The two audit logs are sub-objects of the appointment, opted into per
        request: `state_history=true` adds the status-transition log,
        `reschedule_history=true` adds the reschedule chain. Each arrives as a
        nested `{ items, after?, before? }` page, oldest first — no `request_id`
        inside, since the enclosing response already carries one. Omit the flags
        and neither log is read or returned — this is one request, not three,
        and you pay only for the parts you ask for.


        Neither log has an intrinsic bound, so page them with `history_limit`
        plus the matching `*_history_cursor`.
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: The appointment id.
        - name: state_history
          in: query
          required: false
          schema:
            type: string
            enum:
              - 'true'
              - 'false'
            default: 'false'
          description: Include the status-transition log as a `state_history` page.
        - name: reschedule_history
          in: query
          required: false
          schema:
            type: string
            enum:
              - 'true'
              - 'false'
            default: 'false'
          description: Include the reschedule chain as a `reschedule_history` page.
        - name: history_limit
          in: query
          required: false
          schema:
            anyOf:
              - type: integer
                minimum: 1
              - type: string
                pattern: ^\d+$
            default: 25
          description: >-
            Maximum entries per page, applied to **both** requested logs.
            Defaults to 25. There is no declared maximum, so a larger value is
            accepted rather than rejected, but the page size is capped at 100 —
            ask for more and you get 100. Values below 1 return `400`. Named
            `history_limit` rather than `limit` because one value sizes two
            nested logs.
        - name: state_history_cursor
          in: query
          required: false
          schema:
            type: string
            maxLength: 8192
            pattern: ^[A-Za-z0-9_-]+$
          description: >-
            Opaque `after` or `before` value from a previous `state_history`
            page, passed back verbatim. Requires `state_history=true` — sending
            it alone is a `400` rather than a silent no-op.
        - name: reschedule_history_cursor
          in: query
          required: false
          schema:
            type: string
            maxLength: 8192
            pattern: ^[A-Za-z0-9_-]+$
          description: >-
            Opaque `after` or `before` value from a previous
            `reschedule_history` page, passed back verbatim. Requires
            `reschedule_history=true` — sending it alone is a `400` rather than
            a silent no-op.
      responses:
        '200':
          description: The appointment, plus whichever history sub-objects you asked for.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SchedulingAppointmentDetail'
        '400':
          description: >-
            Query validation failed — a bad history flag or limit, a history
            cursor sent without its flag, or one that cannot be decoded
            (`appointment_state_history.cursor_invalid` /
            `appointment_reschedule_history.cursor_invalid`).
          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 access token carries no usable organization.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/SchedulingProblem'
        '404':
          description: No such appointment for your organization.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/SchedulingProblem'
      security:
        - serviceToken: []
        - userToken: []
components:
  schemas:
    SchedulingAppointmentDetail:
      description: >-
        An appointment as returned by the retrieve endpoint: the appointment,
        plus either audit log you opted into. Both sub-objects are absent unless
        the request asked for them. Returned bare — single-resource responses
        carry no `request_id`; that field is on the collection envelopes only.
      allOf:
        - $ref: '#/components/schemas/SchedulingAppointment'
        - type: object
          properties:
            state_history:
              allOf:
                - $ref: '#/components/schemas/SchedulingStateHistoryPage'
              description: Present only when the request carried `state_history=true`.
            reschedule_history:
              allOf:
                - $ref: '#/components/schemas/SchedulingRescheduleHistoryPage'
              description: Present only when the request carried `reschedule_history=true`.
    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
    SchedulingAppointment:
      type: object
      description: >-
        A booked appointment. Returned bare (not wrapped in a `data` envelope)
        by the single-appointment endpoints. Carries no `organization_id` — your
        org comes from the access token.
      properties:
        id:
          type: string
          format: uuid
        provider_id:
          type: string
          format: uuid
          description: The provider scheduling assigned at book time.
        patient_id:
          type: string
          format: uuid
        start:
          type: string
          format: date-time
        end:
          type: string
          format: date-time
        status:
          type: string
          enum:
            - open
            - closed
          description: >-
            Lifecycle state. `closed` is terminal; read `outcome` for how it
            closed.
        outcome:
          type: string
          enum:
            - completed
            - no_show
            - cancelled
            - unresolved
          description: Present once the appointment closes.
        state:
          type: string
          minLength: 2
          maxLength: 2
          description: Two-letter US state the visit was licensed against.
        closed_at:
          type: string
          format: date-time
          description: >-
            When the appointment closed, however it closed — completed, no-show
            or cancelled. Present once `status` is `closed`.
        cancelled_at:
          type: string
          format: date-time
        cancel_reason:
          type: string
        notes:
          type: string
          description: Pre-visit notes, when the booking set them.
        external_refs:
          type: array
          description: Identifiers this appointment carries in downstream systems.
          items:
            type: object
            properties:
              system:
                type: string
              id:
                type: string
            required:
              - system
              - id
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
      required:
        - id
        - provider_id
        - patient_id
        - start
        - end
        - status
        - created_at
        - updated_at
    SchedulingStateHistoryPage:
      type: object
      description: >-
        A page of the appointment's status-transition log, oldest first. Nested
        inside the appointment, so it carries no `request_id` of its own.
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/SchedulingStateTransition'
        after:
          type: string
          description: >-
            Cursor for the next page. Absent only when there are no further
            pages.
        before:
          type: string
          description: Cursor for the previous page. Absent on the first page of a walk.
      required:
        - items
    SchedulingRescheduleHistoryPage:
      type: object
      description: >-
        A page of the appointment's reschedule chain, oldest first. Nested
        inside the appointment, so it carries no `request_id` of its own.
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/SchedulingRescheduleRecord'
        after:
          type: string
          description: >-
            Cursor for the next page. Absent only when there are no further
            pages.
        before:
          type: string
          description: Cursor for the previous page. Absent on the first page of a walk.
      required:
        - items
    SchedulingStateTransition:
      type: object
      description: One status/outcome change in an appointment's audit trail.
      properties:
        id:
          type: string
          format: uuid
        from_status:
          type: string
          enum:
            - open
            - closed
        from_outcome:
          type:
            - string
            - 'null'
          enum:
            - completed
            - no_show
            - cancelled
            - unresolved
            - null
        to_status:
          type: string
          enum:
            - open
            - closed
        to_outcome:
          type:
            - string
            - 'null'
          enum:
            - completed
            - no_show
            - cancelled
            - unresolved
            - null
        reason:
          type:
            - string
            - 'null'
        transitioned_at:
          type: string
          format: date-time
        source:
          type: string
          description: Which surface drove the transition.
      required:
        - id
        - from_status
        - from_outcome
        - to_status
        - to_outcome
        - reason
        - transitioned_at
        - source
    SchedulingRescheduleRecord:
      type: object
      description: One move in an appointment's reschedule chain.
      properties:
        id:
          type: string
          format: uuid
        previous_start:
          type: string
          format: date-time
        previous_end:
          type: string
          format: date-time
        new_start:
          type: string
          format: date-time
        new_end:
          type: string
          format: date-time
        rescheduled_at:
          type: string
          format: date-time
        source:
          type: string
          description: Which surface made the move.
      required:
        - id
        - previous_start
        - previous_end
        - new_start
        - new_end
        - rescheduled_at
        - source
  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.