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

# Update deal

> Update an existing deal, including won/lost reason IDs and notes. Only provided fields are modified; omitted fields remain unchanged.



## OpenAPI

````yaml /api-reference/openapi-v1.json patch /v1/deals/{id}
openapi: 3.1.0
info:
  title: Stardex API (v1)
  version: 1.0.0
  description: >-
    Stardex ATS API — manage candidates, jobs, companies, and recruiting
    workflows.
servers:
  - url: https://api.stardex.ai
    description: Production API server
security:
  - bearerAuth: []
tags:
  - name: Persons
    description: Manage person records — contacts, work history, and custom fields.
  - name: Jobs
    description: Manage job postings — pipeline stages, team members, and custom fields.
  - name: Candidates
    description: Manage candidate records and pipeline stage transitions.
  - name: Companies
    description: Browse and retrieve company records.
  - name: Lists
    description: Create, search, and retrieve saved person and company lists.
  - name: Person Activities
    description: Create and manage activity records (notes, emails, meetings) for persons.
  - name: Team Members
    description: List team members for use in search filters and assignments.
  - name: Custom Fields
    description: Retrieve custom field definitions and tag options for search filters.
paths:
  /v1/deals/{id}:
    patch:
      tags:
        - Deals
      summary: Update deal
      description: >-
        Update an existing deal, including won/lost reason IDs and notes. Only
        provided fields are modified; omitted fields remain unchanged.
      operationId: updateDeal
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
            description: Deal UUID
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DealUpdateRequest'
      responses:
        '200':
          description: Deal updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DealUpdateResponse'
              example:
                success: true
                data:
                  message: Deal updated successfully
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                    description: Always false for error responses.
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        description: >-
                          Machine-readable error code (e.g. "VALIDATION_ERROR",
                          "NOT_FOUND").
                      message:
                        type: string
                        description: Human-readable error description.
                    required:
                      - code
                      - message
                required:
                  - success
                  - error
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                    description: Always false for error responses.
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        description: >-
                          Machine-readable error code (e.g. "VALIDATION_ERROR",
                          "NOT_FOUND").
                      message:
                        type: string
                        description: Human-readable error description.
                    required:
                      - code
                      - message
                required:
                  - success
                  - error
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                    description: Always false for error responses.
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        description: >-
                          Machine-readable error code (e.g. "VALIDATION_ERROR",
                          "NOT_FOUND").
                      message:
                        type: string
                        description: Human-readable error description.
                    required:
                      - code
                      - message
                required:
                  - success
                  - error
components:
  schemas:
    DealUpdateRequest:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          description: Deal name.
        client_id:
          type: string
          format: uuid
          description: Client company UUID.
        amount:
          type: number
          description: Deal amount.
        currency_code:
          type: string
          minLength: 3
          maxLength: 3
          description: ISO 4217 currency code (e.g. USD, EUR, GBP).
        compensation:
          type: number
          minimum: 0
          description: Candidate's expected total annual compensation.
        compensation_currency_code:
          type: string
          minLength: 3
          maxLength: 3
          description: ISO 4217 currency code for compensation.
        pricing_rate:
          type: number
          minimum: 0
          maximum: 100
          description: Recruitment fee percentage (0–100).
        win_probability:
          type: number
          minimum: 0
          maximum: 100
          description: Win probability (0–100).
        deal_status_id:
          type: string
          format: uuid
          description: Deal status UUID.
        description:
          type: string
          description: Description.
        closed_date:
          type:
            - string
            - 'null'
          description: ISO 8601 close date. Pass null to clear.
        open_date:
          type: string
          format: date
          description: Deal opening date (YYYY-MM-DD).
        deal_lost_reason_id:
          type:
            - string
            - 'null'
          format: uuid
          description: >-
            Lost reason UUID from deal_lost_reasons. Pass null to clear the
            selected lost reason.
        deal_lost_reason_text:
          type:
            - string
            - 'null'
          description: >-
            Additional notes explaining why the deal was lost. Pass null to
            clear.
        deal_won_reason_id:
          type:
            - string
            - 'null'
          format: uuid
          description: >-
            Won reason UUID from deal_won_reasons. Pass null to clear the
            selected won reason.
        deal_won_reason_text:
          type:
            - string
            - 'null'
          description: >-
            Additional notes explaining why the deal was won. Pass null to
            clear.
        job_ids:
          type: array
          items:
            type: string
            format: uuid
          description: >-
            Job UUIDs to link to this deal. Replaces all existing deal_jobs
            links.
        referred_by:
          type: string
          format: uuid
          description: Person UUID of the referrer.
        owner_ids:
          type: array
          items:
            type: string
            format: uuid
          description: >-
            Team member UUIDs to assign as deal owners. Replaces all existing
            deal_owners links. Pass an empty array to remove all owners.
        client_contact_ids:
          type: array
          items:
            type: string
            format: uuid
          description: >-
            Client contact UUIDs to attach as deal contacts. Replaces all
            existing deal_client_contacts links. Pass an empty array to detach
            all contacts. Each contact must belong to this team.
        custom_fields:
          type: array
          items:
            type: object
            properties:
              attribute_id:
                type: string
                format: uuid
                description: >-
                  Custom attribute definition UUID. Get from GET
                  /v1/custom-fields/deals.
              value:
                anyOf:
                  - type: string
                  - type: number
                  - type: boolean
                  - type: 'null'
                  - type: 'null'
                description: >-
                  For scalar types: the value to set, or null to clear. For
                  single-select: pass the tag NAME or the tag option UUID from
                  GET /v1/custom-fields/deals.
              add_values:
                type: array
                items:
                  type: string
                description: >-
                  Tags to add for multi-select fields. Pass tag NAMES or tag
                  option UUIDs.
              remove_values:
                type: array
                items:
                  type: string
                description: >-
                  Tags to remove for multi-select fields. Pass tag NAMES or tag
                  option UUIDs.
              add_team_member_ids:
                type: array
                items:
                  type: string
                  format: uuid
                description: Team member UUIDs to add for multi-team-member fields.
              remove_team_member_ids:
                type: array
                items:
                  type: string
                  format: uuid
                description: Team member UUIDs to remove for multi-team-member fields.
              clear_all:
                type: boolean
                description: >-
                  When true, removes all values for this attribute before
                  applying adds.
            required:
              - attribute_id
          description: Custom field values to update.
    DealUpdateResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        data:
          type: object
          properties:
            message:
              type: string
          required:
            - message
      required:
        - success
        - data
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Authenticate with a Bearer token: API key, OAuth token, or session
        token.

````