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

# Clinics this key can reach, and the scopes granted to it.

> For a workspace TEST key this is always one entry — the workspace's own sandbox, marked sandbox: true. For a LIVE workspace key this lists every clinic with an ACTIVE, non-expired connection that also still has API access switched on — the same set the key could actually reach on the next call, never a stale or pending one. An unverified workspace, or one with no connections yet, gets an empty list. A clinic-owned key gets exactly one entry, for its own clinic.



## OpenAPI

````yaml /openapi/ehr-api.v1.yaml get /v1/connections
openapi: 3.1.0
info:
  title: ClinikEHR API
  version: 1.0.0
  description: >-
    Server-to-server REST API for a clinic's own data, reached with a key the
    clinic (or a developer workspace) creates in the developer portal.


    Authenticate every request with `Authorization: Bearer <key>`. Test keys
    reach only your workspace's own synthetic sandbox; live keys reach the
    clinic that created them. Lists wrap their rows as `{ data, has_more,
    next_cursor }`; single resources are returned directly. Errors are
    `application/problem+json` (RFC 9457) with a stable `code`.


    Write requests accept an `Idempotency-Key` header so a retry never repeats a
    change. See the guides for authentication, permissions, pagination, rate
    limits and retries.
servers:
  - url: https://api.clinikehr.com/v1
security:
  - ApiKey: []
paths:
  /v1/connections:
    get:
      tags:
        - Connections
      summary: Clinics this key can reach, and the scopes granted to it.
      description: >-
        For a workspace TEST key this is always one entry — the workspace's own
        sandbox, marked sandbox: true. For a LIVE workspace key this lists every
        clinic with an ACTIVE, non-expired connection that also still has API
        access switched on — the same set the key could actually reach on the
        next call, never a stale or pending one. An unverified workspace, or one
        with no connections yet, gets an empty list. A clinic-owned key gets
        exactly one entry, for its own clinic.
      operationId: listConnections
      responses:
        '200':
          description: OK.
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                  - has_more
                  - next_cursor
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/ConnectionSummary'
                  has_more:
                    type: boolean
                  next_cursor:
                    type:
                      - string
                      - 'null'
              example:
                data:
                  - clinic_id: 45715198-88e4-498c-8271-57e652c60246
                    clinic_name: City Medical Center
                    environment: live
                    granted_scopes:
                      - inventory.items:read
                    connected_at: '2026-09-28T10:00:00.000Z'
                    expires_at: null
                    sandbox: false
                has_more: false
                next_cursor: null
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
        - ApiKey: []
components:
  schemas:
    ConnectionSummary:
      type: object
      required:
        - clinic_id
        - clinic_name
        - environment
        - granted_scopes
        - connected_at
        - expires_at
        - sandbox
      properties:
        clinic_id:
          type: string
          format: uuid
        clinic_name:
          type:
            - string
            - 'null'
          description: >-
            The clinic's display name — null for the synthetic sandbox (there is
            no real clinic behind it).
        environment:
          type: string
          enum:
            - live
            - test
        granted_scopes:
          type: array
          items:
            type: string
        connected_at:
          type:
            - string
            - 'null'
          format: date-time
          description: >-
            When the connection was approved. Null for a clinic-owned key's
            implicit self-connection and for the sandbox entry — neither is a
            consent-model connection row.
        expires_at:
          type:
            - string
            - 'null'
          format: date-time
          description: >-
            When a PHI-scoped connection must be re-attested. Null for a
            non-PHI-only connection, a clinic-owned key, and the sandbox entry.
        sandbox:
          type: boolean
          description: >-
            True when this entry IS the workspace's synthetic sandbox, not a
            real clinic.
    Problem:
      type: object
      description: RFC 9457 application/problem+json.
      required:
        - type
        - title
        - status
        - code
        - request_id
      properties:
        type:
          type: string
          format: uri
        title:
          type: string
        status:
          type: integer
        detail:
          type: string
        code:
          type: string
        request_id:
          type: string
        errors:
          type: array
          items:
            type: object
            required:
              - pointer
              - message
            properties:
              pointer:
                type: string
              message:
                type: string
  responses:
    Unauthorized:
      description: >-
        Missing, malformed, unknown, revoked or expired key, or the wrong
        secret.
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
    Forbidden:
      description: >-
        The key or connection lacks the required scope, the plan does not
        include this resource, the request came from an address this key's IP
        allow-list does not permit, a TEST-environment workspace key asked for a
        clinic_id other than its own workspace's sandbox (`sandbox_only`), or a
        LIVE workspace key asked for a real clinic while its workspace's
        verification has lapsed (`not_verified`) — the response never names
        which addresses ARE allowed, nor which clinic actually is the sandbox.
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
    TooManyRequests:
      description: Rate limited. See the Retry-After header.
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
  securitySchemes:
    ApiKey:
      type: http
      scheme: bearer
      bearerFormat: ehr_live_<keyId>_<secret> or ehr_test_<keyId>_<secret>

````

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