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

# Create Opportunity

> Create Opportunity



## OpenAPI

````yaml /api-reference/opportunities/openapi.json post /opportunities
openapi: 3.0.0
info:
  title: Opportunities API
  description: Documentation for Opportunities API
  version: '1.0'
  contact: {}
servers:
  - url: https://services.leadconnectorhq.com
security: []
tags:
  - name: Opportunities
    description: Documentation for Opportunities API
  - name: Search
    description: Documentation for Opportunities API
  - name: Pipelines
    description: Documentation for Opportunities API
  - name: Export
    description: Documentation for Opportunities API
  - name: Pipiline Search
    description: Documentation for Opportunities API
  - name: Lost reason
    description: Documentation for Opportunities API
  - name: Followers
    description: Documentation for Opportunities API
paths:
  /opportunities:
    post:
      tags:
        - Opportunities
      summary: Create Opportunity
      description: Create Opportunity
      operationId: create-opportunity
      parameters:
        - name: Version
          in: header
          description: API Version
          required: true
          schema:
            type: string
            enum:
              - '2021-07-28'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateDto'
      responses:
        '201':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetPostOpportunitySuccessfulResponseDto'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestDTO'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedDTO'
        '422':
          description: Unprocessable Entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnprocessableDTO'
      security:
        - bearer:
            - opportunities.write
components:
  schemas:
    CreateDto:
      type: object
      properties:
        pipelineId:
          type: string
          description: pipeline Id
          example: VDm7RPYC2GLUvdpKmBfC
        locationId:
          type: string
          example: ve9EPM428h8vShlRW1KT
        name:
          type: string
          example: First Opps
        pipelineStageId:
          type: string
          example: 7915dedc-8f18-44d5-8bc3-77c04e994a10
        status:
          type: string
          enum:
            - open
            - won
            - lost
            - abandoned
            - all
        contactId:
          type: string
          example: mTkSCb1UBjb5tk4OvB69
        monetaryValue:
          type: number
          example: 220
        assignedTo:
          type: string
          example: 082goXVW3lIExEQPOnd3
        customFields:
          type: array
          description: Add custom fields to opportunities.
          items:
            anyOf:
              - $ref: '#/components/schemas/customFieldsInputStringSchema'
              - $ref: '#/components/schemas/customFieldsInputArraySchema'
              - $ref: '#/components/schemas/customFieldsInputObjectSchema'
      required:
        - pipelineId
        - locationId
        - name
        - status
        - contactId
    GetPostOpportunitySuccessfulResponseDto:
      type: object
      properties:
        opportunity:
          $ref: '#/components/schemas/SearchOpportunitiesResponseSchema'
    BadRequestDTO:
      type: object
      properties:
        statusCode:
          type: number
          example: 400
        message:
          type: string
          example: Bad Request
      required:
        - statusCode
        - message
    UnauthorizedDTO:
      type: object
      properties:
        statusCode:
          type: number
          example: 401
        message:
          type: string
          example: 'Invalid token: access token is invalid'
        error:
          type: string
          example: Unauthorized
      required:
        - statusCode
        - message
        - error
    UnprocessableDTO:
      type: object
      properties:
        statusCode:
          type: number
          example: 422
        message:
          type: array
          items:
            type: string
          example:
            - Unprocessable Entity
        error:
          type: string
          example: Unprocessable Entity
      required:
        - statusCode
        - message
        - error
    customFieldsInputStringSchema:
      type: object
      properties:
        id:
          type: string
          example: 6dvNaf7VhkQ9snc5vnjJ
          description: Pass either `id` or `key` of custom field
        key:
          type: string
          example: my_custom_field
          description: Pass either `id` or `key` of custom field
        field_value:
          type: string
          example: '9039160788'
    customFieldsInputArraySchema:
      type: object
      properties:
        id:
          type: string
          example: 6dvNaf7VhkQ9snc5vnjJ
        key:
          type: string
          example: my_custom_field
        field_value:
          example:
            - test
            - test2
          type: array
          items:
            type: string
      required:
        - id
    customFieldsInputObjectSchema:
      type: object
      properties:
        id:
          type: string
          example: 6dvNaf7VhkQ9snc5vnjJ
        key:
          type: string
          example: my_custom_field
        field_value:
          type: object
          example: {}
      required:
        - id
    SearchOpportunitiesResponseSchema:
      type: object
      properties:
        id:
          type: string
          example: yWQobCRIhRguQtD2llvk
        name:
          type: string
          example: testing
        monetaryValue:
          type: number
          example: 500
        pipelineId:
          type: string
          example: VDm7RPYC2GLUvdpKmBfC
        pipelineStageId:
          type: string
          example: e93ba61a-53b3-45e7-985a-c7732dbcdb69
        assignedTo:
          type: string
          example: zT46WSCPbudrq4zhWMk6
        status:
          type: string
          example: open
        source:
          type: string
          example: ''
        lastStatusChangeAt:
          type: string
          example: '2021-08-03T04:55:17.355Z'
        lastStageChangeAt:
          type: string
          example: '2021-08-03T04:55:17.355Z'
        lastActionDate:
          type: string
          example: '2021-08-03T04:55:17.355Z'
        indexVersion:
          type: string
          example: 1
        createdAt:
          type: string
          example: '2021-08-03T04:55:17.355Z'
        updatedAt:
          type: string
          example: '2021-08-03T04:55:17.355Z'
        contactId:
          type: string
          example: zT46WSCPbudrq4zhWMk6
        locationId:
          type: string
          example: zT46WSCPbudrq4zhW
        contact:
          $ref: '#/components/schemas/SearchOpportunitiesContactResponseSchema'
        notes:
          type: array
          items:
            type: array
        tasks:
          type: array
          items:
            type: array
        calendarEvents:
          type: array
          items:
            type: array
        lostReasonId:
          type: string
          example: zT46WSCPbudrq4zhWMk6
        customFields:
          type: array
          items:
            $ref: '#/components/schemas/CustomFieldResponseSchema'
        followers:
          type: array
          items:
            type: array
    SearchOpportunitiesContactResponseSchema:
      type: object
      properties:
        id:
          type: string
          example: byMEV0NQinDhq8ZfiOi2
        name:
          type: string
          example: John Deo
        companyName:
          type: string
          example: Tesla Inc
        email:
          type: string
          example: john@deo.com
        phone:
          type: string
          example: +1202-555-0107
        tags:
          type: array
          items:
            type: string
    CustomFieldResponseSchema:
      type: object
      properties:
        id:
          type: string
          example: MgobCB14YMVKuE4Ka8p1
        fieldValue:
          description: The value of the custom field
          oneOf:
            - type: string
            - type: object
            - type: array
              items:
                type: string
            - type: array
              items:
                type: object
      required:
        - id
        - fieldValue
  securitySchemes:
    bearer:
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Use the Access Token generated with user type as Sub-Account (OR)
        Private Integration Token of Sub-Account.
      type: http

````