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

# Status da mensagem

> Consulta status/delivery de uma mensagem enviada pela API pública.
Requer scope `messages:read`. Consome bucket **read**.




## OpenAPI

````yaml /openapi.yaml get /api/public/v1/messages/{messageId}
openapi: 3.1.0
info:
  title: aidesk Public API
  version: 1.0.0
  summary: API pública para envio de mensagens, consulta de status e webhooks
  description: >
    Base oficial: `https://api.aideskbr.com`


    Autenticação com API key (`ak_live_...`). A organização é resolvida pela key
    —

    não envie `organization_id` nestas rotas.
  contact:
    name: aidesk
    url: https://developers.aideskbr.com
servers:
  - url: https://api.aideskbr.com
    description: Produção
security:
  - bearerAuth: []
  - apiKeyAuth: []
tags:
  - name: Health
    description: Verificação de autenticação e escopos
  - name: Messages
    description: Envio e consulta de mensagens
  - name: Webhooks
    description: Endpoints para receber eventos de delivery
paths:
  /api/public/v1/messages/{messageId}:
    get:
      tags:
        - Messages
      summary: Status da mensagem
      description: |
        Consulta status/delivery de uma mensagem enviada pela API pública.
        Requer scope `messages:read`. Consome bucket **read**.
      operationId: getMessage
      parameters:
        - name: messageId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Mensagem encontrada
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/X-RateLimit-Limit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/X-RateLimit-Remaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/X-RateLimit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessageStatus'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  headers:
    X-RateLimit-Limit:
      description: Limite do bucket na janela atual
      schema:
        type: integer
    X-RateLimit-Remaining:
      description: Restante no bucket
      schema:
        type: integer
    X-RateLimit-Reset:
      description: Unix timestamp do reset
      schema:
        type: integer
    Retry-After:
      description: Segundos para retry (em 429)
      schema:
        type: integer
  schemas:
    MessageStatus:
      type: object
      required:
        - message_id
        - thread_id
        - contact_id
        - channel_id
        - client_message_id
        - type
        - direction
        - delivery_state
      properties:
        message_id:
          type: string
          format: uuid
        thread_id:
          type: string
          format: uuid
        contact_id:
          type: string
          format: uuid
        channel_id:
          type: string
          format: uuid
        channel_kind:
          type: string
          examples:
            - whatsapp
        client_message_id:
          type: string
        type:
          type: string
        direction:
          type: string
          examples:
            - outbound
        body:
          type: string
          nullable: true
        delivery_state:
          type: string
        provider_error_code:
          type: string
          nullable: true
        provider_error_detail:
          type: string
          nullable: true
        sent_at:
          type: string
          format: date-time
          nullable: true
        delivery_updated_at:
          type: string
          format: date-time
          nullable: true
    ErrorEnvelope:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              examples:
                - api_key_required
                - rate_limited
                - idempotency_key_reused
            message:
              type: string
  responses:
    Unauthorized:
      description: API key ausente, inválida, revogada ou expirada
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
          examples:
            missing:
              value:
                error:
                  code: api_key_required
                  message: API key ausente
    Forbidden:
      description: Scope ou canal não permitido
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
          examples:
            scope:
              value:
                error:
                  code: missing_scope
                  message: Scope insuficiente
    NotFound:
      description: Recurso inexistente ou fora da org da key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
          examples:
            message:
              value:
                error:
                  code: message_not_found
                  message: Mensagem não encontrada
    RateLimited:
      description: Rate limit excedido
      headers:
        Retry-After:
          $ref: '#/components/headers/Retry-After'
        X-RateLimit-Limit:
          $ref: '#/components/headers/X-RateLimit-Limit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/X-RateLimit-Remaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/X-RateLimit-Reset'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
          example:
            error:
              code: rate_limited
              message: Rate limit exceeded
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: ak_live
      description: 'Authorization: Bearer ak_live_<secret>'
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-Api-Key
      description: 'Alternativa ao Bearer — X-Api-Key: ak_live_<secret>'

````