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

# Get deal by ID

> Retrieve a single deal by UUID, including won/lost reasons and notes, with optional custom field values.

**Include**: By default, `custom_fields` are included. Pass `include=` (empty) for base fields only.



## OpenAPI

````yaml /api-reference/openapi-v1.json get /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}:
    get:
      tags:
        - Deals
      summary: Get deal by ID
      description: >-
        Retrieve a single deal by UUID, including won/lost reasons and notes,
        with optional custom field values.


        **Include**: By default, `custom_fields` are included. Pass `include=`
        (empty) for base fields only.
      operationId: getDealById
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
            description: Deal UUID
        - schema:
            type: string
            description: >-
              Comma-separated extra sections. Values: custom_fields. Default:
              custom_fields. Pass empty string for base fields only. Won/lost
              reasons and notes are always included in the base deal detail.
          required: false
          name: include
          in: query
      responses:
        '200':
          description: Deal fetched
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DealByIdResponse'
              example:
                success: true
                data:
                  id: aaa11111-bbbb-cccc-dddd-eeeeeeee1111
                  name: Acme Corp Staffing Agreement
                  amount: 150000
                  currency_code: USD
                  compensation: 750000
                  compensation_currency_code: USD
                  pricing_rate: 20
                  win_probability: 75
                  description: Annual staffing contract for engineering positions.
                  closed_date: '2024-06-30T00:00:00Z'
                  open_date: '2024-01-15'
                  deal_lost_reason_id: null
                  deal_lost_reason_text: null
                  deal_lost_reason: null
                  deal_won_reason_id: 66666666-7777-8888-9999-aaaaaaaaaaaa
                  deal_won_reason_text: Client chose us because of prior executive-search success.
                  deal_won_reason:
                    id: 66666666-7777-8888-9999-aaaaaaaaaaaa
                    reason: Strong relationship
                  referred_by: fff66666-0000-1111-2222-333333336666
                  job_ids:
                    - eee55555-ffff-0000-1111-222222225555
                  client_id: bbb22222-cccc-dddd-eeee-ffffffff2222
                  client_name: Acme Corp
                  deal_status:
                    id: ccc33333-dddd-eeee-ffff-000000003333
                    name: Proposal Sent
                  created_at: '2024-01-15T10:00:00Z'
                  updated_at: '2024-02-01T12:00:00Z'
                  owners:
                    - id: ddd44444-eeee-ffff-0000-111111114444
                      name: Jane Smith
                  custom_fields:
                    - attribute_id: f1e2d3c4-b5a6-7890-abcd-ef1234567890
                      attribute_name: Deal Priority
                      data_type: single-select
                      value: null
                      tag:
                        id: a1b2c3d4-e5f6-7890-abcd-ef1234567890
                        name: High
                      team_member: null
        '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:
    DealByIdResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        data:
          $ref: '#/components/schemas/DealDetail'
      required:
        - success
        - data
    DealDetail:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Unique deal UUID.
        name:
          type: string
          description: Deal name.
        amount:
          type:
            - number
            - 'null'
          description: Deal monetary amount — the fee the firm invoices the client.
        currency_code:
          type: string
          description: ISO 4217 currency code for the deal amount (e.g. USD, EUR, GBP).
        compensation:
          type:
            - number
            - 'null'
          description: >-
            Candidate's expected total annual compensation (salary + bonus +
            equity). Used to compute the deal amount.
        compensation_currency_code:
          type: string
          description: >-
            ISO 4217 currency code for the estimated compensation. May differ
            from currency_code.
        pricing_rate:
          type:
            - number
            - 'null'
          description: >-
            Recruitment fee percentage (0–100) charged to the client on a
            successful placement.
        win_probability:
          type:
            - number
            - 'null'
          description: Probability of winning the deal (0–100).
        description:
          type:
            - string
            - 'null'
          description: Free-text deal description.
        closed_date:
          type:
            - string
            - 'null'
          description: ISO 8601 expected or actual close date.
        open_date:
          type: string
          format: date
          description: Date the deal was opened (YYYY-MM-DD).
        deal_lost_reason_id:
          type:
            - string
            - 'null'
          format: uuid
          description: Selected lost reason UUID, if this deal was lost.
        deal_lost_reason_text:
          type:
            - string
            - 'null'
          description: Additional notes explaining why the deal was lost.
        deal_lost_reason:
          type:
            - object
            - 'null'
          properties:
            id:
              type: string
              format: uuid
              description: Deal reason UUID.
            reason:
              type: string
              description: Human-readable deal reason.
          required:
            - id
            - reason
          description: Selected lost reason details, if this deal was lost.
        deal_won_reason_id:
          type:
            - string
            - 'null'
          format: uuid
          description: Selected won reason UUID, if this deal was won.
        deal_won_reason_text:
          type:
            - string
            - 'null'
          description: Additional notes explaining why the deal was won.
        deal_won_reason:
          type:
            - object
            - 'null'
          properties:
            id:
              type: string
              format: uuid
              description: Deal reason UUID.
            reason:
              type: string
              description: Human-readable deal reason.
          required:
            - id
            - reason
          description: Selected won reason details, if this deal was won.
        referred_by:
          type:
            - string
            - 'null'
          description: Person UUID of the referrer .
        job_ids:
          type: array
          items:
            type: string
            format: uuid
          description: UUIDs of jobs linked to this deal via the deal_jobs table.
        client_id:
          type:
            - string
            - 'null'
          description: Associated client company UUID.
        client_name:
          type:
            - string
            - 'null'
          description: Client company name.
        deal_status:
          type:
            - object
            - 'null'
          properties:
            id:
              type: string
              format: uuid
              description: >-
                Deal status UUID. Use for deal_status_ids_included/excluded
                filters.
            name:
              type: string
              description: Human-readable status name (e.g. "Proposal Sent", "Closed Won").
          required:
            - id
            - name
          description: Current deal status with id and name. Null if no status assigned.
        created_at:
          type:
            - string
            - 'null'
          description: ISO 8601 creation timestamp.
        updated_at:
          type:
            - string
            - 'null'
          description: ISO 8601 last-updated timestamp.
        owners:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
                format: uuid
                description: Team member UUID. Matches IDs from GET /v1/team-members.
              name:
                type:
                  - string
                  - 'null'
                description: Team member full name.
            required:
              - id
              - name
          description: Deal owners.
        custom_fields:
          type: array
          items:
            $ref: '#/components/schemas/CustomFieldValue'
          description: >-
            Custom attribute values. Included when include contains
            "custom_fields".
      required:
        - id
        - name
        - amount
        - currency_code
        - compensation
        - compensation_currency_code
        - pricing_rate
        - win_probability
        - description
        - closed_date
        - open_date
        - deal_lost_reason_id
        - deal_lost_reason_text
        - deal_lost_reason
        - deal_won_reason_id
        - deal_won_reason_text
        - deal_won_reason
        - referred_by
        - job_ids
        - client_id
        - client_name
        - deal_status
        - created_at
        - updated_at
        - owners
    CustomFieldValue:
      type: object
      properties:
        attribute_id:
          type: string
          format: uuid
          description: >-
            Attribute definition UUID. Get definitions from GET
            /v1/custom-fields/{entity}.
        attribute_name:
          type: string
          description: Attribute display name.
        data_type:
          type: string
          enum:
            - string
            - integer
            - decimal
            - multi-select
            - single-select
            - boolean
            - date
            - multi-team-member
            - url
          description: Attribute data type. Determines which value field contains the data.
        job_id:
          type:
            - string
            - 'null'
          format: uuid
          description: >-
            Job UUID this attribute is scoped to. Null for global person-level
            attributes. Present when this custom field is specific to a job
            (candidate-level field).
        list_id:
          type:
            - string
            - 'null'
          format: uuid
          description: >-
            List UUID this attribute is scoped to. Null for global person-level
            attributes.
        value:
          anyOf:
            - type: string
            - type: number
            - type: boolean
            - type: 'null'
            - type: 'null'
          description: >-
            Scalar value for string, integer, decimal, date, url, boolean types.
            Null for select/team-member types.
        tag:
          type:
            - object
            - 'null'
          properties:
            id:
              type: string
              format: uuid
              description: Tag option UUID.
            name:
              type: string
              description: Tag display name.
          required:
            - id
            - name
          description: >-
            Tag value for single-select and multi-select types. Null for other
            types. For multi-select, one CustomFieldValue row per tag.
        team_member:
          type:
            - object
            - 'null'
          properties:
            id:
              type: string
              format: uuid
              description: Team member UUID.
            name:
              type:
                - string
                - 'null'
              description: Team member full name.
          required:
            - id
            - name
          description: >-
            Team member value for multi-team-member type. Null for other types.
            One CustomFieldValue row per team member.
      required:
        - attribute_id
        - attribute_name
        - data_type
        - job_id
        - list_id
        - value
        - tag
        - team_member
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Authenticate with a Bearer token: API key, OAuth token, or session
        token.

````