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

# A patient's lab and pathology results

> Read live from the EHR, never from the synced copy, and nothing is written. Answers 200 within 8 s, else 202 with `Location: /v4/ehr/reads/{readId}` (poll it; the result is kept 10 minutes for the same app, organization and session user). 501 `capability_unsupported` when this EHR lacks the read (see `GET /v4/ehr/capabilities`). 429 with `Retry-After` when the app's share of the EHR login is used up.



## OpenAPI

````yaml /openapi-v4.json get /ehr/patients/{patientId}/lab-results
openapi: 3.0.0
info:
  title: Max AI Public API
  description: API for third-party marketplace apps
  version: '4.0'
  contact: {}
servers:
  - url: https://api.maxcare.ai/v4
security: []
tags: []
paths:
  /ehr/patients/{patientId}/lab-results:
    get:
      tags:
        - EHR live reads
      summary: A patient's lab and pathology results
      description: >-
        Read live from the EHR, never from the synced copy, and nothing is
        written. Answers 200 within 8 s, else 202 with `Location:
        /v4/ehr/reads/{readId}` (poll it; the result is kept 10 minutes for the
        same app, organization and session user). 501 `capability_unsupported`
        when this EHR lacks the read (see `GET /v4/ehr/capabilities`). 429 with
        `Retry-After` when the app's share of the EHR login is used up.
      operationId: EhrPublicController_labResults
      parameters:
        - name: x-session-token
          in: header
          description: >-
            App Bridge session token. The user's own EHR login reads when they
            have one (`actingAs: user`).
          required: false
          schema:
            type: string
        - name: patientId
          required: true
          in: path
          schema:
            type: string
        - name: page
          required: false
          in: query
          description: Page number (1-indexed)
          schema:
            default: 1
            example: 1
        - name: pageSize
          required: false
          in: query
          description: Number of items per page (max 100)
          schema:
            default: 100
            example: 100
        - name: x-session-token
          required: true
          in: header
          schema:
            type: string
        - name: X-Organization-Id
          in: header
          required: true
          schema:
            type: string
          description: Target clinic organization ID
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EhrReadSuccessResponse'
        '202':
          description: Accepted — queued for background processing
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EhrReadAcceptedResponse'
        '400':
          description: Missing or invalid request parameter
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiBadRequestResponse'
        '401':
          description: Invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiUnauthorizedResponse'
        '403':
          description: Insufficient scope
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiForbiddenResponse'
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiNotFoundResponse'
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiRateLimitResponse'
        '501':
          description: >-
            This organization's EHR does not support the capability
            (`capability_unsupported`)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiNotImplementedResponse'
        '502':
          description: EHR sync failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiBadGatewayResponse'
      security:
        - api-key: []
components:
  schemas:
    EhrReadSuccessResponse:
      type: object
      properties:
        code:
          type: string
          description: Response code
          example: success
        data:
          description: >-
            The read's payload (named by the route, e.g. `appointments`) plus
            `meta`.
          allOf:
            - $ref: '#/components/schemas/EhrReadData'
      required:
        - code
        - data
    EhrReadAcceptedResponse:
      type: object
      properties:
        code:
          type: string
          description: Response code
          example: success
        data:
          $ref: '#/components/schemas/EhrReadAcceptedData'
      required:
        - code
        - data
    PublicApiBadRequestResponse:
      type: object
      properties:
        code:
          type: string
          description: Error code
          example: bad_request
        message:
          type: string
          description: Human-readable error message
          example: '''id'' must be a valid UUID'
        trace_id:
          type: string
          description: Trace ID for debugging
          example: 550e8400-e29b-41d4-a716-446655440000
      required:
        - code
        - message
        - trace_id
    PublicApiUnauthorizedResponse:
      type: object
      properties:
        code:
          type: string
          description: Error code
          example: unauthorized
        message:
          type: string
          description: Human-readable error message
          example: Invalid or missing API key
        trace_id:
          type: string
          description: Trace ID for debugging
          example: 550e8400-e29b-41d4-a716-446655440000
      required:
        - code
        - message
        - trace_id
    PublicApiForbiddenResponse:
      type: object
      properties:
        code:
          type: string
          description: Error code
          example: forbidden
        message:
          type: string
          description: Human-readable error message
          example: Insufficient scope
        trace_id:
          type: string
          description: Trace ID for debugging
          example: 550e8400-e29b-41d4-a716-446655440000
      required:
        - code
        - message
        - trace_id
    PublicApiNotFoundResponse:
      type: object
      properties:
        code:
          type: string
          description: Error code
          example: not_found
        message:
          type: string
          description: Human-readable error message
          example: Resource not found
        trace_id:
          type: string
          description: Trace ID for debugging
          example: 550e8400-e29b-41d4-a716-446655440000
      required:
        - code
        - message
        - trace_id
    PublicApiRateLimitResponse:
      type: object
      properties:
        code:
          type: string
          description: Error code
          example: rate_limit_exceeded
        message:
          type: string
          description: Human-readable error message
          example: Rate limit exceeded. Maximum 1000 requests per 60 seconds.
        trace_id:
          type: string
          description: Trace ID for debugging
          example: 550e8400-e29b-41d4-a716-446655440000
      required:
        - code
        - message
        - trace_id
    PublicApiNotImplementedResponse:
      type: object
      properties:
        code:
          type: string
          description: Error code
          example: capability_unsupported
        message:
          type: string
          description: Human-readable error message
          example: This organization's EHR has no appointment finder.
        trace_id:
          type: string
          description: Trace ID for debugging
          example: 550e8400-e29b-41d4-a716-446655440000
      required:
        - code
        - message
        - trace_id
    PublicApiBadGatewayResponse:
      type: object
      properties:
        code:
          type: string
          description: Error code
          example: unexpected_integration_error
        message:
          type: string
          description: Human-readable error message
          example: EHR sync failed
        trace_id:
          type: string
          description: Trace ID for debugging
          example: 550e8400-e29b-41d4-a716-446655440000
      required:
        - code
        - message
        - trace_id
    EhrReadData:
      type: object
      properties:
        meta:
          $ref: '#/components/schemas/EhrReadMetaResponse'
      required:
        - meta
    EhrReadAcceptedData:
      type: object
      properties:
        readId:
          type: string
          example: rd_0123456789abcdef0123456789abcdef
        status:
          type: string
          enum:
            - running
        pollUrl:
          type: string
          example: /v4/ehr/reads/rd_0123456789abcdef0123456789abcdef
        expiresAt:
          type: string
          description: When the stored result expires (ISO 8601).
      required:
        - readId
        - status
        - pollUrl
        - expiresAt
    EhrReadMetaResponse:
      type: object
      properties:
        source:
          type: string
          enum:
            - live
        ehr:
          type: string
          enum:
            - modmed
            - ezderm
        fetchedAt:
          type: string
          description: When the EHR answered (ISO 8601).
        completeness:
          type: string
          enum:
            - complete
            - lower_bound
          description: '`lower_bound` when the EHR''s paging stopped early.'
        actingAs:
          type: string
          enum:
            - user
            - system
          description: >-
            `user` when the `X-Session-Token` user's own EHR login made the
            read.
      required:
        - source
        - ehr
        - fetchedAt
        - completeness
        - actingAs
  securitySchemes:
    api-key:
      scheme: bearer
      bearerFormat: JWT
      type: http
      description: Marketplace API key

````

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