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

# Replay the organization's change feed from a cursor

> Every committed change to patients (demographics, contact, address, MRN), identity links, appointments (including EHR removals) and bills (including coding and archival), in commit order. Store `nextCursor` and resume from it: the feed never reorders behind a cursor, so a resumed read misses nothing. Events say what changed, not its new state — read the resource. The `changes.available` webhook only wakes you; replay is what recovers a lost delivery. Retention is 30 days; an older cursor is a 409 `cursor_expired`.



## OpenAPI

````yaml /openapi-v4.json get /changes
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:
  /changes:
    get:
      tags:
        - Changes
      summary: Replay the organization's change feed from a cursor
      description: >-
        Every committed change to patients (demographics, contact, address,
        MRN), identity links, appointments (including EHR removals) and bills
        (including coding and archival), in commit order. Store `nextCursor` and
        resume from it: the feed never reorders behind a cursor, so a resumed
        read misses nothing. Events say what changed, not its new state — read
        the resource. The `changes.available` webhook only wakes you; replay is
        what recovers a lost delivery. Retention is 30 days; an older cursor is
        a 409 `cursor_expired`.
      operationId: ChangesPublicController_listChanges
      parameters:
        - name: after
          required: false
          in: query
          description: >-
            Return changes after this cursor (exclusive). Omit to start at the
            oldest change still retained. A cursor older than retention is a
            409.
          schema:
            example: '184467'
            type: string
        - name: limit
          required: false
          in: query
          description: 1–1000, default 500.
          schema:
            example: 500
            type: number
        - name: types
          required: false
          in: query
          description: >-
            Comma-separated change types to return. Defaults to every type your
            scopes allow.
          schema:
            type: array
            items:
              type: string
              enum:
                - patient.changed
                - patient.identity_changed
                - patient.contact_source_changed
                - appointment.changed
                - appointment.removed
                - bill.changed
                - bill.removed
        - 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/ChangeFeedSuccessResponse'
        '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'
        '409':
          description: Resource conflict (e.g. editing a signed note)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiConflictResponse'
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiRateLimitResponse'
      security:
        - api-key: []
components:
  schemas:
    ChangeFeedSuccessResponse:
      type: object
      properties:
        code:
          type: string
          description: Response code
          example: success
        data:
          $ref: '#/components/schemas/ChangeFeedData'
      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
    PublicApiConflictResponse:
      type: object
      properties:
        code:
          type: string
          description: Error code
          example: conflict
        message:
          type: string
          description: Human-readable error message
          example: Cannot edit a signed note
        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
    ChangeFeedData:
      type: object
      properties:
        changes:
          type: array
          items:
            $ref: '#/components/schemas/ChangeFeedItem'
        nextCursor:
          type: string
          description: >-
            Pass as `after` to continue. When `hasMore` is false it is the feed
            head, which may be past the last change returned — always store it,
            even after an empty page.
        hasMore:
          type: boolean
      required:
        - changes
        - nextCursor
        - hasMore
    ChangeFeedItem:
      type: object
      properties:
        cursor:
          type: string
          description: Feed position, and this change's version. Strictly increasing.
          example: '184468'
        type:
          type: string
          enum:
            - patient.changed
            - patient.identity_changed
            - patient.contact_source_changed
            - appointment.changed
            - appointment.removed
            - bill.changed
            - bill.removed
        resourceId:
          type: string
          description: 'The changed resource: `pat_…`, `apt_…` or `bil_…`.'
          example: apt_9f8e7d6c5b4a39281706f5e4d3c2b1a0
        patientId:
          type: string
          nullable: true
          description: >-
            The source chart the resource belongs to, when its EHR patient is
            mirrored.
          example: pat_c56103bcd39c46d39f3138dd2b5e05f6
        instanceId:
          type: string
          nullable: true
          description: EHR instance of the resource.
        occurredAt:
          type: string
          description: When the change was committed (database clock).
      required:
        - cursor
        - type
        - resourceId
        - patientId
        - instanceId
        - occurredAt
  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.