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

# Update the rows matching a filter

> A **partial patch** of every row matching `filters`: only the columns in `values` are written, the rest are left alone. Returns the updated rows as stored.

**`filters` is required and must be non-empty.** Paige does not run an unconstrained UPDATE over this API — an empty or missing filter is `400`, not a whole-table write. Predicates are AND-joined; up to 20. Ops: `eq`, `neq`, `gt`, `gte`, `lt`, `lte`, `is`.

**`like` and `ilike` are read-only** and are rejected here (`400 filter_op_not_allowed`). A pattern match has no bounded row set — `like` with a `%` pattern can match the whole table and looks no different from a narrow one — so Paige will not write through one. Read the rows you mean from `GET /v1/tables/{table}/rows`, then update them by primary key.

**`values` must set at least one column** (`400 empty_payload`).

**Primary-key columns cannot be changed** (`400 primary_key_immutable`) — delete the row and insert a replacement instead. Every other column you name is checked against the table's real columns (`400 unknown_column`).

A column whose name collides with a reserved database query parameter (`select`, `order`, `limit`, `offset`, `columns`, `and`, `or`, `not`, `on_conflict`) cannot be used as a *filter* column — the predicate would be silently discarded, so it is refused with `400 reserved_filter_column`.

Defaults to the `public` (production) schema.

A Paige platform table is `403 platform_table_forbidden`; an unknown table is `404 table_not_found`.

**Only base tables are addressable.** A view (or any other non-table relation) answers the same `404 table_not_found` an unknown name does — including a view defined over a Paige platform table, which would otherwise be a writable alias for it.

**Required scope:** `tables:write`



## OpenAPI

````yaml /api-reference/openapi.json patch /v1/tables/{table}/rows
openapi: 3.1.0
info:
  title: Paige API
  version: 1.0.0
  description: >-
    The Paige public REST API (`/v1`). Build WhatsApp automations against your
    Paige project: send messages, manage templates, read conversations, tag
    contacts, assemble broadcasts, edit bot code + flows, and register signed
    webhooks.


    ## Authentication

    Every `/v1` request authenticates with a project API key: `Authorization:
    Bearer pk_live_…`. Mint and scope keys in **Settings → API keys**. A key
    carries its own project context, so `/v1` paths never include a project id.


    ## Scopes

    Each endpoint requires one or more scopes (see each operation, and the
    `x-required-scopes` extension). Grant a key only the scopes it needs. A key
    missing a required scope gets `403 insufficient_scope`.


    ## Response envelope

    Success: `{ "success": true, "data": … }`. Error: `{ "success": false,
    "error": { "code", "message" }, "request_id" }`. Some errors add
    `error.details` with structured extras (e.g. `quota_exceeded` carries
    `limit` + `resetAt`) — read it defensively, its keys depend on the code. The
    `request_id` is also returned as the `X-Request-Id` header on every
    response.


    ## Rate limits & quota

    Requests are throttled per key (`RateLimit-*` headers; exceed → `429
    rate_limited`). WhatsApp sends also draw down a daily quota (exceed → `429
    quota_exceeded`). Both carry `Retry-After`.


    ## Idempotency

    Send an `Idempotency-Key` header on `POST /v1/messages` to make retries safe
    — a completed key replays the stored response and never re-sends.


    ## Webhook signatures

    Outbound webhook deliveries carry `X-Paige-Signature:
    t=<unix>,v1=<hmac_sha256>`. Verify with the reference `verifyPaigeSignature`
    helper (constant-time HMAC over `"<t>.<rawBody>"`, 300s tolerance).
  contact:
    name: Paige
    url: https://paigeme.dev
servers:
  - url: https://api.paigeme.dev
    description: Production
security:
  - ApiKeyAuth: []
tags:
  - name: Meta
    description: Smoke / diagnostics.
  - name: Messages
    description: Send messages and read delivery status + media.
  - name: Conversations
    description: List conversations, read messages, set state.
  - name: Contacts
    description: Read contact messages; update names, tags, attributes.
  - name: Templates
    description: WhatsApp message template CRUD.
  - name: Broadcasts
    description: Segments + broadcast assembly (always pending_approval).
  - name: Build
    description: Read/edit bot code, deploy, read/generate/update flows.
  - name: Tables
    description: >-
      Read and write the project's own database tables. Paige platform tables
      are denied, and an update or delete must always be filtered.
  - name: Media
    description: >-
      Upload, list, retrieve and delete the project's media assets. The slug an
      upload returns is what the bot sends by.
  - name: Webhooks
    description: Register signed outbound webhooks.
paths:
  /v1/tables/{table}/rows:
    patch:
      tags:
        - Tables
      summary: Update the rows matching a filter
      description: >-
        A **partial patch** of every row matching `filters`: only the columns in
        `values` are written, the rest are left alone. Returns the updated rows
        as stored.


        **`filters` is required and must be non-empty.** Paige does not run an
        unconstrained UPDATE over this API — an empty or missing filter is
        `400`, not a whole-table write. Predicates are AND-joined; up to 20.
        Ops: `eq`, `neq`, `gt`, `gte`, `lt`, `lte`, `is`.


        **`like` and `ilike` are read-only** and are rejected here (`400
        filter_op_not_allowed`). A pattern match has no bounded row set — `like`
        with a `%` pattern can match the whole table and looks no different from
        a narrow one — so Paige will not write through one. Read the rows you
        mean from `GET /v1/tables/{table}/rows`, then update them by primary
        key.


        **`values` must set at least one column** (`400 empty_payload`).


        **Primary-key columns cannot be changed** (`400 primary_key_immutable`)
        — delete the row and insert a replacement instead. Every other column
        you name is checked against the table's real columns (`400
        unknown_column`).


        A column whose name collides with a reserved database query parameter
        (`select`, `order`, `limit`, `offset`, `columns`, `and`, `or`, `not`,
        `on_conflict`) cannot be used as a *filter* column — the predicate would
        be silently discarded, so it is refused with `400
        reserved_filter_column`.


        Defaults to the `public` (production) schema.


        A Paige platform table is `403 platform_table_forbidden`; an unknown
        table is `404 table_not_found`.


        **Only base tables are addressable.** A view (or any other non-table
        relation) answers the same `404 table_not_found` an unknown name does —
        including a view defined over a Paige platform table, which would
        otherwise be a writable alias for it.


        **Required scope:** `tables:write`
      operationId: updateTableRows
      parameters:
        - schema:
            type: string
            pattern: ^[a-z_][a-z0-9_]{0,62}$
            description: >-
              Table name. Lowercase letters, digits and underscores only. Paige
              platform tables are rejected.
          required: true
          description: >-
            Table name. Lowercase letters, digits and underscores only. Paige
            platform tables are rejected.
          name: table
          in: path
        - schema:
            type: string
            description: >-
              Target project id, for an MCP OAuth bearer (`mcp_at_…`) attached
              to more than one project — get ids from `GET /v1/projects`.
              Matched case-insensitively.


              Omit it and a READ falls back to the connection's default project;
              a **mutation** (any non-GET) on a connection with 2+ projects is
              rejected with `400 project_required` — a write is never defaulted
              to a guessed project. A connection with exactly one project never
              needs the header.


              Scopes are checked against the SELECTED project only, never a
              union across the connection.


              For a `pk_` API key the header selects nothing — one key is one
              project's context — but it IS validated: omit it and the key's own
              project is used, send it and it must name that project, otherwise
              the call is rejected with `403 project_not_attached` (a blank
              value is `400 invalid_project_header`, as above).
          required: false
          name: X-Paige-Project
          in: header
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                schema:
                  type: string
                  enum:
                    - public
                    - preview
                  description: >-
                    Which database schema to target: "public" (production, the
                    default) or "preview" (dev sandbox).
                values:
                  type: object
                  additionalProperties:
                    anyOf:
                      - type: string
                      - type: number
                      - type: boolean
                      - type: 'null'
                      - type: object
                        additionalProperties: {}
                      - type: array
                        items: {}
                      - type: 'null'
                    description: >-
                      A column value: string, number, boolean, null, or a JSON
                      object/array for json/jsonb columns.
                  description: >-
                    Columns to set on every matched row, at least one. A partial
                    patch — columns you omit are left unchanged.
                filters:
                  type: array
                  items:
                    type: object
                    properties:
                      column:
                        type: string
                        pattern: ^[a-z_][a-z0-9_]{0,62}$
                        description: >-
                          Column name. Must be a column that actually exists on
                          the table.
                      op:
                        type: string
                        enum:
                          - eq
                          - neq
                          - gt
                          - gte
                          - lt
                          - lte
                          - is
                        description: >-
                          Comparison operator. `like` and `ilike` are NOT
                          accepted on an update or delete — pattern-matched
                          writes are refused; read the rows first, then write by
                          key.
                      value:
                        anyOf:
                          - type: string
                          - type: number
                          - type: boolean
                          - type: 'null'
                          - type: 'null'
                        description: >-
                          Value to compare against. Only op "is" accepts null
                          (or the string "null") — every other op rejects it, so
                          use `is` to match NULL. With op "is" only null, true
                          or false are accepted; with "like"/"ilike" it is a SQL
                          LIKE pattern ("%" and "_" are the wildcards).
                    required:
                      - column
                      - op
                      - value
                    description: One predicate. Multiple filters are AND-joined.
                  description: >-
                    Which rows to affect. REQUIRED and non-empty: 1-20
                    AND-joined predicates. Ops: eq, neq, gt, gte, lt, lte, is —
                    `like`/`ilike` are read-only. An unfiltered update or delete
                    is rejected, never executed against the whole table.
              required:
                - values
                - filters
              additionalProperties: false
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - true
                  data:
                    type: object
                    properties:
                      table:
                        type: string
                      schema:
                        type: string
                      updated:
                        type: number
                        description: How many rows matched the filters and were updated.
                      rows:
                        type: array
                        items:
                          type: object
                          additionalProperties: {}
                          description: One row, shaped by your table.
                        description: The updated rows as stored.
                    required:
                      - table
                      - schema
                      - updated
                      - rows
                required:
                  - success
                  - data
        '400':
          description: >-
            Validation / bad request (e.g. `invalid_request`, `invalid_cursor`,
            `invalid_template` for a Meta 4xx rejection of a template payload,
            which carries Meta's own detail as the message; note
            `outside_24h_window` is 409, not 400). Also `invalid_project_header`
            (any credential: `X-Paige-Project` was sent but blank) and, for
            multi-project MCP bearers, `project_required` (a mutation, or a read
            with no default, and no `X-Paige-Project`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: >-
            Missing or invalid API key (`api_key_required` / `invalid_api_key` /
            `invalid_token` for a revoked or expired OAuth bearer).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: >-
            Key lacks the required scope, project inactive, or a write targets a
            platform-protected file (`insufficient_scope` / `project_inactive` /
            `subscription_inactive` / `protected_file`). Also
            `project_not_attached` (the `X-Paige-Project` project is not one
            this credential may act on — not attached to the MCP connection, or
            not the `pk_` key's own project; identical response whether or not
            it exists) and, for MCP bearers, `no_project_access` (the connection
            has no projects attached).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Resource not found (`not_found` / `*_not_found`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '409':
          description: >-
            Conflict — 24h window closed (`outside_24h_window`) or idempotency
            (`idempotency_in_progress` / `idempotency_key_mismatch`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: >-
            Rate limit (`rate_limited`) or daily send quota (`quota_exceeded`)
            exceeded. Carries `RateLimit-*` + `Retry-After` headers.
          headers:
            RateLimit-Limit:
              description: Requests permitted in the current window.
              schema:
                type: integer
            RateLimit-Remaining:
              description: Requests remaining in the current window.
              schema:
                type: integer
            RateLimit-Reset:
              description: Seconds until the window resets.
              schema:
                type: integer
            Retry-After:
              description: Seconds to wait before retrying.
              schema:
                type: integer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Unexpected server error (`server_error`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - false
        error:
          $ref: '#/components/schemas/ApiError'
        request_id:
          type: string
          description: Per-request id, also returned as the X-Request-Id header.
      required:
        - success
        - error
        - request_id
    ApiError:
      type: object
      properties:
        code:
          type: string
          description: Stable, machine-readable error code.
          example: invalid_request
        message:
          type: string
          description: Human-readable message (safe to surface).
          example: Invalid request body
        details:
          type: object
          properties: {}
          description: >-
            Structured extras for codes that carry them — the keys depend on
            `code`. `quota_exceeded` carries `limit` + `resetAt`; most errors
            omit this field entirely.
      required:
        - code
        - message
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: API key
      description: >-
        Project API key issued in Settings → API keys. Send it as
        `Authorization: Bearer pk_live_…`.

````