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

# Consultar segmento

> Consulta um segmento.



## OpenAPI

````yaml /contacts-api/api-reference/openapi-contacts.json get /v1/segments/{segmentId}
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/segments/{segmentId}:
    get:
      tags:
        - Segmentos
      summary: Consultar segmento
      description: Consulta um segmento.
      operationId: ntfContact_getV1SegmentById
      parameters:
        - name: segmentId
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NtfContact_SegmentOneResponse'
              examples:
                ok:
                  summary: Detalhe do segmento
                  value:
                    success: true
                    data:
                      id: clseg01abc
                      name: VIP Cachoeiro com marketing
                      definition:
                        version: 1
                        match: all
                        rules:
                          - type: tag
                            tagId: cltag01vip
                          - type: property
                            key: cidade
                            op: contains
                            value: cachoeiro
                            ignoreCase: true
                          - type: topic
                            topicId: cltopic01
                            subscribed: true
                          - type: contactField
                            field: languages
                            op: includes
                            value: pt-BR
                          - type: receiveMarketing
                            value: true
                      createdAt: '2026-06-28T12:00:00.000Z'
                      updatedAt: '2026-07-01T09:00:00.000Z'
        '401':
          description: Erro
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NtfContact_ErrorResponse'
        '402':
          description: Erro
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NtfContact_ErrorResponse'
        '403':
          description: Erro
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NtfContact_ErrorResponse'
        '404':
          description: Erro
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NtfContact_ErrorResponse'
components:
  schemas:
    NtfContact_SegmentOneResponse:
      type: object
      properties:
        success:
          type: boolean
        data:
          $ref: '#/components/schemas/NtfContact_Segment'
      example:
        success: true
        data:
          id: clseg01abc
          name: VIP Cachoeiro com marketing
          definition:
            version: 1
            match: all
            rules:
              - type: tag
                tagId: cltag01vip
              - type: property
                key: cidade
                op: contains
                value: cachoeiro
                ignoreCase: true
              - type: topic
                topicId: cltopic01
                subscribed: true
              - type: contactField
                field: languages
                op: includes
                value: pt-BR
              - type: receiveMarketing
                value: true
          createdAt: '2026-06-28T12:00:00.000Z'
          updatedAt: '2026-07-01T09:00:00.000Z'
    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_Segment:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        definition:
          $ref: '#/components/schemas/NtfContact_SegmentDefinition'
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
      example:
        id: clseg01abc
        name: VIP Cachoeiro com marketing
        definition:
          version: 1
          match: all
          rules:
            - type: tag
              tagId: cltag01vip
            - type: property
              key: cidade
              op: contains
              value: cachoeiro
              ignoreCase: true
            - type: topic
              topicId: cltopic01
              subscribed: true
            - type: contactField
              field: languages
              op: includes
              value: pt-BR
            - type: receiveMarketing
              value: true
        createdAt: '2026-06-28T12:00:00.000Z'
        updatedAt: '2026-07-01T09:00:00.000Z'
    NtfContact_SegmentDefinition:
      type: object
      description: >-
        DSL v1: version, match (all|any), rules (ate 32). Tipos: tag, property,
        contactField, topic, receiveMarketing.
      required:
        - version
        - match
        - rules
      properties:
        version:
          type: integer
          enum:
            - 1
          example: 1
        match:
          type: string
          enum:
            - all
            - any
          example: all
        rules:
          type: array
          maxItems: 32
          description: Lista vazia = todos os contatos.
          items:
            $ref: '#/components/schemas/NtfContact_SegmentRule'
          example:
            - type: property
              key: cidade
              op: containsOneOf
              value: cachoeiro,marataizes
              ignoreCase: true
            - type: topic
              topicId: cltopic01
              subscribed: true
            - type: contactField
              field: hasEmail
              op: isTrue
            - type: receiveMarketing
              value: true
      example:
        version: 1
        match: all
        rules:
          - type: tag
            tagId: cltag01vip
          - type: property
            key: cidade
            op: contains
            value: cachoeiro
            ignoreCase: true
          - type: topic
            topicId: cltopic01
            subscribed: true
          - type: contactField
            field: languages
            op: includes
            value: pt-BR
          - type: receiveMarketing
            value: true
    NtfContact_SegmentRule:
      type: object
      description: Uma regra do segmento. Campos dependem de type.
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - tag
            - property
            - contactField
            - topic
            - receiveMarketing
          example: property
        tagId:
          type: string
          description: Obrigatorio quando type=tag
          example: cltag01vip
        key:
          type: string
          description: Chave do campo personalizado (type=property)
          example: cidade
        value:
          description: >-
            Valor da regra (string/number/boolean conforme op). containsOneOf
            usa CSV.
          oneOf:
            - type: string
            - type: number
            - type: boolean
          example: cachoeiro,marataizes
        op:
          type: string
          description: >-
            Operador tipado (property/contactField). Prefira em vez de
            valueMatch.
          example: containsOneOf
        valueMatch:
          type: string
          enum:
            - exact
            - contains
          description: Legado para property STRING. Preferir op.
        ignoreCase:
          type: boolean
          example: true
        field:
          type: string
          description: Campo de plataforma quando type=contactField
          enum:
            - name
            - phone
            - email
            - url
            - telegramPeer
            - languages
            - hasPhone
            - hasEmail
            - hasUrl
            - hasTelegram
          example: phone
        topicId:
          type: string
          description: Obrigatorio quando type=topic
          example: cltopic01
        subscribed:
          type: boolean
          description: Quando type=topic
          example: true
      example:
        type: tag
        tagId: cltag01vip
  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'

````