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

# Upsert Opportunity

> Upsert Opportunity



## OpenAPI

````yaml /api-reference/opportunities/openapi.json post /opportunities/upsert
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/upsert:
    post:
      tags:
        - Opportunities
      summary: Upsert Opportunity
      description: Upsert Opportunity
      operationId: Upsert-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/UpsertOpportunityDto'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpsertOpportunitySuccessfulResponseDto'
        '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:
    UpsertOpportunityDto:
      type: object
      properties:
        id:
          type: string
          description: opportunityId
          example: yWQobCRIhRguQtD2llvk
        pipelineId:
          type: string
          description: pipeline Id
          example: bCkKGpDsyPP4peuKowkG
        locationId:
          type: string
          description: locationId
          example: CLu7BaljjqrEjBGKTNNe
        followers:
          description: contactId
          example: LiKJ2vnRg5ETM8Z19K7
          type: array
          items:
            type: string
        isRemoveAllFollowers:
          type: boolean
          description: isRemoveAllFollowers
          example: true
        followersActionType:
          type: string
          description: followers action type
          enum:
            - add
            - remove
          example: add
        name:
          type: string
          description: name
          example: opportunity name
        status:
          type: string
          enum:
            - open
            - won
            - lost
            - abandoned
            - all
        pipelineStageId:
          type: string
          example: 7915dedc-8f18-44d5-8bc3-77c04e994a10
        monetaryValue:
          type: number
          example: 220
        assignedTo:
          type: string
          example: 082goXVW3lIExEQPOnd3
        lostReasonId:
          type: string
          description: lost reason Id
          example: CLu7BaljjqrEjBGKTNNe
      required:
        - pipelineId
        - locationId
        - followers
        - isRemoveAllFollowers
        - followersActionType
    UpsertOpportunitySuccessfulResponseDto:
      type: object
      properties:
        opportunity:
          type: object
          description: Updated / New Opportunity
        new:
          type: boolean
          example: true
      required:
        - opportunity
        - new
    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
  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

````