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

# Update Draft RLS Rule

> Update a row-level security rule on the workspace's draft: its name, whether it is enabled or optional, or its configuration. A configuration is replaced whole. A rule's type cannot change; delete it and create another. Changes only the draft.



## OpenAPI

````yaml patch /v2/api/projects/{projectId}/workspaces/{workspaceId}/draft/rls/{ruleId}
openapi: 3.1.0
info:
  title: Upsolve API
  version: 1.5.0
servers:
  - url: https://api.upsolve.ai
security: []
tags: []
paths:
  /v2/api/projects/{projectId}/workspaces/{workspaceId}/draft/rls/{ruleId}:
    patch:
      summary: Update a row-level security rule on the workspace…
      description: >-
        Update a row-level security rule on the workspace's draft: its name,
        whether it is enabled or optional, or its configuration. A configuration
        is replaced whole. A rule's type cannot change; delete it and create
        another. Changes only the draft.
      operationId: PatchV2ApiProjectsProjectIdWorkspacesWorkspaceIdDraftRlsRuleId
      parameters:
        - name: projectId
          in: path
          required: true
          description: >-
            PATCH
            /v2/api/projects/:projectId/workspaces/:workspaceId/draft/rls/:ruleId
            Parameter
          schema:
            type: string
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$
        - name: workspaceId
          in: path
          required: true
          description: >-
            PATCH
            /v2/api/projects/:projectId/workspaces/:workspaceId/draft/rls/:ruleId
            Parameter
          schema:
            type: string
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$
        - name: ruleId
          in: path
          required: true
          description: >-
            PATCH
            /v2/api/projects/:projectId/workspaces/:workspaceId/draft/rls/:ruleId
            Parameter
          schema:
            type: string
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$
      requestBody:
        description: >-
          PATCH
          /v2/api/projects/:projectId/workspaces/:workspaceId/draft/rls/:ruleId
          Request body
        content:
          application/json:
            schema:
              type: object
              properties:
                apiKey:
                  type: string
                  minLength: 1
                  description: >-
                    Upsolve API key, generated under Account → Developer
                    settings in the Upsolve Hub. Keys are user-scoped: pass
                    organizationId alongside the key to select which org to act
                    on.
                  examples:
                    - up_embed_************
                organizationId:
                  description: >-
                    Your Upsolve organization's UUID — the org that owns the API
                    key and project. This is NOT a project organization: do not
                    pass a value registered via /projects/register-organization,
                    and do not pass an `externalId` (only
                    `projectOrganizationId` accepts those). Omit it when using
                    an org-bound API key — the org is read from the key and any
                    value sent here is ignored. Required only for user-scoped
                    API keys (created under Account → Developer settings) and
                    for the Supabase JWT path, where the org is ambiguous and
                    membership is verified against it.
                  examples:
                    - 123e4567-e89b-12d3-a456-426614174000
                  type: string
                  format: uuid
                  pattern: >-
                    ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$
                lockVersion:
                  type: integer
                  minimum: 0
                  maximum: 9007199254740991
                  description: >-
                    The lockVersion of the row being edited; stale values yield
                    412
                name:
                  description: A label for the rule. Presentation only.
                  type:
                    - string
                    - 'null'
                enabled:
                  description: A disabled rule filters nothing.
                  type: boolean
                optional:
                  description: >-
                    An optional rule is dropped for an end user missing its
                    property, instead of refusing their query. Leave it off for
                    a tenant filter: an optional tenant filter shows a user
                    without the property every row.
                  type: boolean
                schemaConfig:
                  type:
                    - object
                    - 'null'
                  properties:
                    schemaProperty:
                      type: string
                      description: >-
                        The property naming the schema each governed table is
                        read from, as `user.<property>` or
                        `organization.<property>`.
                  required:
                    - schemaProperty
                  description: 'For a schema rule: which property names the schema.'
                columnConfig:
                  type:
                    - object
                    - 'null'
                  properties:
                    columnName:
                      type: string
                      description: >-
                        The column to filter on, matched exactly. Every governed
                        table that has a column of this name is filtered; tables
                        without it are not.
                    propertyPath:
                      type: string
                      description: >-
                        The property the column is compared against, as
                        `user.<property>` or `organization.<property>`. Ignored
                        by IS NULL and IS NOT NULL.
                    operator:
                      type: string
                      enum:
                        - '='
                        - '!='
                        - IN
                        - IS NULL
                        - IS NOT NULL
                      description: >-
                        How the column is compared. IN takes a list-valued
                        property.
                  required:
                    - columnName
                    - propertyPath
                    - operator
                  description: >-
                    For a column rule: which column is compared against which
                    property.
              required:
                - lockVersion
            examples:
              example1:
                value:
                  apiKey: up_embed_************
                  organizationId: 123e4567-e89b-12d3-a456-426614174000
        required: true
      responses:
        '200':
          description: >-
            PATCH
            /v2/api/projects/:projectId/workspaces/:workspaceId/draft/rls/:ruleId
            Positive response
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    const: success
                  data:
                    type: object
                    properties:
                      rule:
                        type: object
                        properties:
                          id:
                            type: string
                          name:
                            type:
                              - string
                              - 'null'
                          type:
                            type: string
                            enum:
                              - schema
                              - column
                          enabled:
                            type: boolean
                          optional:
                            type: boolean
                          schemaConfig: {}
                          columnConfig: {}
                          lockVersion:
                            type: number
                          createdAt:
                            type: string
                          updatedAt:
                            type: string
                        required:
                          - id
                          - name
                          - type
                          - enabled
                          - optional
                          - schemaConfig
                          - columnConfig
                          - lockVersion
                          - createdAt
                          - updatedAt
                        additionalProperties: false
                    required:
                      - rule
                    additionalProperties: false
                required:
                  - status
                  - data
                additionalProperties: false
        '400':
          description: >-
            PATCH
            /v2/api/projects/:projectId/workspaces/:workspaceId/draft/rls/:ruleId
            Negative response
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    const: error
                  error:
                    type: object
                    properties:
                      message:
                        type: string
                      code:
                        type: string
                      details:
                        type: object
                        propertyNames:
                          type: string
                        additionalProperties: {}
                    required:
                      - message
                    additionalProperties: false
                required:
                  - status
                  - error
                additionalProperties: false
      security:
        - APIKEY_1: []
components:
  securitySchemes:
    APIKEY_1:
      type: apiKey
      in: query
      name: apiKey
      x-in-actual: body
      description: apiKey MUST be supplied within the request body instead of query

````

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