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

# Export a resource's changed rows (incremental CDC feed)

> Streams the rows of `:resource` whose `updated_at` is past the watermark, ordered by a STABLE `(updated_at, id)` keyset, for the data-platform's change-data-capture pull into Databricks. Pass `since` (ISO 8601, exclusive) for the first pull / a coarse restart, then walk the feed with the opaque `cursor` from each response's `nextCursor` while `hasMore` is true (the cursor supersedes `since` and makes a tie on `updated_at` dup-free). Rows are the table's own columns as JSON and DELIBERATELY INCLUDE soft-deleted (tombstoned) rows — each carries `deleted_at` (null when live) so the consumer applies the deletion. Machine-only: authenticate with the data-platform service token in `X-Internal-Token`.



## OpenAPI

````yaml /openapi.json get /v1/export/{resource}
openapi: 3.0.3
info:
  title: Solya POS API
  version: 1.0.0
  description: >-
    The Solya POS backend HTTP surface. Every documented operation is
    agent-ready: it carries an `operationId`, an agent-facing `description`, the
    `pos.*` scopes it enforces (`x-required-permissions`) and an `x-agent-tier`.
    Success responses return the payload as raw JSON; failures return the
    `ErrorResponse` envelope (`{ error: { code, message, statusCode } }`).
servers:
  - url: /
    description: The backend, relative to its deployed origin.
security: []
paths:
  /v1/export/{resource}:
    get:
      tags:
        - Data platform
      summary: Export a resource's changed rows (incremental CDC feed)
      description: >-
        Streams the rows of `:resource` whose `updated_at` is past the
        watermark, ordered by a STABLE `(updated_at, id)` keyset, for the
        data-platform's change-data-capture pull into Databricks. Pass `since`
        (ISO 8601, exclusive) for the first pull / a coarse restart, then walk
        the feed with the opaque `cursor` from each response's `nextCursor`
        while `hasMore` is true (the cursor supersedes `since` and makes a tie
        on `updated_at` dup-free). Rows are the table's own columns as JSON and
        DELIBERATELY INCLUDE soft-deleted (tombstoned) rows — each carries
        `deleted_at` (null when live) so the consumer applies the deletion.
        Machine-only: authenticate with the data-platform service token in
        `X-Internal-Token`.
      operationId: exportResourceChanges
      parameters:
        - schema:
            type: string
            format: date-time
            pattern: >-
              ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
          in: query
          name: since
          required: false
          description: >-
            ISO 8601 EXCLUSIVE lower bound on `updated_at` (`updated_at >
            since`). Use for the first pull or a coarse restart; omit for a full
            snapshot. Superseded by `cursor`.
        - schema:
            type: string
            minLength: 1
          in: query
          name: cursor
          required: false
          description: >-
            Opaque page token from a prior response's `nextCursor`. Resumes
            STRICTLY after the last returned `(updated_at, id)`, so a tie on
            `updated_at` never dups or skips. When present it supersedes
            `since`. A malformed cursor is a 400.
        - schema:
            type: integer
            minimum: 1
            maximum: 9007199254740991
          in: query
          name: limit
          required: false
          description: >-
            Max rows to return (default 200, clamped to 500). Fetch further
            pages via `nextCursor` while `hasMore` is true.
        - schema:
            type: string
            minLength: 1
          in: path
          name: resource
          required: true
          description: >-
            The registry name of the resource (table) to stream. Known:
            products, skus, prices, brands, suppliers, taxonomyAxes, promotions,
            coupons, customers, inventoryStock, inventoryMovements,
            transactions, transactionItems, salesTickets, stores, regions. An
            unknown name is a 404.
      responses:
        '200':
          description: >-
            One page of changed rows (incl. tombstones) plus the next-page
            cursor.
          content:
            application/json:
              schema:
                type: object
                properties:
                  items:
                    type: array
                    items:
                      type: object
                      additionalProperties: {}
                      description: >-
                        One row of the resource's table, keyed by its real
                        (snake_case) database column names, values verbatim.
                        ALWAYS carries `created_at`, `updated_at` and
                        `deleted_at` (null for a live row, an ISO instant for a
                        tombstoned/soft-deleted one — the consumer applies the
                        delete).
                    description: The changed rows for this page (may be empty).
                  nextCursor:
                    nullable: true
                    description: >-
                      Opaque token for the next page, or `null` when the feed is
                      drained.
                    type: string
                  hasMore:
                    type: boolean
                    description: Whether more rows remain beyond this page.
                required:
                  - items
                  - nextCursor
                  - hasMore
                additionalProperties: false
                description: >-
                  One page of changed rows (incl. tombstones) plus the next-page
                  cursor.
                example:
                  items:
                    - id: prod-espresso-01
                      name: Espresso Intenso 1kg
                      is_active: true
                      brand_id: brand-solya
                      created_at: '2026-07-01T09:00:00.000Z'
                      updated_at: '2026-07-20T14:30:00.000Z'
                      deleted_at: null
                    - id: prod-discontinued-07
                      name: Old Blend 500g
                      is_active: false
                      brand_id: brand-solya
                      created_at: '2025-01-10T08:00:00.000Z'
                      updated_at: '2026-07-20T14:30:00.000Z'
                      deleted_at: '2026-07-20T14:30:00.000Z'
                  nextCursor: >-
                    eyJ0IjoiMjAyNi0wNy0yMFQxNDozMDowMC4wMDBaIiwiaWQiOiJwcm9kLWRpc2NvbnRpbnVlZC0wNyJ9
                  hasMore: true
        '400':
          description: >-
            The request failed schema validation; `error.fieldErrors` lists the
            fields.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorResponse'
        '401':
          description: No valid credential was presented — send a bearer token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: No resource matches the addressed identifier.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: An unexpected server error — safe to retry idempotent requests.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - internalToken: []
components:
  schemas:
    ValidationErrorResponse:
      type: object
      required:
        - error
      additionalProperties: false
      description: >-
        A `VALIDATION_FAILED` envelope carrying the offending fields in
        `fieldErrors`.
      properties:
        error:
          type: object
          required:
            - code
            - message
            - statusCode
          additionalProperties: false
          properties:
            code:
              type: string
              enum:
                - VALIDATION_FAILED
            message:
              type: string
            statusCode:
              type: integer
            fieldErrors:
              type: array
              description: >-
                One entry per rejected field: the field path and why it was
                rejected.
              items:
                type: object
                required:
                  - field
                  - message
                additionalProperties: false
                properties:
                  field:
                    type: string
                    description: Dot-path of the offending field.
                  message:
                    type: string
                    description: Why the field was rejected.
    ErrorResponse:
      type: object
      required:
        - error
      additionalProperties: false
      description: The uniform failure envelope every non-2xx response returns.
      properties:
        error:
          type: object
          required:
            - code
            - message
            - statusCode
          additionalProperties: false
          properties:
            code:
              type: string
              enum:
                - VALIDATION_FAILED
                - UNAUTHORIZED
                - FORBIDDEN
                - NOT_FOUND
                - CONFLICT
                - BUSINESS_RULE_VIOLATION
                - INTERNAL_ERROR
              description: >-
                Machine-readable kernel `ResultCode` — branch on this, not on
                `message`.
            message:
              type: string
              description: >-
                Human-readable explanation. Safe to surface; never leaks server
                internals.
            statusCode:
              type: integer
              description: >-
                The HTTP status, mirrored into the body so a client need not
                read headers.
  securitySchemes:
    internalToken:
      type: apiKey
      in: header
      name: X-Internal-Token
      description: >-
        The data-platform SERVICE token (`DATA_PLATFORM_API_TOKEN`) in the
        `X-Internal-Token` header. Guards the machine-only incremental CDC
        export; not a user credential and never a POS session — reachable only
        server-to-server.

````