> ## 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.

# Store Pipedrive deal ID on a deal

> Called by Zapier after a deal is created in Pipedrive. Stores the
Pipedrive deal ID as post-meta so subsequent webhooks can reference
both the WordPress deal and the Pipedrive record.

Requires the `X-API-Key` header (`ss_zapier_api_key` option).




## OpenAPI

````yaml /openapi/private/specs/wp/wp-webhooks.yml post /pipedrive/set-deal-id
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:
  /pipedrive/set-deal-id:
    post:
      tags:
        - Deal REST
      summary: Store Pipedrive deal ID on a deal
      description: |
        Called by Zapier after a deal is created in Pipedrive. Stores the
        Pipedrive deal ID as post-meta so subsequent webhooks can reference
        both the WordPress deal and the Pipedrive record.

        Requires the `X-API-Key` header (`ss_zapier_api_key` option).
      operationId: pipedriveSetDealId
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PipedriveSetDealIdRequest'
            example:
              deal_id: 1042
              pipedrive_deal_id: pd_d_5f8a3c12
      responses:
        '200':
          description: Pipedrive deal ID stored
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PipedriveSetDealIdResponse'
              example:
                success: true
                data:
                  deal_id: 1042
                  pipedrive_deal_id: pd_d_5f8a3c12
        '400':
          description: Bad request — missing parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DealPublicWPError'
              examples:
                missingDealId:
                  summary: Missing deal_id
                  value:
                    code: missing_deal_id
                    message: deal_id is required
                    data:
                      status: 400
                missingPipedriveDealId:
                  summary: Missing pipedrive_deal_id
                  value:
                    code: missing_pipedrive_deal_id
                    message: pipedrive_deal_id is required
                    data:
                      status: 400
        '401':
          description: Missing or invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DealPublicWPError'
              example:
                code: unauthorized
                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: No deal found with ID 9999
                data:
                  status: 404
      security:
        - apiKey: []
components:
  schemas:
    PipedriveSetDealIdRequest:
      type: object
      required:
        - deal_id
        - pipedrive_deal_id
      properties:
        deal_id:
          type: integer
          description: WordPress deal post ID
          examples:
            - 1042
        pipedrive_deal_id:
          type: string
          description: Pipedrive deal ID
          examples:
            - pd_d_5f8a3c12
    PipedriveSetDealIdResponse:
      type: object
      properties:
        success:
          type: boolean
          const: true
        data:
          type: object
          required:
            - deal_id
            - pipedrive_deal_id
          properties:
            deal_id:
              type: integer
              examples:
                - 1042
            pipedrive_deal_id:
              type: string
              examples:
                - pd_d_5f8a3c12
    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

````