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

# Create an opportunity

> Creates a new opportunity. Provide the company, pipeline stage, estimated value, and other opportunity details.



## OpenAPI

````yaml /openapi-private.json post /opportunities
openapi: 3.1.0
info:
  title: Spott API Reference
  version: '0.1'
servers:
  - url: https://api.gospott.com
security: []
tags: []
paths:
  /opportunities:
    post:
      tags:
        - Opportunities
      summary: Create an opportunity
      description: >-
        Creates a new opportunity. Provide the company, pipeline stage,
        estimated value, and other opportunity details.
      operationId: createOpportunity
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateOpportunityDto'
      responses:
        '201':
          description: Opportunity created successfully. Returns the opportunity ID.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateRecordResponseDto'
        '400':
          description: Bad request - missing or invalid required fields
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/ExceptionBaseDto'
                  - type: object
                    properties:
                      statusCode:
                        type: number
                        example: 400
                      message:
                        type: string
                        example: Company ID is required for creating an opportunity
                      error:
                        type: string
                        example: Bad Request
        '401':
          description: Unauthorized - invalid or missing authentication
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExceptionBaseDto'
        '500':
          description: Error response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExceptionBaseDto'
      security:
        - x-api-key: []
components:
  schemas:
    CreateOpportunityDto:
      type: object
      properties:
        companyId:
          type: string
          minLength: 1
          description: The ID of the company this opportunity belongs to
        name:
          type: string
          minLength: 1
          description: The name of the opportunity
        description:
          anyOf:
            - type: string
            - type: 'null'
          description: Detailed description of the opportunity
        stageId:
          type: string
          minLength: 1
          description: The pipeline stage ID to assign to this opportunity
        ownerId:
          description: The user ID of the opportunity owner
          type: string
          minLength: 1
        closeDate:
          $ref: '#/components/schemas/CreateOpportunityCloseDateDto'
          description: The target closing date for this opportunity
        clientTeam:
          description: Client contacts to associate with this opportunity
          type: array
          items:
            $ref: '#/components/schemas/IdDto'
        locations:
          description: Physical locations for the opportunity (0 to 15).
          maxItems: 15
          type: array
          items:
            $ref: '#/components/schemas/CreateLocationDto'
      required:
        - companyId
        - name
        - description
        - stageId
        - closeDate
      id: PrivateCreateOpportunityDto
    CreateRecordResponseDto:
      type: object
      properties:
        id:
          type: string
          minLength: 1
      required:
        - id
      id: CreateRecordResponseDto
    ExceptionBaseDto:
      type: object
      properties:
        status:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        message:
          type: string
        requestId:
          type: string
      required:
        - status
        - message
        - requestId
      id: ExceptionBaseDto
    CreateOpportunityCloseDateDto:
      type: object
      properties:
        target:
          anyOf:
            - $ref: '#/components/schemas/DateISO'
            - type: 'null'
          description: Target close date for the opportunity
      required:
        - target
      id: PrivateCreateOpportunityCloseDateDto
    IdDto:
      type: object
      properties:
        id:
          type: string
          minLength: 1
      required:
        - id
      id: IdDto
    CreateLocationDto:
      type: object
      properties:
        street1:
          anyOf:
            - type: string
            - type: 'null'
        street2:
          anyOf:
            - type: string
            - type: 'null'
        postalCode:
          anyOf:
            - type: string
            - type: 'null'
        city:
          anyOf:
            - type: string
            - type: 'null'
        region:
          anyOf:
            - type: string
            - type: 'null'
        state:
          anyOf:
            - type: string
            - type: 'null'
        country:
          anyOf:
            - type: string
            - type: 'null'
        latitude:
          anyOf:
            - type: number
            - type: 'null'
        longitude:
          anyOf:
            - type: number
            - type: 'null'
        type:
          anyOf:
            - $ref: '#/components/schemas/LocationType'
            - type: 'null'
      required:
        - street1
        - street2
        - postalCode
        - city
        - region
        - state
        - country
        - type
      id: PrivateCreateLocationDto
    DateISO:
      id: DateISO
      format: date-time
      anyOf:
        - type: string
          format: date-time
          pattern: >-
            ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
        - type: string
          format: date
          pattern: >-
            ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$
    LocationType:
      type: string
      enum:
        - primary_home
        - secondary_home
        - primary_work
        - headquarters
        - regional_office
      id: LocationType
  securitySchemes:
    x-api-key:
      type: apiKey
      name: x-api-key
      in: header
      description: >-
        API key for authentication. Get your API key from Settings → API Keys in
        your Spott dashboard.

````