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

# Enviar PIX

> Envía un botón de pago PIX con clave y comerciante

**Auth:** `TokenAccount` o `TokenInstance` • **Rate-limit:** `Global` (100/min) • **Idempotente:** no

## Descripción

Envía un mensaje con una **tarjeta visual de PIX** en el chat de WhatsApp, mostrando el nombre del beneficiario, el tipo de clave y la clave en sí. El botón funciona como un **"copiar clave"** con estilo PIX, al tocarlo, el destinatario copia la clave al portapapeles y la pega en su app bancaria para pagar. No abre una pantalla de pago, no crea un cobro, y no hay callback de confirmación, es solo la presentación visual de la clave en un formato amigable y clicable.

## Ejemplos

### PIX con clave CPF

Envía el botón PIX usando una clave `CPF`. Envía **solo dígitos** (sin puntos ni guiones).

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://ryzeapi.cloud/api/message/pix/$Instance_Name" \
    -H "token: $Token_Instance" \
    -H "Content-Type: application/json" \
    -d '{
      "number":       "5511999999999",
      "merchantName": "RyzeAPI Tecnologia",
      "pixKey":       "12345678901",
      "pixKeyType":   "CPF"
    }'
  ```

  ```javascript JavaScript theme={null}
  await fetch(`https://ryzeapi.cloud/api/message/pix/${process.env.Instance_Name}`, {
    method: "POST",
    headers: {
      "token":        process.env.Token_Instance,
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      number:       "5511999999999",
      merchantName: "RyzeAPI Tecnologia",
      pixKey:       "12345678901",
      pixKeyType:   "CPF"
    })
  });
  ```

  ```python Python theme={null}
  import os, requests

  requests.post(
      f"https://ryzeapi.cloud/api/message/pix/{os.environ['Instance_Name']}",
      headers={
          "token":        os.environ["Token_Instance"],
          "Content-Type": "application/json"
      },
      json={
          "number":       "5511999999999",
          "merchantName": "RyzeAPI Tecnologia",
          "pixKey":       "12345678901",
          "pixKeyType":   "CPF"
      }
  )
  ```

  ```go Go theme={null}
  package main

  import (
      "net/http"
      "os"
      "strings"
  )

  func main() {
      body := strings.NewReader(`{
          "number":       "5511999999999",
          "merchantName": "RyzeAPI Tecnologia",
          "pixKey":       "12345678901",
          "pixKeyType":   "CPF"
      }`)
      req, _ := http.NewRequest("POST", "https://ryzeapi.cloud/api/message/pix/"+os.Getenv("Instance_Name"), body)
      req.Header.Set("token", os.Getenv("Token_Instance"))
      req.Header.Set("Content-Type", "application/json")
      http.DefaultClient.Do(req)
  }
  ```
</CodeGroup>

### PIX con clave CNPJ

Envía el botón PIX usando una clave `CNPJ`. Envía **solo dígitos** (sin puntos, guiones ni barras).

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://ryzeapi.cloud/api/message/pix/$Instance_Name" \
    -H "token: $Token_Instance" \
    -H "Content-Type: application/json" \
    -d '{
      "number":       "5511999999999",
      "merchantName": "RyzeAPI Tecnologia",
      "pixKey":       "12345678000199",
      "pixKeyType":   "CNPJ"
    }'
  ```

  ```javascript JavaScript theme={null}
  await fetch(`https://ryzeapi.cloud/api/message/pix/${process.env.Instance_Name}`, {
    method: "POST",
    headers: {
      "token":        process.env.Token_Instance,
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      number:       "5511999999999",
      merchantName: "RyzeAPI Tecnologia",
      pixKey:       "12345678000199",
      pixKeyType:   "CNPJ"
    })
  });
  ```

  ```python Python theme={null}
  import os, requests

  requests.post(
      f"https://ryzeapi.cloud/api/message/pix/{os.environ['Instance_Name']}",
      headers={
          "token":        os.environ["Token_Instance"],
          "Content-Type": "application/json"
      },
      json={
          "number":       "5511999999999",
          "merchantName": "RyzeAPI Tecnologia",
          "pixKey":       "12345678000199",
          "pixKeyType":   "CNPJ"
      }
  )
  ```

  ```go Go theme={null}
  package main

  import (
      "net/http"
      "os"
      "strings"
  )

  func main() {
      body := strings.NewReader(`{
          "number":       "5511999999999",
          "merchantName": "RyzeAPI Tecnologia",
          "pixKey":       "12345678000199",
          "pixKeyType":   "CNPJ"
      }`)
      req, _ := http.NewRequest("POST", "https://ryzeapi.cloud/api/message/pix/"+os.Getenv("Instance_Name"), body)
      req.Header.Set("token", os.Getenv("Token_Instance"))
      req.Header.Set("Content-Type", "application/json")
      http.DefaultClient.Do(req)
  }
  ```
</CodeGroup>

### PIX con clave Email

Envía el botón PIX usando una clave `EMAIL`.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://ryzeapi.cloud/api/message/pix/$Instance_Name" \
    -H "token: $Token_Instance" \
    -H "Content-Type: application/json" \
    -d '{
      "number":       "5511999999999",
      "merchantName": "RyzeAPI Tecnologia",
      "pixKey":       "contato@ryzeapi.cloud",
      "pixKeyType":   "EMAIL"
    }'
  ```

  ```javascript JavaScript theme={null}
  await fetch(`https://ryzeapi.cloud/api/message/pix/${process.env.Instance_Name}`, {
    method: "POST",
    headers: {
      "token":        process.env.Token_Instance,
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      number:       "5511999999999",
      merchantName: "RyzeAPI Tecnologia",
      pixKey:       "contato@ryzeapi.cloud",
      pixKeyType:   "EMAIL"
    })
  });
  ```

  ```python Python theme={null}
  import os, requests

  requests.post(
      f"https://ryzeapi.cloud/api/message/pix/{os.environ['Instance_Name']}",
      headers={
          "token":        os.environ["Token_Instance"],
          "Content-Type": "application/json"
      },
      json={
          "number":       "5511999999999",
          "merchantName": "RyzeAPI Tecnologia",
          "pixKey":       "contato@ryzeapi.cloud",
          "pixKeyType":   "EMAIL"
      }
  )
  ```

  ```go Go theme={null}
  package main

  import (
      "net/http"
      "os"
      "strings"
  )

  func main() {
      body := strings.NewReader(`{
          "number":       "5511999999999",
          "merchantName": "RyzeAPI Tecnologia",
          "pixKey":       "contato@ryzeapi.cloud",
          "pixKeyType":   "EMAIL"
      }`)
      req, _ := http.NewRequest("POST", "https://ryzeapi.cloud/api/message/pix/"+os.Getenv("Instance_Name"), body)
      req.Header.Set("token", os.Getenv("Token_Instance"))
      req.Header.Set("Content-Type", "application/json")
      http.DefaultClient.Do(req)
  }
  ```
</CodeGroup>

## Respuesta exitosa

```json 200 OK theme={null}
{
  "success": true,
  "message": "Message sent successfully",
  "status":  "sent",
  "data": {
    "messageId":   "3EB08FCF27E532F1B0F5",
    "direction":   "outgoing",
    "messageType": "pix",
    "content":     "",
    "source":      "api",
    "timestamp":   "2026-04-30T14:30:00Z",
    "chat": {
      "jid":     "5511999999999@s.whatsapp.net",
      "isGroup": false
    },
    "sender": {
      "jid":      "5511777777777@s.whatsapp.net",
      "instance": "minha-instancia"
    }
  }
}
```

<Note>
  El botón **solo copia la clave PIX** al portapapeles del destinatario, no abre la pantalla de pago del banco ni inicia un cobro. El pago lo hace manualmente el destinatario en su propia app bancaria, y **no hay callback de "pagado" vía WhatsApp**.
</Note>

## Parámetros de ruta

<ParamField path="instance" type="string" required>
  Nombre de la instancia (p. ej., `$Instance_Name`).
</ParamField>

## Cabeceras

<ParamField header="token" type="string" required>
  `TokenAccount` o `TokenInstance`.
</ParamField>

<ParamField header="Content-Type" type="string" required>
  `application/json`
</ParamField>

## Cuerpo de la solicitud

<ParamField body="number" type="string" required>
  Destino: teléfono (`5511999999999`) o JID (`@s.whatsapp.net`, `@lid`, `@g.us`).
</ParamField>

<ParamField body="merchantName" type="string" required>
  Nombre del beneficiario mostrado en la tarjeta visual de PIX (sobre la clave).
</ParamField>

<ParamField body="pixKey" type="string" required>
  Clave PIX (CPF, CNPJ, email, teléfono o clave aleatoria).
</ParamField>

<ParamField body="pixKeyType" type="string" required>
  Tipo de clave. Valores aceptados: `CPF`, `CNPJ`, `EMAIL`, `PHONE`, `RANDOM`.
</ParamField>

<ParamField body="delay" type="int" default="0">
  Tiempo en **segundos** a esperar antes de enviar. Durante el intervalo, el servidor envía el indicador "escribiendo..." al destinatario.
</ParamField>

<ParamField body="replyTo" type="string">
  ID del mensaje a citar (respuesta). El mensaje original debe pertenecer a la misma instancia y haber sido guardado en la base de datos.
</ParamField>

<ParamField body="replyPrivate" type="boolean" default="false">
  Cuando es `true` **y** `replyTo` apunta a un mensaje originado en un grupo, la respuesta se redirige al chat **privado** del autor original.
</ParamField>

<ParamField body="source" type="string" default="api">
  Identificador de origen para trazabilidad (p. ej., `crm`, `checkout`, `n8n`).
</ParamField>

## Notas

<Note>
  * El **`pixKeyType`** se valida con `oneof`, si envías un valor fuera de `CPF | CNPJ | EMAIL | PHONE | RANDOM`, la solicitud se rechaza con `400`.
  * Para claves CPF/CNPJ, envía **solo dígitos** (sin puntos, guiones ni barras): `12345678901` o `12345678000199`.
  * Para `PHONE`, usa el formato internacional sin `+` (p. ej., `5511999999999`).
  * Para `RANDOM`, usa el UUID generado por el banco (p. ej., `aabbccdd-1234-5678-90ab-cdef01234567`).
  * Este endpoint no crea un código QR Brcode ni registra un cobro, es solo la **representación visual** del pedido con una clave PIX clicable.
</Note>

## Errores

| HTTP | Status interno    | Mensaje                                 |
| ---- | ----------------- | --------------------------------------- |
| 400  | ,                 | `Instance name is required`             |
| 400  | ,                 | `Invalid request: <detail>`             |
| 400  | ,                 | `Number is required`                    |
| 400  | ,                 | `MerchantName is required`              |
| 400  | ,                 | `PixKey is required`                    |
| 400  | ,                 | `PixKeyType is required`                |
| 400  | `invalid_number`  | `Invalid phone number format: <detail>` |
| 400  | `invalid_request` | (validación `oneof` u otro motivo)      |
| 404  | ,                 | `Instance not found`                    |
| 500  | `send_failed`     | `Failed to send message: <reason>`      |
| 503  | `disconnected`    | `Instance is not connected to WhatsApp` |

Envoltorio de error:

```json theme={null}
{
  "success": false,
  "error": { "message": "PixKeyType is required" }
}
```
