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

# Create a deal

> Create a new deal in the CRM.



## OpenAPI

````yaml post /api/deals/
openapi: 3.1.0
info:
  title: CRM Backend
  description: >

    CRM Backend API for managing contacts, companies, deals, activities, and
    AI-powered chat.


    ## Authentication


    Protected endpoints accept either:


    - **JWT (Bearer)**: `Authorization: Bearer <jwt>` with `X-Account-ID` header

    - **API Key**: `Authorization: Bearer sk_xxx` or `X-API-Key: sk_xxx`


    API keys are created in Developer Settings and provide account-level access.
  version: 0.1.0
servers:
  - url: https://api.morphic.io
    description: Production
security: []
tags:
  - name: Contacts
    description: Manage contacts (people) in the CRM.
  - name: Companies
    description: Manage companies and their teams.
  - name: Deals
    description: Manage deals and pipeline stages.
  - name: Activities
    description: Log and track activities (calls, meetings, tasks).
  - name: Notes
    description: Create and manage notes attached to CRM entities.
  - name: Favorites
    description: Bookmark records and organize them into folders.
  - name: Exports
    description: Export CRM data to CSV files.
  - name: Imports
    description: Import data into the CRM from CSV files.
  - name: Email Drafts
    description: Create, manage, and send email drafts.
  - name: Email Templates
    description: Create and manage reusable email templates.
  - name: Knowledge Base
    description: Manage knowledge base documents and pages.
  - name: Chats
    description: AI-powered chat conversations and messages.
  - name: Cortex Search
    description: Semantic search and AI-powered Q&A over CRM data.
  - name: Custom Fields
    description: Define and manage custom field definitions and values.
  - name: Categories
    description: Organize CRM entities with categories and tags.
  - name: Transcription
    description: Transcribe audio files using AI.
paths:
  /api/deals/:
    post:
      tags:
        - Deals
      summary: Create a deal
      description: Create a new deal in the CRM.
      operationId: create-deal
      parameters:
        - name: x-account-id
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Account-Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DealCreate'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Deal'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKey: []
components:
  schemas:
    DealCreate:
      properties:
        name:
          type: string
          maxLength: 255
          minLength: 1
          title: Name
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        stage:
          type: string
          title: Stage
          description: Pipeline stage (e.g., qualification, negotiation, closed_won)
        status:
          type: string
          title: Status
          description: Deal status (open, won, lost)
          default: open
        amount:
          anyOf:
            - type: number
            - type: string
            - type: 'null'
          title: Amount
        currency:
          type: string
          maxLength: 3
          title: Currency
          default: USD
        probability:
          anyOf:
            - type: integer
              maximum: 100
              minimum: 0
            - type: 'null'
          title: Probability
        expected_close_date:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: Expected Close Date
        source:
          anyOf:
            - type: string
            - type: 'null'
          title: Source
        competing_options:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Competing Options
        next_step:
          anyOf:
            - type: string
            - type: 'null'
          title: Next Step
        tags:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Tags
        notes:
          anyOf:
            - type: string
            - type: 'null'
          title: Notes
        categories:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Categories
        contact_ids:
          anyOf:
            - items:
                type: string
                format: uuid
              type: array
            - type: 'null'
          title: Contact Ids
        assigned_to_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Assigned To Id
        closed_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Closed At
        lost_reason:
          anyOf:
            - type: string
            - type: 'null'
          title: Lost Reason
        metadata:
          type: object
          title: Metadata
        enrichment:
          type: object
          title: Enrichment
        enrichment_provider:
          anyOf:
            - type: string
            - type: 'null'
          title: Enrichment Provider
        enrichment_last_updated:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Enrichment Last Updated
        enrichment_status:
          anyOf:
            - type: string
            - type: 'null'
          title: Enrichment Status
        company_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Company Id
        custom_fields:
          anyOf:
            - type: object
            - type: 'null'
          title: Custom Fields
      type: object
      required:
        - name
        - stage
      title: DealCreate
      example:
        amount: 50000
        currency: USD
        expected_close_date: '2026-03-31'
        name: Enterprise License Deal
        next_step: Schedule demo
        probability: 60
        source: Inbound
        stage: proposal
        status: open
    Deal:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
        name:
          type: string
          maxLength: 255
          minLength: 1
          title: Name
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        stage:
          type: string
          title: Stage
          description: Pipeline stage (e.g., qualification, negotiation, closed_won)
        status:
          type: string
          title: Status
          description: Deal status (open, won, lost)
          default: open
        amount:
          anyOf:
            - type: string
            - type: 'null'
          title: Amount
        currency:
          type: string
          maxLength: 3
          title: Currency
          default: USD
        probability:
          anyOf:
            - type: integer
              maximum: 100
              minimum: 0
            - type: 'null'
          title: Probability
        expected_close_date:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: Expected Close Date
        source:
          anyOf:
            - type: string
            - type: 'null'
          title: Source
        competing_options:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Competing Options
        next_step:
          anyOf:
            - type: string
            - type: 'null'
          title: Next Step
        tags:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Tags
        notes:
          anyOf:
            - type: string
            - type: 'null'
          title: Notes
        categories:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Categories
        contact_ids:
          anyOf:
            - items:
                $ref: '#/components/schemas/ReferenceItem'
              type: array
            - type: 'null'
          title: Contact Ids
          description: Associated contacts with id and name
        assigned_to_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Assigned To Id
        closed_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Closed At
        lost_reason:
          anyOf:
            - type: string
            - type: 'null'
          title: Lost Reason
        metadata:
          type: object
          title: Metadata
        enrichment:
          type: object
          title: Enrichment
        enrichment_provider:
          anyOf:
            - type: string
            - type: 'null'
          title: Enrichment Provider
        enrichment_last_updated:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Enrichment Last Updated
        enrichment_status:
          anyOf:
            - type: string
            - type: 'null'
          title: Enrichment Status
        company_id:
          anyOf:
            - $ref: '#/components/schemas/ReferenceItem'
            - type: 'null'
          description: Company with id and name
        custom_fields:
          anyOf:
            - type: object
            - type: 'null'
          title: Custom Fields
        account_id:
          type: string
          format: uuid
          title: Account Id
        is_favorite:
          type: boolean
          title: Is Favorite
          description: Whether this record is favorited by the current user
          default: false
      type: object
      required:
        - id
        - created_at
        - updated_at
        - name
        - stage
        - account_id
      title: Deal
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ReferenceItem:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        name:
          type: string
          title: Name
      type: object
      required:
        - id
        - name
      title: ReferenceItem
      description: |-
        Enriched reference item containing both ID and display name.
        Used for reference fields to avoid frontend needing separate API calls.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    APIKey:
      type: apiKey
      in: header
      name: X-API-Key
      description: API key (sk_xxx) from Developer Settings. No X-Account-ID needed.

````