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

# Criar contato

> Cadastra um novo contato.



## OpenAPI

````yaml /contacts-api/api-reference/openapi-contacts.json post /v1/contacts
openapi: 3.0.3
info:
  title: Notifique API Contatos, tags e audiência
  description: >-
    API para **CRUD de contatos**, **tags**, **tópicos**, **segmentos** e
    **campanhas** (template + audiência + canais).


    **Contato:** pelo menos um de **phone** ou **email** (únicos por workspace).
    **Idiomas:** `languages` é um array de códigos BCP-47 permitidos (lista em
    **`GET /v1/meta/contact-locales`**); ordem = prioridade. **Telegram:** use
    **`telegramLinks`** (`instanceId` + `peer`) para várias instâncias Telegram
    no mesmo workspace; **`telegramPeer`** permanece como atalho legado
    (preenche a ligação na **instância Telegram padrão** do workspace). Na
    campanha, o peer usado é o da **`telegramInstanceId`** da campanha (ou
    default), com *fallback* para `telegramPeer`.


    **Campanhas:** `channels` pode incluir `whatsapp`, `sms`, `email`,
    `telegram`. Cada canal listado deve estar **habilitado no template**.
    **`instanceId`** = WhatsApp; **`telegramInstanceId`** = Telegram.


    **WhatsApp cartão:** `POST /v1/whatsapp/messages` com `type: "contact"` e
    `payload.contactId`.


    **Autenticação:** `Authorization: Bearer sk_live_xxxxx` ou `x-api-key`.


    **Escopos:** `contacts:*`, `tags:*`, `topics:*`, `segments:*`, `campaigns:*`
    (inclui `campaigns:run`).


    **Campanhas (extras):** `POST .../cancel` (DRAFT/SCHEDULED), `GET .../stats`
    e `GET .../recipients` (escopos update/read). Run devolve `runId`. Sending
    Pool WhatsApp: painel.
  version: 1.0.0
servers:
  - url: https://api.notifique.dev
    description: Produção
security:
  - ntfContactBearerAuth: []
  - ntfContactApiKeyHeader: []
tags:
  - name: Contatos
    description: CRUD de contatos do workspace (phone ou email; tags)
  - name: Tags
    description: Tags (rótulos) para vincular a contatos
  - name: Tópicos
    description: Tópicos de comunicação (marketing / opt-in por tema)
  - name: Segmentos
    description: >-
      Segmentos de audiencia (DSL v1). Regras: tag, property, contactField,
      topic, receiveMarketing. Escopos segments:read|create|update|delete.
  - name: Campanhas
    description: Campanhas multicanal com template; execução via POST .../run
paths:
  /v1/contacts:
    post:
      tags:
        - Contatos
      summary: Criar contato
      description: Cadastra um novo contato.
      operationId: ntfContact_postV1Contacts
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NtfContact_ContactCreate'
      responses:
        '200':
          description: Contato criado.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: '#/components/schemas/NtfContact_Contact'
        '400':
          description: >-
            Telefone inválido ou ausência de phone/email
            (CONTACT_REQUIRES_PHONE_OR_EMAIL) ou tagIds inválidos.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NtfContact_ErrorResponse'
        '401':
          description: Não autorizado.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NtfContact_ErrorResponse'
        '402':
          description: Plano expirado ou suspenso.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NtfContact_ErrorResponse'
        '403':
          description: Escopo contacts:create ausente.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NtfContact_ErrorResponse'
        '409':
          description: >-
            Phone ou email já existe no workspace (CONTACT_PHONE_EXISTS,
            CONTACT_EMAIL_EXISTS).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NtfContact_ErrorResponse'
components:
  schemas:
    NtfContact_ContactCreate:
      type: object
      description: >-
        Pelo menos um de **phone** ou **email** obrigatório. **telegramLinks**
        ou **telegramPeer** (instância padrão). **languages** opcional (códigos
        de GET /v1/meta/contact-locales).
      properties:
        phone:
          type: string
          nullable: true
          description: Telefone (único por workspace)
        email:
          type: string
          nullable: true
          description: E-mail (único por workspace)
        name:
          type: string
          nullable: true
        telegramPeer:
          type: string
          nullable: true
          maxLength: 128
          description: >-
            Legado: chat_id ou @username na instância Telegram padrão. Ignorado
            se **telegramLinks** for enviado.
        telegramLinks:
          type: array
          items:
            type: object
            required:
              - instanceId
              - peer
            properties:
              instanceId:
                type: string
              peer:
                type: string
                maxLength: 128
          description: >-
            Uma entrada por instância Telegram; peer único por (instanceId,
            peer) no workspace.
        languages:
          type: array
          items:
            type: string
          description: Substitui a lista de idiomas (vazia permitida).
        url:
          type: string
          nullable: true
        tagIds:
          type: array
          items:
            type: string
          description: IDs das tags a vincular
        receiveMarketing:
          type: boolean
    NtfContact_Contact:
      type: object
      description: >-
        Contato do workspace (phone e/ou email; tags). **telegramLinks** por
        instância Telegram; **telegramPeer** espelha o peer na instância padrão
        (legado).
      properties:
        id:
          type: string
        name:
          type: string
          nullable: true
        phone:
          type: string
          nullable: true
          description: Telefone com código do país
        email:
          type: string
          nullable: true
        telegramPeer:
          type: string
          nullable: true
          description: >-
            Espelho do peer na instância Telegram padrão; preferir telegramLinks
            para múltiplas conexões.
        languages:
          type: array
          items:
            type: string
          description: Códigos BCP-47 permitidos; ordem = prioridade do idioma preferido.
        receiveMarketing:
          type: boolean
        telegramLinks:
          type: array
          items:
            $ref: '#/components/schemas/NtfContact_TelegramLink'
        url:
          type: string
          nullable: true
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        tags:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
              name:
                type: string
    NtfContact_ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          example: false
        error:
          type: string
          description: 'Rótulo HTTP do erro (ex.: Unauthorized, Bad Request, Not Found).'
        message:
          type: string
          description: >-
            Mensagem legível para exibir ao usuário (localizada via
            Accept-Language / x-locale quando aplicável).
        code:
          type: string
          description: >-
            Código estável da API v1 (enum). Sempre presente em erros. Use com o
            status HTTP para decidir retry ou correção. Ver [Respostas de
            erro](/guides/conceitos/resposta-de-erros).
      required:
        - success
        - error
        - message
        - code
    NtfContact_TelegramLink:
      type: object
      description: Ligação do contato a uma instância Telegram do workspace.
      properties:
        instanceId:
          type: string
        peer:
          type: string
          description: chat_id ou @username nesta instância
        instanceName:
          type: string
          description: Nome da instância (conexão)
  securitySchemes:
    ntfContactBearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: 'Authorization: Bearer sk_live_xxxxx'
    ntfContactApiKeyHeader:
      type: apiKey
      in: header
      name: x-api-key
      description: 'x-api-key: sk_live_xxxxx'

````