{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/everstage/json-schema/everstage-quote-status-request-model-schema.json",
  "title": "QuoteStatusRequestModel",
  "description": "Request body for POST /v1/cpq/quotes/{quote_id}/status.",
  "x-generated": "2026-12-01",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/everstage-openapi.json#/components/schemas/QuoteStatusRequestModel",
  "properties": {
    "action": {
      "type": "string",
      "enum": [
        "publish",
        "send_for_signature",
        "retract",
        "mark_won",
        "mark_lost"
      ],
      "title": "Action",
      "description": "Workflow transition to apply to the quote.\n\n- **publish** — Submit the quote for approval. Runs approval rule evaluation; the resulting status will be `Approved` or `Pending Approval` depending on your approval configuration. Allowed from: Draft, Pending Approval, Approved, Rejected.\n- **send_for_signature** — Initiate the offline signing process for the approved quote. The quote moves to Pending Signature and is ready for customer signature. Use `status_reason` to record the context (e.g. verbal customer approval). Note: this action initiates offline signing only — for DocuSign or native eSign flows, use the Everstage UI. Allowed from: Approved.\n- **retract** — Withdraw the quote from the active signing session and return it to Approved status for revision. The signing provider is detected automatically — no additional input required. For DocuSign and native eSign quotes, all signers receive a cancellation notification. Use `status_reason` to provide a reason for the withdrawal. Allowed from: Pending Signature.\n- **mark_won** — Mark the quote as closed-won. A subscription is created, the quote is marked as primary on the deal, and billing synchronization is initiated. From Approved, the quote moves directly to Won without a signing step. Allowed from: Approved, Pending Signature.\n- **mark_lost** — Mark the quote as closed-lost. Allowed from: Pending Signature.\n"
    },
    "status_reason": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Status Reason",
      "description": "Optional human-readable reason for this transition. Recorded in the audit log for traceability — not stored on the quote. Examples: 'Customer accepted the proposal', 'Opportunity moved to closed-won in Salesforce'."
    },
    "metadata": {
      "allOf": [
        {
          "$ref": "#/$defs/AuditMetadataModel"
        }
      ],
      "description": "Optional audit attribution for this request. Identifies the source system and actor that triggered the transition. All fields are forwarded to the audit log."
    }
  },
  "type": "object",
  "required": [
    "action"
  ],
  "$defs": {
    "AuditMetadataModel": {
      "properties": {
        "source": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Source",
          "description": "Name of the system making this request. Appears in audit views. Example: salesforce, hubspot, zapier."
        },
        "updated_by": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Updated By",
          "description": "Email address or display name of the person or process that triggered this request in the external system. Used for audit traceability only — not validated against Everstage users. Defaults to 'public-api-system' when omitted."
        },
        "external_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "External Id",
          "description": "ID of the corresponding record in the external system. Useful for tracing a request back to its origin. Example: a Salesforce opportunity ID."
        }
      },
      "additionalProperties": true,
      "type": "object",
      "title": "AuditMetadataModel",
      "description": "Optional audit attribution attached to any public API write operation.\n\nIdentifies who triggered the call and where it came from.\nAll fields are optional. Additional keys beyond the ones listed here are\naccepted and forwarded to the audit log unchanged."
    }
  }
}