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

# Update a SaaS provisioning rule draft

> Overwrite the draft of the natural-language provisioning rule for this SaaS, and optionally publish it in the same call. You must provide the COMPLETE rule text — this fully replaces the draft, it does not append. Call getSaasById first and re-send the full, edited body. With `publish: true` the new draft goes live immediately, which is the one-call path for a change the user has already confirmed; without it the draft is written but stays offline until publishSaasRule is called.

<span className="badge-write">Key: Write</span><span className="badge-company">Scope: Company</span>


## OpenAPI

````yaml https://api.getprimo.com/openapi.json put /saas/{saasId}/rule
openapi: 3.1.1
info:
  title: Public API - BETA
  description: Read docs on https://docs.getprimo.com/
  version: '1.0'
  contact: {}
servers:
  - url: https://api.getprimo.com
security:
  - apikey: []
tags: []
paths:
  /saas/{saasId}/rule:
    put:
      tags:
        - Saas
      summary: Update a SaaS provisioning rule draft
      description: >-
        Overwrite the draft of the natural-language provisioning rule for this
        SaaS, and optionally publish it in the same call. You must provide the
        COMPLETE rule text — this fully replaces the draft, it does not append.
        Call getSaasById first and re-send the full, edited body. With `publish:
        true` the new draft goes live immediately, which is the one-call path
        for a change the user has already confirmed; without it the draft is
        written but stays offline until publishSaasRule is called.
      operationId: updateSaasRule
      parameters:
        - name: saasId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateSaasRuleBody'
      responses:
        default:
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SaasRule_Output'
components:
  schemas:
    UpdateSaasRuleBody:
      type: object
      properties:
        content:
          description: >-
            The COMPLETE new provisioning rule text. This fully replaces the
            draft — it is not appended.
          type: string
        publish:
          description: >-
            Set to true to publish the rule in the same call: the draft is
            written and immediately copied to the published text the agent reads
            at runtime. Use it when the user has already confirmed the change —
            a unitary request such as "block anyone outside Finance from admin
            access" is that confirmation — so one edit costs one approval
            instead of two. Leave it out for an open-ended rewrite the user has
            not seen yet: the draft is saved and stays offline until
            publishSaasRule.
          type: boolean
      required:
        - content
    SaasRule_Output:
      type: object
      properties:
        rule:
          description: >-
            Provisioning rule configured for this SaaS, or null if no rule has
            been authored yet.
          anyOf:
            - type: object
              properties:
                draft:
                  description: >-
                    The editable draft prompt for this SaaS provisioning rule.
                    This is the text updateSaasRule writes.
                  type: string
                published:
                  description: >-
                    The prompt the agent evaluates at runtime when reviewing
                    provisioning for this SaaS, or null if never published. Diff
                    it against the draft to surface pending edits.
                  anyOf:
                    - type: string
                    - type: 'null'
                status:
                  description: >-
                    Publication state. "unpublished": never published (or
                    hidden). "pending-changes": the draft has edits not yet
                    published. "published": the draft matches the published
                    text.
                  type: string
                  enum:
                    - unpublished
                    - pending-changes
                    - published
              required:
                - draft
                - published
                - status
              additionalProperties: false
            - type: 'null'
      required:
        - rule
      additionalProperties: false
  securitySchemes:
    apikey:
      scheme: bearer
      bearerFormat: API key
      type: http
      description: >-
        Use your Primo API key in the Authorization header as `Bearer
        <API_KEY>`.

````