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

# Generic deal update write-back

> Lets Zapier or external systems write back arbitrary meta fields to a
deal. Reserved keys (`deal_uuid`, `deal_id`) are silently skipped.
Post-level fields (`post_title`, `post_status`, `post_content`) are
applied via `wp_update_post()`; all other keys become post-meta.

Requires the `X-API-Key` header.




## OpenAPI

````yaml /openapi/private/specs/wp/wp-webhooks.yml patch /deal/{uuid}
openapi: 3.1.0
info:
  title: >-
    SageScreen — Webhooks & CRM Integrations (Billing · Council · User · Deal ·
    Sage)
  version: 1.0.0
servers:
  - url: https://{domain}/wp-json/sagescreen/v1
    description: WordPress REST API
    variables:
      domain:
        default: api.sagescreen.app
security: []
tags:
  - name: Billing – Stripe
    description: Stripe webhook and subscription endpoints
  - name: Billing – Broadcast
    description: Postmark broadcast unsubscribe endpoint
  - name: Billing – Pipedrive
    description: Pipedrive CRM ID set-* webhook endpoints (called by Zapier)
  - name: Billing – AJAX
    description: Credit ledger, reactivation, and portal AJAX endpoints
  - name: Council – REST
    description: Zapier-facing REST endpoints for council data sync
  - name: Council – AJAX
    description: Council user and sage management AJAX endpoints
  - name: User – REST
    description: Zapier-facing REST endpoints
  - name: User – AJAX
    description: Council user management AJAX endpoints
  - name: User – Profile
    description: Self-service profile updates
  - name: Deal REST
    description: REST API endpoints authenticated via X-API-Key
  - name: Deal AJAX
    description: AJAX endpoints authenticated via WordPress nonce + capability check
  - name: Sage – REST
    description: REST API endpoints for sage operations and Python callbacks
  - name: Sage – CRUD
    description: AJAX endpoints for sage creation, editing, and status management
  - name: Sage – Build Workflow
    description: AJAX endpoints for the multi-step sage build process
paths:
  /deal/{uuid}:
    patch:
      tags:
        - Deal REST
      summary: Generic deal update write-back
      description: |
        Lets Zapier or external systems write back arbitrary meta fields to a
        deal. Reserved keys (`deal_uuid`, `deal_id`) are silently skipped.
        Post-level fields (`post_title`, `post_status`, `post_content`) are
        applied via `wp_update_post()`; all other keys become post-meta.

        Requires the `X-API-Key` header.
      operationId: dealUpdate
      parameters:
        - name: uuid
          in: path
          required: true
          description: Deal UUID (`deal_uuid` meta value)
          schema:
            type: string
            format: uuid
            examples:
              - 3d55ae7a-af8b-46c1-ae1c-09afa207ac7f
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DealUpdateRequest'
            examples:
              updateMeta:
                summary: Write back quote ID
                value:
                  external_quote_id: QU-00412
              updateStatus:
                summary: Update post-level status
                value:
                  post_status: ss_invoiced
                  external_invoice_id: INV-00589
      responses:
        '200':
          description: Fields updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DealUpdateResponse'
              example:
                success: true
                data:
                  deal_id: 1042
                  deal_uuid: 3d55ae7a-af8b-46c1-ae1c-09afa207ac7f
                  updated:
                    external_quote_id: QU-00412
        '400':
          description: Empty request body
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DealPublicWPError'
              example:
                code: empty_body
                message: Request body must be a non-empty JSON object
                data:
                  status: 400
        '401':
          description: Missing or invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DealPublicWPError'
              example:
                code: invalid_api_key
                message: Invalid or missing API key
                data:
                  status: 401
        '404':
          description: Deal not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DealPublicWPError'
              example:
                code: deal_not_found
                message: Deal not found
                data:
                  status: 404
        '500':
          description: API key not configured
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DealPublicWPError'
              example:
                code: key_not_configured
                message: API key not configured on server
                data:
                  status: 500
      security:
        - apiKey: []
components:
  schemas:
    DealUpdateRequest:
      type: object
      description: >
        Arbitrary key-value pairs. Post-level fields (`post_title`,
        `post_status`,

        `post_content`) update the post; all others become post-meta. Reserved

        keys `deal_uuid` and `deal_id` are silently ignored.
      additionalProperties: true
    DealUpdateResponse:
      type: object
      properties:
        success:
          type: boolean
          const: true
        data:
          type: object
          properties:
            deal_id:
              type: integer
              examples:
                - 1042
            deal_uuid:
              type: string
              format: uuid
              examples:
                - 3d55ae7a-af8b-46c1-ae1c-09afa207ac7f
            updated:
              type: object
              description: Map of field names to their new values
              additionalProperties: true
              examples:
                - external_quote_id: QU-00412
    DealPublicWPError:
      type: object
      description: Standard WordPress REST API error envelope
      required:
        - code
        - message
        - data
      properties:
        code:
          type: string
          description: Machine-readable error code
          examples:
            - deal_not_found
        message:
          type: string
          description: Human-readable error message
          examples:
            - Deal not found
        data:
          type: object
          required:
            - status
          properties:
            status:
              type: integer
              description: HTTP status code
              examples:
                - 404
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: X-API-Key
      description: SageScreen API key stored in `ss_zapier_api_key` option

````