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

# Create opportunity

> Creates a new business opportunity linked to an existing client or automatically creates a new client.



## OpenAPI

````yaml POST /api/public/v1/opportunities/create
openapi: 3.1.0
info:
  title: Boxpilote API
  description: >-
    API for business opportunities, quotes, surfaces, rentals, insurances,
    services, products, VAT rates, and associated clients.
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.boxpilote.fr
security:
  - bearerAuth: []
paths:
  /api/public/v1/opportunities/create:
    post:
      description: >-
        Creates a new business opportunity linked to an existing client or
        automatically creates a new client.
      requestBody:
        description: Data required to create an opportunity and optionally a new client
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NewOpportunity'
      responses:
        '200':
          description: Opportunity successfully created
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  opportunityId:
                    type: string
                  createdAt:
                    type: string
                    description: Creation timestamp
        '400':
          description: Email required or invalid format
          content:
            application/json:
              example:
                success: false
                message: Email requis
        '401':
          description: Unauthorized / Invalid Token
          content:
            application/json:
              example:
                success: false
                message: 'Unauthorized: Invalid or missing token.'
        '409':
          description: Conflict - duplicate or conflicting resource
          content:
            application/json:
              example:
                success: false
                message: >-
                  Conflict: Resource already exists or conflicts with existing
                  data.
        '500':
          description: Error inserting customer or opportunity
          content:
            application/json:
              example:
                success: false
                message: >-
                  Internal server error: Could not insert customer or
                  opportunity.
components:
  schemas:
    NewOpportunity:
      type: object
      required:
        - email
        - first_name
        - last_name
        - phone
      properties:
        email:
          type: string
          description: Customer email (required)
        first_name:
          type: string
          description: Customer first name (required)
        last_name:
          type: string
          description: Customer last name (required)
        name:
          type: string
          description: Company name
        phone:
          type: string
          description: Customer phone number (required)
        type:
          type: string
          description: >-
            Client type (Professionnel, Particulier, Association). Default:
            Professionnel
        origin:
          type: string
          description: 'Lead origin. Default: Site Web'
        title:
          type: string
          description: >-
            Short title or description of the opportunity. Default: Demande de
            démo
        size:
          type: number
          description: Size in m²
        priority:
          type: string
          description: 'Opportunity priority (Faible, Moyen, Important). Default: Important'
        category:
          type: array
          description: Category tags
        referer:
          type: string
          description: Referrer source
        precision:
          type: string
          description: Additional precision/details
        estimated_date:
          type: string
          description: Estimated date for the opportunity
        external_id:
          type: string
          description: External ID of the customer
        sales_cycle:
          type: string
          enum:
            - cible
            - prospection
            - contact
            - proposition
          description: Sales cycle stage of the opportunity
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````