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

# Update deal

> Update a deal. The update is written to the connected CRM first, then mirrored in Claap. At least one field must be provided; omitted fields keep their current values.

The update is partial: omitted attributes keep their current values, and at least one attribute must be provided. Use the CRM ids returned by the deal (`ownerId`, `stageId`, `typeId`) when updating those attributes.


## OpenAPI

````yaml PATCH /v1/deals/{dealId}
openapi: 3.1.0
info:
  title: Claap API
  description: Development documentation
  version: 0.0.0
servers:
  - url: https://api.claap.io/
security:
  - ApiKey: []
paths:
  /v1/deals/{dealId}:
    patch:
      description: >-
        Update a deal. The update is written to the connected CRM first, then
        mirrored in Claap. At least one field must be provided; omitted fields
        keep their current values.
      operationId: patchV1DealsByDealId
      parameters:
        - in: path
          name: dealId
          schema:
            type: string
            description: Deal identifier
          required: true
      requestBody:
        content:
          application/json:
            schema:
              type: object
              minProperties: 1
              properties:
                amount:
                  type: number
                  description: Deal amount, in the currency configured in the CRM.
                closedAt:
                  type: string
                  description: Deal close date (ISO datetime).
                ownerId:
                  type: string
                  description: Deal owner id in the CRM (the ownerId returned by the deal).
                stageId:
                  type: string
                  description: Stage id in the CRM (the stageId returned by the deal).
                title:
                  type: string
                  description: Deal title.
                typeId:
                  type: string
                  description: Deal type id in the CRM (the typeId returned by the deal).
      responses:
        '200':
          description: Deal was successfully updated
          content:
            application/json:
              schema:
                type: object
                properties:
                  result:
                    type: object
                    properties:
                      deal:
                        $ref: '#/components/schemas/ApiDeal'
                    required:
                      - deal
                required:
                  - result
        '404':
          description: Deal was not found.
components:
  schemas:
    ApiDeal:
      type: object
      properties:
        dealId:
          type: string
          description: The deal identifier.
        amount:
          type: object
          properties:
            value:
              type: number
              description: The deal amount.
            currency:
              type: string
              description: The amount currency, as configured in the CRM.
          required:
            - currency
          description: The deal amount.
        closedAt:
          type: string
          description: The deal close date (ISO datetime).
        companyIds:
          type: array
          items:
            type: string
          description: The identifiers of the companies associated with the deal.
        contactIds:
          type: array
          items:
            type: string
          description: The identifiers of the contacts associated with the deal.
        openedAt:
          type: string
          description: The deal creation date (ISO datetime).
        ownerEmail:
          type: string
          description: The deal owner email.
        ownerId:
          type: string
          description: >-
            The deal owner id in the CRM. This is the id accepted by the update
            endpoint.
        ownerName:
          type: string
          description: The deal owner name in the CRM.
        pipeline:
          type: string
          description: The pipeline name in the CRM.
        pipelineId:
          type: string
          description: The pipeline id in the CRM.
        source:
          oneOf:
            - type: object
              properties:
                kind:
                  type: string
                  const: Attio
                attioId:
                  type: string
                attioWorkspaceId:
                  type: string
              required:
                - kind
                - attioId
                - attioWorkspaceId
            - type: object
              properties:
                kind:
                  type: string
                  const: Hubspot
                hubspotId:
                  type: string
                hubspotWorkspaceId:
                  type: string
              required:
                - kind
                - hubspotId
                - hubspotWorkspaceId
            - type: object
              properties:
                kind:
                  type: string
                  const: Pipedrive
                pipedriveId:
                  type: number
                pipedriveCompanyId:
                  type: number
                pipedriveWorkspaceId:
                  type: number
              required:
                - kind
                - pipedriveId
                - pipedriveCompanyId
                - pipedriveWorkspaceId
            - type: object
              properties:
                kind:
                  type: string
                  const: Salesforce
                salesforceId:
                  type: string
                salesforceWorkspaceId:
                  type: string
              required:
                - kind
                - salesforceId
                - salesforceWorkspaceId
          description: The CRM the deal originates from, and its identifiers in that CRM.
        stage:
          type: string
          description: The deal stage name in the CRM.
        stageId:
          type: string
          description: >-
            The deal stage id in the CRM. This is the id accepted by the update
            endpoint.
        status:
          type: string
          enum:
            - Lost
            - Open
            - Won
          description: The deal status.
        summary:
          type: object
          properties:
            markdown:
              type: string
              description: The AI-generated deal summary, in Markdown.
          required:
            - markdown
          description: >-
            The AI-generated deal summary. Absent until it has been generated
            for the first time.
        title:
          type: string
          description: The deal title.
        type:
          type: string
          description: The deal type name in the CRM.
        typeId:
          type: string
          description: >-
            The deal type id in the CRM. This is the id accepted by the update
            endpoint.
        url:
          type: string
          description: The deal page URL in Claap application.
      required:
        - dealId
        - companyIds
        - contactIds
        - openedAt
        - source
        - url
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: X-Claap-Key

````