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

# Enviar ubicación

> Envía mensajes de ubicación

export const ChannelSupport = ({whatsapp = 'yes', web = 'yes', instagram = 'yes', messenger = 'yes', telegram = 'yes', lang = 'pt'}) => {
  const L = ({
    pt: {
      title: 'Disponibilidade por canal',
      win: 'No WhatsApp Oficial exige a janela de 24 horas aberta. Nos outros canais não há janela.',
      names: ['WhatsApp Oficial', 'WhatsApp Web', 'Instagram', 'Messenger', 'Telegram']
    },
    en: {
      title: 'Availability per channel',
      win: 'On WhatsApp Official it requires the 24-hour window to be open. The other channels have no window.',
      names: ['WhatsApp Official', 'WhatsApp Web', 'Instagram', 'Messenger', 'Telegram']
    },
    es: {
      title: 'Disponibilidad por canal',
      win: 'En WhatsApp Oficial exige que la ventana de 24 horas esté abierta. Los demás canales no tienen ventana.',
      names: ['WhatsApp Oficial', 'WhatsApp Web', 'Instagram', 'Messenger', 'Telegram']
    }
  })[lang];
  const mark = v => v === 'yes' ? '✅' : v === 'partial' ? '⚠️' : '❌';
  const vals = [whatsapp, web, instagram, messenger, telegram];
  return <div>
      <p><strong>{L.title}</strong></p>
      <table>
        <thead>
          <tr>{L.names.map(n => <th key={n} style={{
    textAlign: 'center'
  }}>{n}</th>)}</tr>
        </thead>
        <tbody>
          <tr>{vals.map((v, i) => <td key={i} style={{
    textAlign: 'center'
  }}>{mark(v)}</td>)}</tr>
        </tbody>
      </table>
      {whatsapp === 'yes' && <p>{L.win}</p>}
    </div>;
};

## Conceptos

Envía un mensaje de ubicación a un contacto. El campo `content.type` debe ser `LOCATION` y las coordenadas se indican en el array `attachments` mediante `latitude` y `longitude`.

Los campos `name` y `address` son opcionales y permiten mostrar el nombre y la dirección del lugar directamente en el mensaje.

<Warning>
  La API no valida los campos `latitude` y `longitude`. Las peticiones que no incluyan esos valores se aceptarán, pero el mensaje no mostrará la ubicación correctamente en WhatsApp. Indica siempre ambos campos.
</Warning>

<ChannelSupport lang="es" instagram="no" messenger="no" />

<Note>
  Detalles de la regla de WhatsApp Oficial en [ventana de conversación](/es/conversation-window). Consulta la [matriz de capacidades](/es/channels/overview) para todos los canales.
</Note>


## OpenAPI

````yaml es/messages/openapi-location.json POST /v1/channels/{channelId}/messages
openapi: 3.1.0
info:
  title: Omni Z-API - Enviar ubicación
  version: 1.0.0
servers:
  - url: https://api.omni.z-api.io
security:
  - bearerAuth: []
paths:
  /v1/channels/{channelId}/messages:
    post:
      tags:
        - Mensajes
      summary: Enviar ubicación
      description: >-
        Envía un mensaje de ubicación. Solo funciona cuando la ventana de
        conversación de 24 horas está abierta.
      operationId: sendLocationMessage
      parameters:
        - name: channelId
          in: path
          required: true
          description: ID del canal
          schema:
            type: string
            example: SU_CHANNEL_ID
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SendLocationRequest'
            example:
              recipient:
                identifier: '5544936181064'
                name: Nombre del Destinatario
                subject: Título
                picture: ''
              sender:
                identifier: '5544936181064'
                name: Nombre del Remitente
                picture: ''
              content:
                type: LOCATION
                attachments:
                  - name: Google Brasil
                    address: >-
                      Av. Brg. Faria Lima, 3477 - Itaim Bibi, São Paulo - SP,
                      04538-133
                    latitude: '-23.0696347'
                    longitude: '-50.4357913'
      responses:
        '200':
          $ref: '#/components/responses/MessageSuccess'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/WindowClosed'
components:
  schemas:
    SendLocationRequest:
      type: object
      required:
        - recipient
        - content
      properties:
        recipient:
          type: object
          required:
            - identifier
          description: Datos del destinatario
          properties:
            identifier:
              type: string
              description: Teléfono del destinatario (código de país + prefijo + número)
              example: '5544936181064'
            name:
              type: string
              description: Nombre del destinatario (opcional)
              example: Nombre del Destinatario
            subject:
              type: string
              description: Título o asunto (opcional)
              example: Título
            picture:
              type: string
              description: URL de la foto del destinatario (opcional)
              example: ''
        sender:
          type: object
          description: Datos del remitente (opcional)
          properties:
            identifier:
              type: string
              description: Teléfono del remitente
              example: '5544936181064'
            name:
              type: string
              description: Nombre del remitente
              example: Nombre del Remitente
            picture:
              type: string
              description: URL de la foto del remitente
              example: ''
        content:
          type: object
          required:
            - type
            - attachments
          properties:
            type:
              type: string
              description: Tipo de mensaje
              enum:
                - LOCATION
            attachments:
              type: array
              description: Lista con los datos de la ubicación
              items:
                type: object
                properties:
                  latitude:
                    type: string
                    description: >-
                      Latitud de la ubicación. La API no lo valida, pero es
                      necesario para que el pin se muestre correctamente en
                      WhatsApp.
                    example: '-23.0696347'
                  longitude:
                    type: string
                    description: >-
                      Longitud de la ubicación. La API no lo valida, pero es
                      necesario para que el pin se muestre correctamente en
                      WhatsApp.
                    example: '-50.4357913'
                  name:
                    type: string
                    description: Nombre del lugar (opcional)
                    example: Google Brasil
                  address:
                    type: string
                    description: Dirección del lugar (opcional)
                    example: >-
                      Av. Brg. Faria Lima, 3477 - Itaim Bibi, São Paulo - SP,
                      04538-133
    MessageResponse:
      type: object
      properties:
        messageId:
          type: string
          description: ID del mensaje enviado
    Error:
      type: object
      properties:
        error:
          type: integer
        message:
          type: string
  responses:
    MessageSuccess:
      description: Mensaje enviado correctamente
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/MessageResponse'
          example:
            messageId: wamid.HBgNNTU0NDk3MDUwNzg1FQIAERgSM0
    Unauthorized:
      description: Token no válido o ausente.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: 401
            message: Unauthorized
    WindowClosed:
      description: La ventana de conversación de 24 horas está cerrada.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: 422
            message: Conversation window is closed
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Secret Key generada en el panel de Seguridad de Omni Z-API

````