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

# Criar uma sessão

> Crie ou inicie uma sessão do WhatsApp.

Uma **sessão** é um número de WhatsApp gerenciado pela D-API. Use `type:
"unofficial"` para o WhatsApp não oficial (via QR code) ou `type: "cloud_api"`
para a API Oficial.

Você pode já configurar o `webhookUrl` na criação para receber eventos em tempo
real (mensagens, status, conexão). Veja a [documentação de
webhooks](/whatsapp/webhooks/visao-geral).

<Tip>
  Escolha um `sessionId` estável e único por número — ele é usado em
  praticamente todos os outros endpoints.
</Tip>


## OpenAPI

````yaml api-reference/openapi.json POST /api/v1/sessions
openapi: 3.1.0
info:
  title: D-API - Infraestrutura WhatsApp Completa
  description: >-
    Solução escalável e robusta para gestores de automação, SaaS e usuários
    finais que precisam de uma integração WhatsApp confiável. Oferece múltiplas
    instâncias simultâneas, webhooks em tempo real, dashboard intuitivo e API
    REST documentada com 99.9% de uptime e latência inferior a 30ms.
  version: 1.2.0
  contact:
    name: Suporte D-API
    email: suporte@d-api.cloud
    url: https://d-api.cloud
servers:
  - url: https://api.d-api.cloud
    description: Produção
security:
  - ApiKeyAuth: []
tags:
  - name: Início
    description: Endpoints base
  - name: Sessões
    description: Endpoints para gerenciamento de sessões
  - name: Mensagens
    description: Endpoints para envio de mensagens
  - name: Ligações URA
    description: >-
      Disparo de ligações de voz (URA): individual ou em massa, com áudio ou
      fluxo IVR.
  - name: SMS
    description: 'Envio de SMS: individual ou em massa.'
paths:
  /api/v1/sessions:
    post:
      tags:
        - Sessões
      summary: Criar ou iniciar uma sessão do WhatsApp
      description: >-
        Cria uma nova sessão do WhatsApp ou inicia uma existente, conectando o
        Whatsmeow se necessário
      operationId: postApiV1Sessions
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                sessionId:
                  minLength: 1
                  type: string
                type:
                  anyOf:
                    - const: unofficial
                      type: string
                    - const: cloud_api
                      type: string
                webhookUrl:
                  type: string
                webhookConfig:
                  type: object
                  properties:
                    enabled:
                      type: boolean
                    type:
                      type: string
                    events:
                      type: object
                      patternProperties:
                        ^(.*)$:
                          type: object
                          properties:
                            enabled:
                              type: boolean
                            webhookUrl:
                              type: string
                          required:
                            - enabled
                            - webhookUrl
                  required:
                    - enabled
                    - type
                    - events
                metadata:
                  type: object
                  patternProperties:
                    ^(.*)$: {}
                provider:
                  const: whatsmeow
                  type: string
                connectionMode:
                  anyOf:
                    - const: qr
                      type: string
                    - const: pair
                      type: string
                pairPhone:
                  type: string
                historySync:
                  type: boolean
                ignoreGroups:
                  type: boolean
                ignoreStatus:
                  type: boolean
                wabaId:
                  type: string
                phoneNumberId:
                  type: string
                accessToken:
                  type: string
                businessId:
                  type: string
                displayPhoneNumber:
                  type: string
                verifiedName:
                  type: string
                webhookMode:
                  anyOf:
                    - const: normalized
                      type: string
                    - const: meta_passthrough
                      type: string
          multipart/form-data:
            schema:
              type: object
              properties:
                sessionId:
                  minLength: 1
                  type: string
                type:
                  anyOf:
                    - const: unofficial
                      type: string
                    - const: cloud_api
                      type: string
                webhookUrl:
                  type: string
                webhookConfig:
                  type: object
                  properties:
                    enabled:
                      type: boolean
                    type:
                      type: string
                    events:
                      type: object
                      patternProperties:
                        ^(.*)$:
                          type: object
                          properties:
                            enabled:
                              type: boolean
                            webhookUrl:
                              type: string
                          required:
                            - enabled
                            - webhookUrl
                  required:
                    - enabled
                    - type
                    - events
                metadata:
                  type: object
                  patternProperties:
                    ^(.*)$: {}
                provider:
                  const: whatsmeow
                  type: string
                connectionMode:
                  anyOf:
                    - const: qr
                      type: string
                    - const: pair
                      type: string
                pairPhone:
                  type: string
                historySync:
                  type: boolean
                ignoreGroups:
                  type: boolean
                ignoreStatus:
                  type: boolean
                wabaId:
                  type: string
                phoneNumberId:
                  type: string
                accessToken:
                  type: string
                businessId:
                  type: string
                displayPhoneNumber:
                  type: string
                verifiedName:
                  type: string
                webhookMode:
                  anyOf:
                    - const: normalized
                      type: string
                    - const: meta_passthrough
                      type: string
          text/plain:
            schema:
              type: object
              properties:
                sessionId:
                  minLength: 1
                  type: string
                type:
                  anyOf:
                    - const: unofficial
                      type: string
                    - const: cloud_api
                      type: string
                webhookUrl:
                  type: string
                webhookConfig:
                  type: object
                  properties:
                    enabled:
                      type: boolean
                    type:
                      type: string
                    events:
                      type: object
                      patternProperties:
                        ^(.*)$:
                          type: object
                          properties:
                            enabled:
                              type: boolean
                            webhookUrl:
                              type: string
                          required:
                            - enabled
                            - webhookUrl
                  required:
                    - enabled
                    - type
                    - events
                metadata:
                  type: object
                  patternProperties:
                    ^(.*)$: {}
                provider:
                  const: whatsmeow
                  type: string
                connectionMode:
                  anyOf:
                    - const: qr
                      type: string
                    - const: pair
                      type: string
                pairPhone:
                  type: string
                historySync:
                  type: boolean
                ignoreGroups:
                  type: boolean
                ignoreStatus:
                  type: boolean
                wabaId:
                  type: string
                phoneNumberId:
                  type: string
                accessToken:
                  type: string
                businessId:
                  type: string
                displayPhoneNumber:
                  type: string
                verifiedName:
                  type: string
                webhookMode:
                  anyOf:
                    - const: normalized
                      type: string
                    - const: meta_passthrough
                      type: string
      responses:
        '200':
          description: Resposta bem-sucedida
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: 'API Key para autenticação. Formato: <API_KEY>'

````