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

# Criar lead

> Cria um lead na organização ativa. O lead entra no stage default do pipeline informado.



## OpenAPI

````yaml /openapi.json post /leads
openapi: 3.1.0
info:
  title: Apollo Space API
  description: >-
    API HTTP do Apollo Space — pré-visualização. Os endpoints aqui descritos são
    o design pretendido; alguns podem mudar antes da estabilização pública. Pra
    acesso antecipado, fale com support@apollospace.ai.
  version: 0.1.0-preview
  contact:
    email: support@apollospace.ai
servers:
  - url: https://api.apollospace.ai/v1
    description: Produção
security:
  - bearerAuth: []
tags:
  - name: Leads
    description: Operações no CRM — listar, criar, atualizar leads.
  - name: Faturamento
    description: Saldo, planos, histórico da carteira de Stars.
paths:
  /leads:
    post:
      tags:
        - Leads
      summary: Criar lead
      description: >-
        Cria um lead na organização ativa. O lead entra no stage default do
        pipeline informado.
      operationId: createLead
      parameters:
        - name: X-Organization-Id
          in: header
          required: true
          schema:
            type: string
            format: uuid
        - name: Idempotency-Key
          in: header
          required: false
          schema:
            type: string
          description: UUID único pra evitar duplicação em retry.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - contact_name
                - pipeline_id
              properties:
                contact_name:
                  type: string
                  maxLength: 200
                company_name:
                  type: string
                  maxLength: 200
                email:
                  type: string
                  format: email
                phone:
                  type: string
                  description: Formato E.164
                pipeline_id:
                  type: string
                  format: uuid
                owner_id:
                  type: string
                  format: uuid
                tags:
                  type: array
                  items:
                    type: string
                value_cents:
                  type: integer
                  description: Valor potencial em centavos da moeda da org
      responses:
        '201':
          description: Lead criado
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Lead'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          $ref: '#/components/responses/Conflict'
components:
  schemas:
    Lead:
      type: object
      properties:
        id:
          type: string
          format: uuid
        contact_name:
          type: string
        company_name:
          type: string
          nullable: true
        email:
          type: string
          format: email
          nullable: true
        phone:
          type: string
          nullable: true
        pipeline_id:
          type: string
          format: uuid
        stage:
          type: string
        owner_id:
          type: string
          format: uuid
          nullable: true
        tags:
          type: array
          items:
            type: string
        value_cents:
          type: integer
          nullable: true
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: Identificador estável da família de erro
            message:
              type: string
              description: Descrição legível (não estável entre versões)
            request_id:
              type: string
              description: Cole no chamado ao suporte
  responses:
    BadRequest:
      description: Corpo inválido ou parâmetro ausente
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Token ausente ou expirado
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: Autenticado mas sem permissão para o recurso
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Conflict:
      description: Conflito (duplicate, race condition)
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Cognito id_token obtido após login

````