DOCUMENTAÇÃO COMPLETA

Construa sobre o WhatsApp
sem adivinhar a API.

Referência estática da megaAPI com exemplos reais, cobertura por plano e um prompt pronto para cada agente de codificação.

Start · 37Business · 128NoCode · 38 (6 exclusivos)evidência real identificada
01

Autentique

Envie Authorization: Bearer <SEU_TOKEN> em todas as chamadas.

02

Escolha o host

Use o host entregue para a sua instância; ele varia por plano e disponibilidade.

03

Peça ajuda à IA

Copie o prompt do agente no endpoint e adapte apenas os dados do seu produto.

QUAL PLANO USAR

Start, Business e NoCode

Os 3 planos falam o mesmo protocolo REST — o que muda é o host e quais dos 134 endpoints a instância aceita. Start é subconjunto de Business; NoCode cobre os mesmos 32 do Start + 6 endpoints de configuração exclusivos.

Business

128 endpoints

Cobertura completa: os 37 do Start + grupos, produtos, privacidade, etiquetas e mais.

Host: apibusiness1.megaapi.com.br

Ideal para: E-commerce, SAC e times que precisam gerenciar grupos, catálogo e configurações avançadas da conta.

Start

37 endpoints

O essencial para enviar e receber mensagens: texto, mídia, webhook e operações básicas da instância.

Hosts: apistart01.megaapi.com.br / apistart02.megaapi.com.br / apistart03.megaapi.com.br

Ideal para: Bots simples, avisos automáticos e integrações que só precisam mandar/receber mensagem.

NoCode

38 endpoints

38 endpoints: os 32 essenciais do Start (mensagens, webhook, instância e grupos) + 6 de configuração exclusivos.

Hosts: apinocode01.megaapi.com.br / apinocode02.megaapi.com.br

Ideal para: Quem monta a automação em uma ferramenta no-code (n8n, Make, FlutterFlow) e precisa de mensagens, webhook e configuração da instância pela API.

Como saber o plano da minha instância

O host que a sua instância usa já diz o plano: qualquer host que comece com apistart é Start, apibusiness é Business, apinocode é NoCode — o número final (01, 02, 03...) é só o servidor, não muda o plano nem os endpoints disponíveis. Um endpoint com badge de um plano só que você não vê na sua instância não está disponível para ela — confira o host antes de reportar erro.

ANTES DE CHAMAR QUALQUER ENDPOINT

Autenticação

Toda chamada usa dois dados por instância: a instance key (vai na URL) e o token (vai no header). Os exemplos desta doc usam placeholders e nunca incluem credenciais reais.

Instance key

Identifica a instância na URL, no lugar de {instance_key}. Não é segredo sozinha — mas combinada ao token dá controle total da instância.

Token

Vai sempre no header Authorization, nunca na URL nem no corpo. É a credencial que autoriza a chamada — trate como senha.

Header obrigatório

Authorization: Bearer <SEU_TOKEN>
Content-Type: application/json

Onde conseguir e como proteger

Instance key e token ficam no painel, nos detalhes da instância. Nunca coloque o token no frontend/app do navegador — qualquer pessoa que abrir o código-fonte da página consegue lê-lo. Faça a chamada à megaAPI a partir do seu backend, e exponha ao navegador só o que o seu próprio backend decidir devolver.

Alguns planos têm mais de um servidor. Sua instância usa só um deles (definido no provisionamento) — o número final não muda nada, é balanceamento de carga.

PlanoHosts
Businessapibusiness1.megaapi.com.br
Startapistart01.megaapi.com.br / apistart02.megaapi.com.br / apistart03.megaapi.com.br
NoCodeapinocode01.megaapi.com.br / apinocode02.megaapi.com.br
StatusSignificadoO que fazer
2xxOperação aceitaLeia o JSON retornado.
4xx/5xxErro da API ou contexto inválidoPreserve o corpo de erro para diagnóstico; não exponha o token.
POSTConversasBusinesstestado na API real

Arquivar ou desarquivar conversa

Move a conversa para fora da lista principal e para Arquivadas, ou a traz de volta. Nada é apagado: a conversa e todas as mensagens continuam existindo.

POSThttps://{seu_host}/rest/chat/{instance_key}/archiveChat

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
tobodystring"5511999998888"opcionalValor enviado no corpo: to.
Número com DDI+DDD e só dígitos (ex.: 5511999998888) ou o ID do grupo terminado em @g.us. Nunca use +, espaço ou traço.
optionbodybooleanfalseopcionalValor enviado no corpo: option.
true arquiva a conversa; false traz de volta para a lista principal.
messageDatabodyobject
JSON
{
  "key": {},
  "messageTimestamp": 0
}
opcionalValor enviado no corpo: message data.
AtributosTipoDescrição
tostringContato Whatsapp
optionsbooleanOpções: true - Para arquivar o chatfalse - Para desarquivar um chat
keyobject
messageTimestampnumber
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/archiveChat" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "to": "5511999998888",
  "option": false,
  "messageData": {
    "key": {},
    "messageTimestamp": 0
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/archiveChat', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "to": "5511999998888",
  "option": false,
  "messageData": {
    "key": {},
    "messageTimestamp": 0
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/archiveChat', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "to": "5511999998888",
  "option": false,
  "messageData": {
    "key": {},
    "messageTimestamp": 0
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to archive or unarchive conversation. On confirm, the backend must call POST /rest/chat/{instance_key}/archiveChat on megaAPI using the configured instance and the securely stored token. Moves the conversation out of the main list and into Archived, or brings it back. Nothing is deleted: the conversation and all its messages remain. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "to": "5511999998888",
  "option": false,
  "messageData": {
    "key": {},
    "messageTimestamp": 0
  }
}
Claude Code
Implement a TypeScript function called chat_archiveChat that calls POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/archiveChat with Authorization Bearer <YOUR_TOKEN>. Moves the conversation out of the main list and into Archived, or brings it back. Nothing is deleted: the conversation and all its messages remain. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "to": "5511999998888",
  "option": false,
  "messageData": {
    "key": {},
    "messageTimestamp": 0
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the chat.archiveChat integration in a Node.js service. Moves the conversation out of the main list and into Archived, or brings it back. Nothing is deleted: the conversation and all its messages remain."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/archiveChat",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "to": "5511999998888",
        "option": false,
        "messageData": {
          "key": {},
          "messageTimestamp": 0
        }
      }
    }
  ]
}
Cursor
In the current project, implement the chat_archiveChat client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/archiveChat. Moves the conversation out of the main list and into Archived, or brings it back. Nothing is deleted: the conversation and all its messages remain. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "to": "5511999998888",
  "option": false,
  "messageData": {
    "key": {},
    "messageTimestamp": 0
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/archiveChat. Auth: Bearer <YOUR_TOKEN>. Moves the conversation out of the main list and into Archived, or brings it back. Nothing is deleted: the conversation and all its messages remain. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "to": "5511999998888",
  "option": false,
  "messageData": {
    "key": {},
    "messageTimestamp": 0
  }
}
POSTConversasBusinesstestado na API real

Bloquear ou desbloquear contato

Bloqueia o contato: ele deixa de poder enviar mensagens para o número conectado e deixa de ver "online" e a foto de perfil. A mesma chamada desfaz o bloqueio, mas as mensagens que ele tentou enviar enquanto esteve bloqueado não são entregues depois.

POSThttps://{seu_host}/rest/chat/{instance_key}/blockChat

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
tobodystring"5511999998888"opcionalValor enviado no corpo: to.
Número com DDI+DDD e só dígitos (ex.: 5511999998888) ou o ID do grupo terminado em @g.us. Nunca use +, espaço ou traço.
optionbodybooleanfalseopcionalValor enviado no corpo: option.
true bloqueia o contato; false desbloqueia.
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/blockChat" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "to": "5511999998888",
  "option": false
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/blockChat', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "to": "5511999998888",
  "option": false
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/blockChat', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "to": "5511999998888",
  "option": false
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to block or unblock contact. On confirm, the backend must call POST /rest/chat/{instance_key}/blockChat on megaAPI using the configured instance and the securely stored token. Blocks the contact: they can no longer message the connected number and no longer see "online" and the profile photo. The same call undoes the block, but the messages they tried to send while blocked are not delivered afterward. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "to": "5511999998888",
  "option": false
}
Claude Code
Implement a TypeScript function called chat_blockChat that calls POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/blockChat with Authorization Bearer <YOUR_TOKEN>. Blocks the contact: they can no longer message the connected number and no longer see "online" and the profile photo. The same call undoes the block, but the messages they tried to send while blocked are not delivered afterward. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "to": "5511999998888",
  "option": false
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the chat.blockChat integration in a Node.js service. Blocks the contact: they can no longer message the connected number and no longer see \"online\" and the profile photo. The same call undoes the block, but the messages they tried to send while blocked are not delivered afterward."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/blockChat",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "to": "5511999998888",
        "option": false
      }
    }
  ]
}
Cursor
In the current project, implement the chat_blockChat client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/blockChat. Blocks the contact: they can no longer message the connected number and no longer see "online" and the profile photo. The same call undoes the block, but the messages they tried to send while blocked are not delivered afterward. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "to": "5511999998888",
  "option": false
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/blockChat. Auth: Bearer <YOUR_TOKEN>. Blocks the contact: they can no longer message the connected number and no longer see "online" and the profile photo. The same call undoes the block, but the messages they tried to send while blocked are not delivered afterward. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "to": "5511999998888",
  "option": false
}
POSTConversasBusinesstestado na API real

Limpar mensagens da conversa

Apaga todas as mensagens da conversa, mas mantém a conversa na lista. As mensagens apagadas não voltam.

POSThttps://{seu_host}/rest/chat/{instance_key}/clearChat

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "to": "5511999998888",
  "key": {},
  "messageTimestamp": 0,
  "starredMessage": true,
  "mediaFromDevice": true
}
opcionalValor enviado no corpo: message data.
Indique a conversa que terá as mensagens apagadas. A limpeza é definitiva.
AtributosTipoDescrição
tostring
keyobject
messageTimestampnumber
starredMessageboolean
mediaFromDeviceboolean
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/clearChat" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "to": "5511999998888",
    "key": {},
    "messageTimestamp": 0,
    "starredMessage": true,
    "mediaFromDevice": true
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/clearChat', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "key": {},
    "messageTimestamp": 0,
    "starredMessage": true,
    "mediaFromDevice": true
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/clearChat', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "key": {},
    "messageTimestamp": 0,
    "starredMessage": true,
    "mediaFromDevice": true
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to clear conversation messages. On confirm, the backend must call POST /rest/chat/{instance_key}/clearChat on megaAPI using the configured instance and the securely stored token. Deletes every message inside the conversation but keeps the conversation in the list. Deleted messages do not come back. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "to": "5511999998888",
    "key": {},
    "messageTimestamp": 0,
    "starredMessage": true,
    "mediaFromDevice": true
  }
}
Claude Code
Implement a TypeScript function called chat_clearChat that calls POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/clearChat with Authorization Bearer <YOUR_TOKEN>. Deletes every message inside the conversation but keeps the conversation in the list. Deleted messages do not come back. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "to": "5511999998888",
    "key": {},
    "messageTimestamp": 0,
    "starredMessage": true,
    "mediaFromDevice": true
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the chat.clearChat integration in a Node.js service. Deletes every message inside the conversation but keeps the conversation in the list. Deleted messages do not come back."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/clearChat",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "to": "5511999998888",
          "key": {},
          "messageTimestamp": 0,
          "starredMessage": true,
          "mediaFromDevice": true
        }
      }
    }
  ]
}
Cursor
In the current project, implement the chat_clearChat client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/clearChat. Deletes every message inside the conversation but keeps the conversation in the list. Deleted messages do not come back. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "to": "5511999998888",
    "key": {},
    "messageTimestamp": 0,
    "starredMessage": true,
    "mediaFromDevice": true
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/clearChat. Auth: Bearer <YOUR_TOKEN>. Deletes every message inside the conversation but keeps the conversation in the list. Deleted messages do not come back. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "to": "5511999998888",
    "key": {},
    "messageTimestamp": 0,
    "starredMessage": true,
    "mediaFromDevice": true
  }
}
POSTConversasBusinesstestado na API real

Apagar conversa

Apaga a conversa inteira, com todo o histórico, da instance. Sem desfazer: as mensagens não podem ser recuperadas por esta API depois.

POSThttps://{seu_host}/rest/chat/{instance_key}/deleteChat

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "to": "5511999998888",
  "key": {},
  "messageTimestamp": 0
}
opcionalValor enviado no corpo: message data.
Indique a conversa a apagar. Confira o valor antes de enviar — apagar a conversa errada não tem volta.
AtributosTipoDescrição
tostring
keyobject
messageTimestampnumber
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/deleteChat" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "to": "5511999998888",
    "key": {},
    "messageTimestamp": 0
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/deleteChat', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "key": {},
    "messageTimestamp": 0
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/deleteChat', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "key": {},
    "messageTimestamp": 0
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to delete conversation. On confirm, the backend must call POST /rest/chat/{instance_key}/deleteChat on megaAPI using the configured instance and the securely stored token. Deletes the whole conversation, with all its history, from the instance. No undo: the messages cannot be recovered through this API afterward. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "to": "5511999998888",
    "key": {},
    "messageTimestamp": 0
  }
}
Claude Code
Implement a TypeScript function called chat_deleteChat that calls POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/deleteChat with Authorization Bearer <YOUR_TOKEN>. Deletes the whole conversation, with all its history, from the instance. No undo: the messages cannot be recovered through this API afterward. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "to": "5511999998888",
    "key": {},
    "messageTimestamp": 0
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the chat.deleteChat integration in a Node.js service. Deletes the whole conversation, with all its history, from the instance. No undo: the messages cannot be recovered through this API afterward."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/deleteChat",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "to": "5511999998888",
          "key": {},
          "messageTimestamp": 0
        }
      }
    }
  ]
}
Cursor
In the current project, implement the chat_deleteChat client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/deleteChat. Deletes the whole conversation, with all its history, from the instance. No undo: the messages cannot be recovered through this API afterward. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "to": "5511999998888",
    "key": {},
    "messageTimestamp": 0
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/deleteChat. Auth: Bearer <YOUR_TOKEN>. Deletes the whole conversation, with all its history, from the instance. No undo: the messages cannot be recovered through this API afterward. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "to": "5511999998888",
    "key": {},
    "messageTimestamp": 0
  }
}
POSTConversasBusinessStartNoCodetestado na API real

Apagar mensagem

Remove uma mensagem da conversa. A ação é irreversível: a mensagem não volta, e o WhatsApp deixa um aviso no lugar indicando que uma mensagem foi apagada.

POSThttps://{seu_host}/rest/chat/{instance_key}/deleteMessage

Disponível em mais de um plano — troque o host conforme a sua instância:

Business: apibusiness1.megaapi.com.brStart: apistart01.megaapi.com.br / apistart02.megaapi.com.br / apistart03.megaapi.com.brNoCode: apinocode01.megaapi.com.br / apinocode02.megaapi.com.br
CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "to": "5511999998888",
  "key": {},
  "messageTimestamp": 0
}
opcionalValor enviado no corpo: message data.
O campo `key` identifica a mensagem. Copie exatamente como veio no webhook ou na listagem de mensagens; não dá para montar à mão.
AtributosTipoDescrição
tostringContato do chat que deseja deletar uma mensagem
keyobjectObjeto que contem as informações necessárias para deletar a mensagen whatsapp
messageTimestampnumber
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/deleteMessage" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "to": "5511999998888",
    "key": {},
    "messageTimestamp": 0
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/deleteMessage', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "key": {},
    "messageTimestamp": 0
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/deleteMessage', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "key": {},
    "messageTimestamp": 0
  }
})
});
console.log(await response.json());
HTTP 200
{
  "error": false,
  "message": "Message deleted",
  "messageData": {
    "key": {
      "remoteJid": "[email protected]",
      "fromMe": true,
      "id": "3EB07C52758D9C0C54E037"
    },
    "message": {
      "protocolMessage": {
        "key": {
          "remoteJid": "[email protected]",
          "fromMe": true,
          "id": "3EB00367A4546826D641C5"
        },
        "type": "REVOKE"
      },
      "messageContextInfo": {
        "messageSecret": "wBDffwmBifiSUoherkA4C85r+i+AG8pB+MF+6AV6IPc="
      }
    },
    "messageTimestamp": "1787754546",
    "status": "SERVER_ACK"
  }
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to delete message. On confirm, the backend must call POST /rest/chat/{instance_key}/deleteMessage on megaAPI using the configured instance and the securely stored token. Deletes a message from the conversation. The action is irreversible: the message does not come back, and WhatsApp leaves a notice in its place that a message was deleted. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "to": "5511999998888",
    "key": {},
    "messageTimestamp": 0
  }
}
Claude Code
Implement a TypeScript function called chat_deleteMessage that calls POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/deleteMessage with Authorization Bearer <YOUR_TOKEN>. Deletes a message from the conversation. The action is irreversible: the message does not come back, and WhatsApp leaves a notice in its place that a message was deleted. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "to": "5511999998888",
    "key": {},
    "messageTimestamp": 0
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the chat.deleteMessage integration in a Node.js service. Deletes a message from the conversation. The action is irreversible: the message does not come back, and WhatsApp leaves a notice in its place that a message was deleted."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/deleteMessage",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "to": "5511999998888",
          "key": {},
          "messageTimestamp": 0
        }
      }
    }
  ]
}
Cursor
In the current project, implement the chat_deleteMessage client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/deleteMessage. Deletes a message from the conversation. The action is irreversible: the message does not come back, and WhatsApp leaves a notice in its place that a message was deleted. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "to": "5511999998888",
    "key": {},
    "messageTimestamp": 0
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/deleteMessage. Auth: Bearer <YOUR_TOKEN>. Deletes a message from the conversation. The action is irreversible: the message does not come back, and WhatsApp leaves a notice in its place that a message was deleted. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "to": "5511999998888",
    "key": {},
    "messageTimestamp": 0
  }
}
POSTConversasBusinessStartNoCodetestado na API real

Apagar mensagem enviada por você

Remove uma mensagem que veio do próprio número conectado. É definitivo: uma vez apagada, a mensagem não pode ser recuperada por esta API.

POSThttps://{seu_host}/rest/chat/{instance_key}/deleteMessageFromMe

Disponível em mais de um plano — troque o host conforme a sua instância:

Business: apibusiness1.megaapi.com.brStart: apistart01.megaapi.com.br / apistart02.megaapi.com.br / apistart03.megaapi.com.brNoCode: apinocode01.megaapi.com.br / apinocode02.megaapi.com.br
CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
tobodystring"5511999998888"opcionalValor enviado no corpo: to.
Número com DDI+DDD e só dígitos (ex.: 5511999998888) ou o ID do grupo terminado em @g.us. Nunca use +, espaço ou traço.
messageDatabodyobject
JSON
{
  "id": "<VALOR>",
  "timestamp": 0
}
opcionalValor enviado no corpo: message data.
Em `id` vai o identificador da mensagem e em `timestamp` o horário em que ela foi enviada, ambos exatamente como vieram do webhook ou da listagem de mensagens.
AtributosTipoDescrição
idstring
timestampnumber
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/deleteMessageFromMe" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "to": "5511999998888",
  "messageData": {
    "id": "<VALOR>",
    "timestamp": 0
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/deleteMessageFromMe', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "to": "5511999998888",
  "messageData": {
    "id": "<VALOR>",
    "timestamp": 0
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/deleteMessageFromMe', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "to": "5511999998888",
  "messageData": {
    "id": "<VALOR>",
    "timestamp": 0
  }
})
});
console.log(await response.json());
HTTP 200
{
  "error": false,
  "message": "Message FromMe in chat deleted"
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to delete message sent by you. On confirm, the backend must call POST /rest/chat/{instance_key}/deleteMessageFromMe on megaAPI using the configured instance and the securely stored token. Deletes a message that came from the connected number itself. It is final: once deleted, the message cannot be recovered through this API. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "to": "5511999998888",
  "messageData": {
    "id": "<VALOR>",
    "timestamp": 0
  }
}
Claude Code
Implement a TypeScript function called chat_deleteMessageFromMe that calls POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/deleteMessageFromMe with Authorization Bearer <YOUR_TOKEN>. Deletes a message that came from the connected number itself. It is final: once deleted, the message cannot be recovered through this API. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "to": "5511999998888",
  "messageData": {
    "id": "<VALOR>",
    "timestamp": 0
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the chat.deleteMessageFromMe integration in a Node.js service. Deletes a message that came from the connected number itself. It is final: once deleted, the message cannot be recovered through this API."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/deleteMessageFromMe",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "to": "5511999998888",
        "messageData": {
          "id": "<VALOR>",
          "timestamp": 0
        }
      }
    }
  ]
}
Cursor
In the current project, implement the chat_deleteMessageFromMe client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/deleteMessageFromMe. Deletes a message that came from the connected number itself. It is final: once deleted, the message cannot be recovered through this API. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "to": "5511999998888",
  "messageData": {
    "id": "<VALOR>",
    "timestamp": 0
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/deleteMessageFromMe. Auth: Bearer <YOUR_TOKEN>. Deletes a message that came from the connected number itself. It is final: once deleted, the message cannot be recovered through this API. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "to": "5511999998888",
  "messageData": {
    "id": "<VALOR>",
    "timestamp": 0
  }
}
POSTConversasBusinesstestado na API real

Silenciar conversa

Para de receber notificações de uma conversa pelo período informado. As mensagens continuam chegando normalmente, apenas não notificam.

POSThttps://{seu_host}/rest/chat/{instance_key}/muteChat

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
tobodystring"5511999998888"opcionalValor enviado no corpo: to.
Número com DDI+DDD e só dígitos (ex.: 5511999998888) ou o ID do grupo terminado em @g.us. Nunca use +, espaço ou traço.
timebodynumber0opcionalValor enviado no corpo: time.
Duração do silenciamento. Use um dos períodos aceitos pelo WhatsApp; passado o prazo, a conversa volta a notificar sozinha.
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/muteChat" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "to": "5511999998888",
  "time": 0
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/muteChat', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "to": "5511999998888",
  "time": 0
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/muteChat', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "to": "5511999998888",
  "time": 0
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to mute conversation. On confirm, the backend must call POST /rest/chat/{instance_key}/muteChat on megaAPI using the configured instance and the securely stored token. Stops getting notifications from a conversation for the given time. Messages keep arriving normally, they just do not notify. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "to": "5511999998888",
  "time": 0
}
Claude Code
Implement a TypeScript function called chat_muteChat that calls POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/muteChat with Authorization Bearer <YOUR_TOKEN>. Stops getting notifications from a conversation for the given time. Messages keep arriving normally, they just do not notify. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "to": "5511999998888",
  "time": 0
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the chat.muteChat integration in a Node.js service. Stops getting notifications from a conversation for the given time. Messages keep arriving normally, they just do not notify."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/muteChat",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "to": "5511999998888",
        "time": 0
      }
    }
  ]
}
Cursor
In the current project, implement the chat_muteChat client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/muteChat. Stops getting notifications from a conversation for the given time. Messages keep arriving normally, they just do not notify. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "to": "5511999998888",
  "time": 0
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/muteChat. Auth: Bearer <YOUR_TOKEN>. Stops getting notifications from a conversation for the given time. Messages keep arriving normally, they just do not notify. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "to": "5511999998888",
  "time": 0
}
POSTConversasBusinesstestado na API real

Silenciar status de um contato

Para de receber as atualizações de status de um contato, sem bloquear ou remover ninguém. A mesma chamada desfaz a ação.

POSThttps://{seu_host}/rest/chat/{instance_key}/muteStatus

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
tobodystring"5511999998888"opcionalValor enviado no corpo: to.
Número com DDI+DDD e só dígitos (ex.: 5511999998888) ou o ID do grupo terminado em @g.us. Nunca use +, espaço ou traço.
optionbodybooleanfalseopcionalValor enviado no corpo: option.
true silencia os status desse contato; false volta a recebê-los.
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/muteStatus" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "to": "5511999998888",
  "option": false
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/muteStatus', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "to": "5511999998888",
  "option": false
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/muteStatus', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "to": "5511999998888",
  "option": false
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to mute a contact's status. On confirm, the backend must call POST /rest/chat/{instance_key}/muteStatus on megaAPI using the configured instance and the securely stored token. Stops receiving a contact's status updates, without blocking or removing anyone. The same call undoes it. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "to": "5511999998888",
  "option": false
}
Claude Code
Implement a TypeScript function called chat_muteStatus that calls POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/muteStatus with Authorization Bearer <YOUR_TOKEN>. Stops receiving a contact's status updates, without blocking or removing anyone. The same call undoes it. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "to": "5511999998888",
  "option": false
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the chat.muteStatus integration in a Node.js service. Stops receiving a contact's status updates, without blocking or removing anyone. The same call undoes it."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/muteStatus",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "to": "5511999998888",
        "option": false
      }
    }
  ]
}
Cursor
In the current project, implement the chat_muteStatus client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/muteStatus. Stops receiving a contact's status updates, without blocking or removing anyone. The same call undoes it. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "to": "5511999998888",
  "option": false
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/muteStatus. Auth: Bearer <YOUR_TOKEN>. Stops receiving a contact's status updates, without blocking or removing anyone. The same call undoes it. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "to": "5511999998888",
  "option": false
}
POSTConversasBusinesstestado na API real

Fixar ou desafixar conversa

Fixa a conversa no topo da lista, ou a solta. O WhatsApp limita quantas conversas podem ficar fixadas ao mesmo tempo.

POSThttps://{seu_host}/rest/chat/{instance_key}/pinChat

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
tobodystring"5511999998888"opcionalValor enviado no corpo: to.
Número com DDI+DDD e só dígitos (ex.: 5511999998888) ou o ID do grupo terminado em @g.us. Nunca use +, espaço ou traço.
optionbodybooleanfalseopcionalValor enviado no corpo: option.
true fixa a conversa no topo; false desafixa.
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/pinChat" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "to": "5511999998888",
  "option": false
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/pinChat', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "to": "5511999998888",
  "option": false
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/pinChat', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "to": "5511999998888",
  "option": false
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to pin or unpin conversation. On confirm, the backend must call POST /rest/chat/{instance_key}/pinChat on megaAPI using the configured instance and the securely stored token. Pins the conversation to the top of the list, or releases it. WhatsApp limits how many conversations can be pinned at the same time. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "to": "5511999998888",
  "option": false
}
Claude Code
Implement a TypeScript function called chat_pinChat that calls POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/pinChat with Authorization Bearer <YOUR_TOKEN>. Pins the conversation to the top of the list, or releases it. WhatsApp limits how many conversations can be pinned at the same time. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "to": "5511999998888",
  "option": false
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the chat.pinChat integration in a Node.js service. Pins the conversation to the top of the list, or releases it. WhatsApp limits how many conversations can be pinned at the same time."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/pinChat",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "to": "5511999998888",
        "option": false
      }
    }
  ]
}
Cursor
In the current project, implement the chat_pinChat client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/pinChat. Pins the conversation to the top of the list, or releases it. WhatsApp limits how many conversations can be pinned at the same time. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "to": "5511999998888",
  "option": false
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/pinChat. Auth: Bearer <YOUR_TOKEN>. Pins the conversation to the top of the list, or releases it. WhatsApp limits how many conversations can be pinned at the same time. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "to": "5511999998888",
  "option": false
}
POSTConversasBusinesstestado na API real

Fixar ou desafixar mensagem

Destaca uma mensagem específica no topo da conversa, visível para todos os participantes, ou remove esse destaque.

POSThttps://{seu_host}/rest/chat/{instance_key}/pinMessageInChat

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
tobodystring"5511999998888"opcionalValor enviado no corpo: to.
Número com DDI+DDD e só dígitos (ex.: 5511999998888) ou o ID do grupo terminado em @g.us. Nunca use +, espaço ou traço.
optionbodybooleanfalseopcionalValor enviado no corpo: option.
true fixa a mensagem no topo da conversa; false tira o destaque.
messageDatabodyobject
JSON
{
  "key": {},
  "duration": 0
}
opcionalValor enviado no corpo: message data.
O campo `key` identifica a mensagem. Copie exatamente como veio no webhook ou na listagem de mensagens; não dá para montar à mão.
AtributosTipoDescrição
keyobject
durationnumber
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/pinMessageInChat" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "to": "5511999998888",
  "option": false,
  "messageData": {
    "key": {},
    "duration": 0
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/pinMessageInChat', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "to": "5511999998888",
  "option": false,
  "messageData": {
    "key": {},
    "duration": 0
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/pinMessageInChat', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "to": "5511999998888",
  "option": false,
  "messageData": {
    "key": {},
    "duration": 0
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to pin or unpin message. On confirm, the backend must call POST /rest/chat/{instance_key}/pinMessageInChat on megaAPI using the configured instance and the securely stored token. Highlights a specific message at the top of the conversation, visible to all participants, or removes that highlight. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "to": "5511999998888",
  "option": false,
  "messageData": {
    "key": {},
    "duration": 0
  }
}
Claude Code
Implement a TypeScript function called chat_pinMessageInChat that calls POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/pinMessageInChat with Authorization Bearer <YOUR_TOKEN>. Highlights a specific message at the top of the conversation, visible to all participants, or removes that highlight. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "to": "5511999998888",
  "option": false,
  "messageData": {
    "key": {},
    "duration": 0
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the chat.pinMessageInChat integration in a Node.js service. Highlights a specific message at the top of the conversation, visible to all participants, or removes that highlight."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/pinMessageInChat",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "to": "5511999998888",
        "option": false,
        "messageData": {
          "key": {},
          "duration": 0
        }
      }
    }
  ]
}
Cursor
In the current project, implement the chat_pinMessageInChat client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/pinMessageInChat. Highlights a specific message at the top of the conversation, visible to all participants, or removes that highlight. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "to": "5511999998888",
  "option": false,
  "messageData": {
    "key": {},
    "duration": 0
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/pinMessageInChat. Auth: Bearer <YOUR_TOKEN>. Highlights a specific message at the top of the conversation, visible to all participants, or removes that highlight. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "to": "5511999998888",
  "option": false,
  "messageData": {
    "key": {},
    "duration": 0
  }
}
POSTConversasBusinessStartNoCodetestado na API real

Exibir digitando ou gravando

Faz aparecer o aviso "digitando…" ou "gravando áudio…" na conversa da outra pessoa. Serviços automatizados usam isso para que a resposta não chegue de forma instantânea demais.

POSThttps://{seu_host}/rest/chat/{instance_key}/presenceUpdateChat

Disponível em mais de um plano — troque o host conforme a sua instância:

Business: apibusiness1.megaapi.com.brStart: apistart01.megaapi.com.br / apistart02.megaapi.com.br / apistart03.megaapi.com.brNoCode: apinocode01.megaapi.com.br / apinocode02.megaapi.com.br
CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
tobodystring"5511999998888"opcionalValor enviado no corpo: to.
Número com DDI+DDD e só dígitos (ex.: 5511999998888) ou o ID do grupo terminado em @g.us. Nunca use +, espaço ou traço.
optionbodystring"<VALOR>"opcionalValor enviado no corpo: option.
Estado que a outra pessoa vai ver na conversa: digitando, gravando ou disponível, conforme os valores aceitos pelo WhatsApp.
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/presenceUpdateChat" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "to": "5511999998888",
  "option": "<VALOR>"
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/presenceUpdateChat', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "to": "5511999998888",
  "option": "<VALOR>"
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/presenceUpdateChat', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "to": "5511999998888",
  "option": "<VALOR>"
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to show typing or recording. On confirm, the backend must call POST /rest/chat/{instance_key}/presenceUpdateChat on megaAPI using the configured instance and the securely stored token. Makes the "typing…" or "recording audio…" notice appear in the other person's conversation. Automated services use this so the reply does not arrive too instantly. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "to": "5511999998888",
  "option": "<VALOR>"
}
Claude Code
Implement a TypeScript function called chat_presenceUpdateChat that calls POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/presenceUpdateChat with Authorization Bearer <YOUR_TOKEN>. Makes the "typing…" or "recording audio…" notice appear in the other person's conversation. Automated services use this so the reply does not arrive too instantly. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "to": "5511999998888",
  "option": "<VALOR>"
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the chat.presenceUpdateChat integration in a Node.js service. Makes the \"typing…\" or \"recording audio…\" notice appear in the other person's conversation. Automated services use this so the reply does not arrive too instantly."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/presenceUpdateChat",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "to": "5511999998888",
        "option": "<VALOR>"
      }
    }
  ]
}
Cursor
In the current project, implement the chat_presenceUpdateChat client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/presenceUpdateChat. Makes the "typing…" or "recording audio…" notice appear in the other person's conversation. Automated services use this so the reply does not arrive too instantly. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "to": "5511999998888",
  "option": "<VALOR>"
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/presenceUpdateChat. Auth: Bearer <YOUR_TOKEN>. Makes the "typing…" or "recording audio…" notice appear in the other person's conversation. Automated services use this so the reply does not arrive too instantly. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "to": "5511999998888",
  "option": "<VALOR>"
}
POSTConversasBusinesstestado na API real

Marcar conversa como lida ou não lida

Zera o contador de não lidas de uma conversa — ou faz o contrário, marcando-a como não lida para você lembrar de responder depois.

POSThttps://{seu_host}/rest/chat/{instance_key}/readChat

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
tobodystring"5511999998888"opcionalValor enviado no corpo: to.
Número com DDI+DDD e só dígitos (ex.: 5511999998888) ou o ID do grupo terminado em @g.us. Nunca use +, espaço ou traço.
optionbodybooleanfalseopcionalValor enviado no corpo: option.
true marca a conversa como lida; false marca como não lida.
messageDatabodyobject
JSON
{
  "key": {},
  "messageTimestamp": 0
}
opcionalValor enviado no corpo: message data.
AtributosTipoDescrição
keyobject
messageTimestampnumber
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/readChat" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "to": "5511999998888",
  "option": false,
  "messageData": {
    "key": {},
    "messageTimestamp": 0
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/readChat', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "to": "5511999998888",
  "option": false,
  "messageData": {
    "key": {},
    "messageTimestamp": 0
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/readChat', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "to": "5511999998888",
  "option": false,
  "messageData": {
    "key": {},
    "messageTimestamp": 0
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to mark conversation read or unread. On confirm, the backend must call POST /rest/chat/{instance_key}/readChat on megaAPI using the configured instance and the securely stored token. Resets a conversation's unread counter - or does the opposite, marking it unread so you remember to reply later. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "to": "5511999998888",
  "option": false,
  "messageData": {
    "key": {},
    "messageTimestamp": 0
  }
}
Claude Code
Implement a TypeScript function called chat_readChat that calls POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/readChat with Authorization Bearer <YOUR_TOKEN>. Resets a conversation's unread counter - or does the opposite, marking it unread so you remember to reply later. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "to": "5511999998888",
  "option": false,
  "messageData": {
    "key": {},
    "messageTimestamp": 0
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the chat.readChat integration in a Node.js service. Resets a conversation's unread counter - or does the opposite, marking it unread so you remember to reply later."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/readChat",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "to": "5511999998888",
        "option": false,
        "messageData": {
          "key": {},
          "messageTimestamp": 0
        }
      }
    }
  ]
}
Cursor
In the current project, implement the chat_readChat client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/readChat. Resets a conversation's unread counter - or does the opposite, marking it unread so you remember to reply later. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "to": "5511999998888",
  "option": false,
  "messageData": {
    "key": {},
    "messageTimestamp": 0
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/readChat. Auth: Bearer <YOUR_TOKEN>. Resets a conversation's unread counter - or does the opposite, marking it unread so you remember to reply later. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "to": "5511999998888",
  "option": false,
  "messageData": {
    "key": {},
    "messageTimestamp": 0
  }
}
POSTConversasBusinessStarttestado na API real

Marcar mensagem como lida

Marca uma mensagem como lida. Se as confirmações de leitura estiverem ativas, a outra pessoa passa a ver os ticks azuis.

POSThttps://{seu_host}/rest/chat/{instance_key}/readMessage

Disponível em mais de um plano — troque o host conforme a sua instância:

Business: apibusiness1.megaapi.com.brStart: apistart01.megaapi.com.br / apistart02.megaapi.com.br / apistart03.megaapi.com.br
CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "key": {}
}
opcionalValor enviado no corpo: message data.
O campo `key` identifica a mensagem. Copie exatamente como veio no webhook ou na listagem de mensagens; não dá para montar à mão.
AtributosTipoDescrição
keyobject
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/readMessage" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "key": {}
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/readMessage', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "key": {}
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/readMessage', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "key": {}
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to mark message as read. On confirm, the backend must call POST /rest/chat/{instance_key}/readMessage on megaAPI using the configured instance and the securely stored token. Marks a message as read. If read receipts are on, the other person starts seeing the blue ticks. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "key": {}
  }
}
Claude Code
Implement a TypeScript function called chat_readMessage that calls POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/readMessage with Authorization Bearer <YOUR_TOKEN>. Marks a message as read. If read receipts are on, the other person starts seeing the blue ticks. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "key": {}
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the chat.readMessage integration in a Node.js service. Marks a message as read. If read receipts are on, the other person starts seeing the blue ticks."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/readMessage",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "key": {}
        }
      }
    }
  ]
}
Cursor
In the current project, implement the chat_readMessage client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/readMessage. Marks a message as read. If read receipts are on, the other person starts seeing the blue ticks. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "key": {}
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/readMessage. Auth: Bearer <YOUR_TOKEN>. Marks a message as read. If read receipts are on, the other person starts seeing the blue ticks. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "key": {}
  }
}
POSTConversasBusinesstestado na API real

Adicionar estrela à mensagem

Marca uma mensagem com a estrela, para você encontrá-la depois na lista de mensagens com estrela.

POSThttps://{seu_host}/rest/chat/{instance_key}/starMessageChat

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "to": "5511999998888",
  "option": true,
  "key": {}
}
opcionalValor enviado no corpo: message data.
O campo `key` identifica a mensagem. Copie exatamente como veio no webhook ou na listagem de mensagens; não dá para montar à mão.
AtributosTipoDescrição
tostring
optionboolean
keyobject
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/starMessageChat" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "to": "5511999998888",
    "option": true,
    "key": {}
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/starMessageChat', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "option": true,
    "key": {}
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/starMessageChat', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "option": true,
    "key": {}
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to star message. On confirm, the backend must call POST /rest/chat/{instance_key}/starMessageChat on megaAPI using the configured instance and the securely stored token. Marks a message with the star, so you can find it later in the starred messages list. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "to": "5511999998888",
    "option": true,
    "key": {}
  }
}
Claude Code
Implement a TypeScript function called chat_starMessageChat that calls POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/starMessageChat with Authorization Bearer <YOUR_TOKEN>. Marks a message with the star, so you can find it later in the starred messages list. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "to": "5511999998888",
    "option": true,
    "key": {}
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the chat.starMessageChat integration in a Node.js service. Marks a message with the star, so you can find it later in the starred messages list."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/starMessageChat",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "to": "5511999998888",
          "option": true,
          "key": {}
        }
      }
    }
  ]
}
Cursor
In the current project, implement the chat_starMessageChat client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/starMessageChat. Marks a message with the star, so you can find it later in the starred messages list. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "to": "5511999998888",
    "option": true,
    "key": {}
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/chat/<INSTANCE_KEY>/starMessageChat. Auth: Bearer <YOUR_TOKEN>. Marks a message with the star, so you can find it later in the starred messages list. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "to": "5511999998888",
    "option": true,
    "key": {}
  }
}
POSTConfiguração NoCodeNoCodetestado na API real

Alterar todas as configurações

Aplica o conjunto completo de configurações da instância em uma única chamada: token, lista de bloqueio, webhooks aceitos e notificações de mensagens. Como é um pacote fechado, envie tudo que deve valer, não apenas o que mudou.

POSThttps://{seu_host}/rest/config/{instance_key}/allConfigs

Hosts do plano NoCode: apinocode01.megaapi.com.br / apinocode02.megaapi.com.br — sua instância usa um destes, conforme o provisionamento.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "token": "token123456",
  "blockList": [
    "+status@broadcast"
  ],
  "acceptWebhook": [
    ""
  ],
  "acceptSecondaryWebhook": [
    ""
  ],
  "messagesAck": [
    ""
  ]
}
opcionalValor enviado no corpo: message data.
Traz `token`, `blockList`, `acceptWebhook`, `acceptSecondaryWebhook` e `messagesAck` juntos. Preencha todos os campos que devem continuar valendo.
AtributosTipoDescrição
tokenstring
blockListarray
acceptWebhookarray
acceptSecondaryWebhookarray
messagesAckarray
curl
curl -X POST "https://apinocode01.megaapi.com.br/rest/config/<INSTANCE_KEY>/allConfigs" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "token": "token123456",
    "blockList": [
      "+status@broadcast"
    ],
    "acceptWebhook": [
      ""
    ],
    "acceptSecondaryWebhook": [
      ""
    ],
    "messagesAck": [
      ""
    ]
  }
}'
node
const response = await fetch('https://apinocode01.megaapi.com.br/rest/config/<INSTANCE_KEY>/allConfigs', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "token": "token123456",
    "blockList": [
      "+status@broadcast"
    ],
    "acceptWebhook": [
      ""
    ],
    "acceptSecondaryWebhook": [
      ""
    ],
    "messagesAck": [
      ""
    ]
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apinocode01.megaapi.com.br/rest/config/<INSTANCE_KEY>/allConfigs', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "token": "token123456",
    "blockList": [
      "+status@broadcast"
    ],
    "acceptWebhook": [
      ""
    ],
    "acceptSecondaryWebhook": [
      ""
    ],
    "messagesAck": [
      ""
    ]
  }
})
});
console.log(await response.json());
HTTP 200
{
  "error": false,
  "message": "All configs configured",
  "dataMessage": {
    "token": "<CONFIG_TOKEN>",
    "blockList": [
      "status@broadcast"
    ],
    "acceptWebhook": [
      "messagesInput"
    ],
    "acceptSecondaryWebhook": [
      "messagesInput"
    ],
    "messagesAck": []
  }
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to change all settings. On confirm, the backend must call POST /rest/config/{instance_key}/allConfigs on megaAPI using the configured instance and the securely stored token. Applies the full set of instance settings in a single call: token, block list, accepted webhooks, and message notifications. Since it is a closed package, send everything that should apply, not just what changed. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "token": "token123456",
    "blockList": [
      "+status@broadcast"
    ],
    "acceptWebhook": [
      ""
    ],
    "acceptSecondaryWebhook": [
      ""
    ],
    "messagesAck": [
      ""
    ]
  }
}
Claude Code
Implement a TypeScript function called config_allConfigs that calls POST https://apinocode01.megaapi.com.br/rest/config/<INSTANCE_KEY>/allConfigs with Authorization Bearer <YOUR_TOKEN>. Applies the full set of instance settings in a single call: token, block list, accepted webhooks, and message notifications. Since it is a closed package, send everything that should apply, not just what changed. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "token": "token123456",
    "blockList": [
      "+status@broadcast"
    ],
    "acceptWebhook": [
      ""
    ],
    "acceptSecondaryWebhook": [
      ""
    ],
    "messagesAck": [
      ""
    ]
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the config.allConfigs integration in a Node.js service. Applies the full set of instance settings in a single call: token, block list, accepted webhooks, and message notifications. Since it is a closed package, send everything that should apply, not just what changed."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apinocode01.megaapi.com.br/rest/config/<INSTANCE_KEY>/allConfigs",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "token": "token123456",
          "blockList": [
            "+status@broadcast"
          ],
          "acceptWebhook": [
            ""
          ],
          "acceptSecondaryWebhook": [
            ""
          ],
          "messagesAck": [
            ""
          ]
        }
      }
    }
  ]
}
Cursor
In the current project, implement the config_allConfigs client in TypeScript for POST https://apinocode01.megaapi.com.br/rest/config/<INSTANCE_KEY>/allConfigs. Applies the full set of instance settings in a single call: token, block list, accepted webhooks, and message notifications. Since it is a closed package, send everything that should apply, not just what changed. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "token": "token123456",
    "blockList": [
      "+status@broadcast"
    ],
    "acceptWebhook": [
      ""
    ],
    "acceptSecondaryWebhook": [
      ""
    ],
    "messagesAck": [
      ""
    ]
  }
}
Codex
Create a TypeScript function for POST https://apinocode01.megaapi.com.br/rest/config/<INSTANCE_KEY>/allConfigs. Auth: Bearer <YOUR_TOKEN>. Applies the full set of instance settings in a single call: token, block list, accepted webhooks, and message notifications. Since it is a closed package, send everything that should apply, not just what changed. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "token": "token123456",
    "blockList": [
      "+status@broadcast"
    ],
    "acceptWebhook": [
      ""
    ],
    "acceptSecondaryWebhook": [
      ""
    ],
    "messagesAck": [
      ""
    ]
  }
}
POSTConfiguração NoCodeNoCodetestado na API real

Configurar aceitação de webhooks

Controla o envio dos eventos da instância ao webhook configurado. Envie a configuração desejada no corpo; a resposta de "Visualizar configurações da instância" mostra como ficou.

POSThttps://{seu_host}/rest/config/{instance_key}/configAcceptWebhooks

Hosts do plano NoCode: apinocode01.megaapi.com.br / apinocode02.megaapi.com.br — sua instância usa um destes, conforme o provisionamento.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "acceptWebhook": [
    ""
  ],
  "acceptSecondaryWebhook": [
    ""
  ]
}
opcionalValor enviado no corpo: message data.
O campo `acceptWebhook` guarda essa configuração. Confira o resultado em "Ver configurações da instância" depois de alterar.
AtributosTipoDescrição
acceptWebhookarray
acceptSecondaryWebhookarray
curl
curl -X POST "https://apinocode01.megaapi.com.br/rest/config/<INSTANCE_KEY>/configAcceptWebhooks" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "acceptWebhook": [
      ""
    ],
    "acceptSecondaryWebhook": [
      ""
    ]
  }
}'
node
const response = await fetch('https://apinocode01.megaapi.com.br/rest/config/<INSTANCE_KEY>/configAcceptWebhooks', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "acceptWebhook": [
      ""
    ],
    "acceptSecondaryWebhook": [
      ""
    ]
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apinocode01.megaapi.com.br/rest/config/<INSTANCE_KEY>/configAcceptWebhooks', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "acceptWebhook": [
      ""
    ],
    "acceptSecondaryWebhook": [
      ""
    ]
  }
})
});
console.log(await response.json());
HTTP 200
{
  "error": false,
  "message": "AcceptWebhooks configured",
  "dataMessage": {
    "acceptWebhook": [
      "messagesInput"
    ],
    "acceptSecondaryWebhook": [
      "messagesInput"
    ]
  }
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to configure webhook acceptance. On confirm, the backend must call POST /rest/config/{instance_key}/configAcceptWebhooks on megaAPI using the configured instance and the securely stored token. Controls the delivery of instance events to the configured webhook. Send the desired setting in the body; the "View instance settings" response shows how it ended up. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "acceptWebhook": [
      ""
    ],
    "acceptSecondaryWebhook": [
      ""
    ]
  }
}
Claude Code
Implement a TypeScript function called config_configAcceptWebhooks that calls POST https://apinocode01.megaapi.com.br/rest/config/<INSTANCE_KEY>/configAcceptWebhooks with Authorization Bearer <YOUR_TOKEN>. Controls the delivery of instance events to the configured webhook. Send the desired setting in the body; the "View instance settings" response shows how it ended up. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "acceptWebhook": [
      ""
    ],
    "acceptSecondaryWebhook": [
      ""
    ]
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the config.configAcceptWebhooks integration in a Node.js service. Controls the delivery of instance events to the configured webhook. Send the desired setting in the body; the \"View instance settings\" response shows how it ended up."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apinocode01.megaapi.com.br/rest/config/<INSTANCE_KEY>/configAcceptWebhooks",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "acceptWebhook": [
            ""
          ],
          "acceptSecondaryWebhook": [
            ""
          ]
        }
      }
    }
  ]
}
Cursor
In the current project, implement the config_configAcceptWebhooks client in TypeScript for POST https://apinocode01.megaapi.com.br/rest/config/<INSTANCE_KEY>/configAcceptWebhooks. Controls the delivery of instance events to the configured webhook. Send the desired setting in the body; the "View instance settings" response shows how it ended up. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "acceptWebhook": [
      ""
    ],
    "acceptSecondaryWebhook": [
      ""
    ]
  }
}
Codex
Create a TypeScript function for POST https://apinocode01.megaapi.com.br/rest/config/<INSTANCE_KEY>/configAcceptWebhooks. Auth: Bearer <YOUR_TOKEN>. Controls the delivery of instance events to the configured webhook. Send the desired setting in the body; the "View instance settings" response shows how it ended up. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "acceptWebhook": [
      ""
    ],
    "acceptSecondaryWebhook": [
      ""
    ]
  }
}
POSTConfiguração NoCodeNoCodetestado na API real

Configurar lista de bloqueio

Define quais remetentes a instância deve ignorar. É isso que impede sua automação de processar as atualizações de status que chegam pelo WhatsApp, por exemplo.

POSThttps://{seu_host}/rest/config/{instance_key}/configBlockList

Hosts do plano NoCode: apinocode01.megaapi.com.br / apinocode02.megaapi.com.br — sua instância usa um destes, conforme o provisionamento.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "blockList": [
    "+status@broadcast"
  ]
}
opcionalValor enviado no corpo: message data.
`blockList` é a lista de origens ignoradas. O valor "+status@broadcast" descarta as publicações de status.
AtributosTipoDescrição
blockListarray
curl
curl -X POST "https://apinocode01.megaapi.com.br/rest/config/<INSTANCE_KEY>/configBlockList" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "blockList": [
      "+status@broadcast"
    ]
  }
}'
node
const response = await fetch('https://apinocode01.megaapi.com.br/rest/config/<INSTANCE_KEY>/configBlockList', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "blockList": [
      "+status@broadcast"
    ]
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apinocode01.megaapi.com.br/rest/config/<INSTANCE_KEY>/configBlockList', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "blockList": [
      "+status@broadcast"
    ]
  }
})
});
console.log(await response.json());
HTTP 200
{
  "error": false,
  "message": "BlockList configured",
  "dataMessage": {
    "blockList": [
      "status@broadcast"
    ]
  }
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to configure the block list. On confirm, the backend must call POST /rest/config/{instance_key}/configBlockList on megaAPI using the configured instance and the securely stored token. Sets which senders the instance should ignore. This is what prevents your automation from processing the status updates that arrive through WhatsApp, for example. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "blockList": [
      "+status@broadcast"
    ]
  }
}
Claude Code
Implement a TypeScript function called config_configBlockList that calls POST https://apinocode01.megaapi.com.br/rest/config/<INSTANCE_KEY>/configBlockList with Authorization Bearer <YOUR_TOKEN>. Sets which senders the instance should ignore. This is what prevents your automation from processing the status updates that arrive through WhatsApp, for example. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "blockList": [
      "+status@broadcast"
    ]
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the config.configBlockList integration in a Node.js service. Sets which senders the instance should ignore. This is what prevents your automation from processing the status updates that arrive through WhatsApp, for example."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apinocode01.megaapi.com.br/rest/config/<INSTANCE_KEY>/configBlockList",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "blockList": [
            "+status@broadcast"
          ]
        }
      }
    }
  ]
}
Cursor
In the current project, implement the config_configBlockList client in TypeScript for POST https://apinocode01.megaapi.com.br/rest/config/<INSTANCE_KEY>/configBlockList. Sets which senders the instance should ignore. This is what prevents your automation from processing the status updates that arrive through WhatsApp, for example. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "blockList": [
      "+status@broadcast"
    ]
  }
}
Codex
Create a TypeScript function for POST https://apinocode01.megaapi.com.br/rest/config/<INSTANCE_KEY>/configBlockList. Auth: Bearer <YOUR_TOKEN>. Sets which senders the instance should ignore. This is what prevents your automation from processing the status updates that arrive through WhatsApp, for example. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "blockList": [
      "+status@broadcast"
    ]
  }
}
POSTConfiguração NoCodeNoCodetestado na API real

Configurar notificações de entrega e leitura

Define quais confirmações de mensagem — enviada, entregue, lida — a instância notifica ao seu webhook. Ativar todas aumenta bastante o número de chamadas que o seu sistema recebe.

POSThttps://{seu_host}/rest/config/{instance_key}/configMessagesAck

Hosts do plano NoCode: apinocode01.megaapi.com.br / apinocode02.megaapi.com.br — sua instância usa um destes, conforme o provisionamento.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "messagesAck": [
    ""
  ]
}
opcionalValor enviado no corpo: message data.
`messagesAck` é a lista de confirmações que você quer receber. Comece só com o que for usar de fato.
AtributosTipoDescrição
messagesAckarray
curl
curl -X POST "https://apinocode01.megaapi.com.br/rest/config/<INSTANCE_KEY>/configMessagesAck" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "messagesAck": [
      ""
    ]
  }
}'
node
const response = await fetch('https://apinocode01.megaapi.com.br/rest/config/<INSTANCE_KEY>/configMessagesAck', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "messagesAck": [
      ""
    ]
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apinocode01.megaapi.com.br/rest/config/<INSTANCE_KEY>/configMessagesAck', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "messagesAck": [
      ""
    ]
  }
})
});
console.log(await response.json());
HTTP 200
{
  "error": false,
  "message": "MessagesAck configured",
  "dataMessage": {
    "messagesAck": []
  }
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to configure delivery and read notifications. On confirm, the backend must call POST /rest/config/{instance_key}/configMessagesAck on megaAPI using the configured instance and the securely stored token. Sets which message confirmations - sent, delivered, read - the instance notifies to your webhook. Turning all of them on greatly increases the number of calls your system receives. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "messagesAck": [
      ""
    ]
  }
}
Claude Code
Implement a TypeScript function called config_configMessagesAck that calls POST https://apinocode01.megaapi.com.br/rest/config/<INSTANCE_KEY>/configMessagesAck with Authorization Bearer <YOUR_TOKEN>. Sets which message confirmations - sent, delivered, read - the instance notifies to your webhook. Turning all of them on greatly increases the number of calls your system receives. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "messagesAck": [
      ""
    ]
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the config.configMessagesAck integration in a Node.js service. Sets which message confirmations - sent, delivered, read - the instance notifies to your webhook. Turning all of them on greatly increases the number of calls your system receives."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apinocode01.megaapi.com.br/rest/config/<INSTANCE_KEY>/configMessagesAck",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "messagesAck": [
            ""
          ]
        }
      }
    }
  ]
}
Cursor
In the current project, implement the config_configMessagesAck client in TypeScript for POST https://apinocode01.megaapi.com.br/rest/config/<INSTANCE_KEY>/configMessagesAck. Sets which message confirmations - sent, delivered, read - the instance notifies to your webhook. Turning all of them on greatly increases the number of calls your system receives. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "messagesAck": [
      ""
    ]
  }
}
Codex
Create a TypeScript function for POST https://apinocode01.megaapi.com.br/rest/config/<INSTANCE_KEY>/configMessagesAck. Auth: Bearer <YOUR_TOKEN>. Sets which message confirmations - sent, delivered, read - the instance notifies to your webhook. Turning all of them on greatly increases the number of calls your system receives. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "messagesAck": [
      ""
    ]
  }
}
POSTConfiguração NoCodeNoCodetestado na API real

Definir token da instância

Guarda o token usado para autenticar chamadas a esta instância. Como é ele que autoriza cada requisição, qualquer integração que ainda use o valor antigo será rejeitada — atualize seus sistemas junto.

POSThttps://{seu_host}/rest/config/{instance_key}/configToken

Hosts do plano NoCode: apinocode01.megaapi.com.br / apinocode02.megaapi.com.br — sua instância usa um destes, conforme o provisionamento.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "token": "token123456"
}
opcionalValor enviado no corpo: message data.
Em `token` vai o valor que passará a ser exigido no cabeçalho Authorization. Guarde em local seguro: quem tem o token consegue usar a instância.
AtributosTipoDescrição
tokenstring
curl
curl -X POST "https://apinocode01.megaapi.com.br/rest/config/<INSTANCE_KEY>/configToken" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "token": "token123456"
  }
}'
node
const response = await fetch('https://apinocode01.megaapi.com.br/rest/config/<INSTANCE_KEY>/configToken', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "token": "token123456"
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apinocode01.megaapi.com.br/rest/config/<INSTANCE_KEY>/configToken', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "token": "token123456"
  }
})
});
console.log(await response.json());
HTTP 200
{
  "error": false,
  "message": "Token configured",
  "dataMessage": {
    "token": "<CONFIG_TOKEN>"
  }
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to set instance token. On confirm, the backend must call POST /rest/config/{instance_key}/configToken on megaAPI using the configured instance and the securely stored token. Stores the token used to authenticate calls to this instance. Since it is what authorizes every request, any integration still using the old value gets rejected - update your systems along with it. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "token": "token123456"
  }
}
Claude Code
Implement a TypeScript function called config_configToken that calls POST https://apinocode01.megaapi.com.br/rest/config/<INSTANCE_KEY>/configToken with Authorization Bearer <YOUR_TOKEN>. Stores the token used to authenticate calls to this instance. Since it is what authorizes every request, any integration still using the old value gets rejected - update your systems along with it. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "token": "token123456"
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the config.configToken integration in a Node.js service. Stores the token used to authenticate calls to this instance. Since it is what authorizes every request, any integration still using the old value gets rejected - update your systems along with it."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apinocode01.megaapi.com.br/rest/config/<INSTANCE_KEY>/configToken",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "token": "token123456"
        }
      }
    }
  ]
}
Cursor
In the current project, implement the config_configToken client in TypeScript for POST https://apinocode01.megaapi.com.br/rest/config/<INSTANCE_KEY>/configToken. Stores the token used to authenticate calls to this instance. Since it is what authorizes every request, any integration still using the old value gets rejected - update your systems along with it. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "token": "token123456"
  }
}
Codex
Create a TypeScript function for POST https://apinocode01.megaapi.com.br/rest/config/<INSTANCE_KEY>/configToken. Auth: Bearer <YOUR_TOKEN>. Stores the token used to authenticate calls to this instance. Since it is what authorizes every request, any integration still using the old value gets rejected - update your systems along with it. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "token": "token123456"
  }
}
GETConfiguração NoCodeNoCodetestado na API real

Visualizar configurações da instância

Traz todas as configurações atuais da instância em uma única resposta: token, lista de bloqueio, webhooks aceitos e notificações de mensagens. Bom para conferir o que está ativo antes de mudar qualquer coisa.

GEThttps://{seu_host}/rest/config/{instance_key}

Hosts do plano NoCode: apinocode01.megaapi.com.br / apinocode02.megaapi.com.br — sua instância usa um destes, conforme o provisionamento.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
curl
curl -X GET "https://apinocode01.megaapi.com.br/rest/config/<INSTANCE_KEY>" \
  -H "Authorization: Bearer <SEU_TOKEN>"
node
const response = await fetch('https://apinocode01.megaapi.com.br/rest/config/<INSTANCE_KEY>', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' },
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apinocode01.megaapi.com.br/rest/config/<INSTANCE_KEY>', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' }
});
console.log(await response.json());
HTTP 200
{
  "error": false,
  "message": "All configs status fetched",
  "dataMessage": {
    "token": "<CONFIG_TOKEN>",
    "blockList": [
      "status@broadcast"
    ],
    "acceptWebhook": [
      "messagesInput"
    ],
    "acceptSecondaryWebhook": [
      "messagesInput"
    ],
    "messagesAck": []
  }
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to view instance settings. On confirm, the backend must call GET /rest/config/{instance_key} on megaAPI using the configured instance and the securely stored token. Brings all the current instance settings in one response: token, block list, accepted webhooks, and message notifications. Good to check what is on before changing anything. Show loading, success, and error states; do not expose the token in the browser. Example data: no JSON body
Claude Code
Implement a TypeScript function called config_instance_key that calls GET https://apinocode01.megaapi.com.br/rest/config/<INSTANCE_KEY> with Authorization Bearer <YOUR_TOKEN>. Brings all the current instance settings in one response: token, block list, accepted webhooks, and message notifications. Good to check what is on before changing anything. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: no JSON body
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the config.instance_key integration in a Node.js service. Brings all the current instance settings in one response: token, block list, accepted webhooks, and message notifications. Good to check what is on before changing anything."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "GET",
      "url": "GET https://apinocode01.megaapi.com.br/rest/config/<INSTANCE_KEY>",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": null
    }
  ]
}
Cursor
In the current project, implement the config_instance_key client in TypeScript for GET https://apinocode01.megaapi.com.br/rest/config/<INSTANCE_KEY>. Brings all the current instance settings in one response: token, block list, accepted webhooks, and message notifications. Good to check what is on before changing anything. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: no JSON body
Codex
Create a TypeScript function for GET https://apinocode01.megaapi.com.br/rest/config/<INSTANCE_KEY>. Auth: Bearer <YOUR_TOKEN>. Brings all the current instance settings in one response: token, block list, accepted webhooks, and message notifications. Good to check what is on before changing anything. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: no JSON body
POSTGruposBusinessStartNoCodetestado na API real

Adicionar participantes ao grupo

Adiciona um ou mais números ao grupo. Quem configurou a privacidade para evitar ser adicionado por estranhos recebe apenas um convite, em vez de entrar diretamente.

POSThttps://{seu_host}/rest/group/{instance_key}/addParticipants

Disponível em mais de um plano — troque o host conforme a sua instância:

Business: apibusiness1.megaapi.com.brStart: apistart01.megaapi.com.br / apistart02.megaapi.com.br / apistart03.megaapi.com.brNoCode: apinocode01.megaapi.com.br / apinocode02.megaapi.com.br
CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
group_databodyobject
JSON
{
  "jid": "<VALOR>",
  "participants": [
    ""
  ]
}
opcionalValor enviado no corpo: group data.
`jid` é o ID do grupo (terminado em @g.us) e `participants` a lista de números, cada um com DDI+DDD e só dígitos (ex.: ["5511999998888"]).
AtributosTipoDescrição
jidstringID do grupo
participantsarrayLista de contatos que serão adicionados no grupo ( EX: [email protected] )
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/addParticipants" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "group_data": {
    "jid": "<VALOR>",
    "participants": [
      ""
    ]
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/addParticipants', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "group_data": {
    "jid": "<VALOR>",
    "participants": [
      ""
    ]
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/addParticipants', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "group_data": {
    "jid": "<VALOR>",
    "participants": [
      ""
    ]
  }
})
});
console.log(await response.json());
HTTP 200
{
  "error": false,
  "message": "Participants updated",
  "updatedParticipants": [
    {
      "status": "403",
      "jid": "90997556006924@lid"
    }
  ]
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to add participants to group. On confirm, the backend must call POST /rest/group/{instance_key}/addParticipants on megaAPI using the configured instance and the securely stored token. Adds one or more numbers to the group. Whoever set their privacy to avoid being added by strangers gets only an invite instead of joining directly. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "group_data": {
    "jid": "<VALOR>",
    "participants": [
      ""
    ]
  }
}
Claude Code
Implement a TypeScript function called group_addParticipants that calls POST https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/addParticipants with Authorization Bearer <YOUR_TOKEN>. Adds one or more numbers to the group. Whoever set their privacy to avoid being added by strangers gets only an invite instead of joining directly. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "group_data": {
    "jid": "<VALOR>",
    "participants": [
      ""
    ]
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the group.addParticipants integration in a Node.js service. Adds one or more numbers to the group. Whoever set their privacy to avoid being added by strangers gets only an invite instead of joining directly."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/addParticipants",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "group_data": {
          "jid": "<VALOR>",
          "participants": [
            ""
          ]
        }
      }
    }
  ]
}
Cursor
In the current project, implement the group_addParticipants client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/addParticipants. Adds one or more numbers to the group. Whoever set their privacy to avoid being added by strangers gets only an invite instead of joining directly. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "group_data": {
    "jid": "<VALOR>",
    "participants": [
      ""
    ]
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/addParticipants. Auth: Bearer <YOUR_TOKEN>. Adds one or more numbers to the group. Whoever set their privacy to avoid being added by strangers gets only an invite instead of joining directly. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "group_data": {
    "jid": "<VALOR>",
    "participants": [
      ""
    ]
  }
}
GETGruposBusinesstestado na API real

Listar grupos em que você é admin

Retorna apenas os grupos em que o número conectado é administrador — os únicos em que ele pode adicionar ou remover participantes e alterar configurações.

GEThttps://{seu_host}/rest/group/{instance_key}/adminGroups

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
curl
curl -X GET "https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/adminGroups" \
  -H "Authorization: Bearer <SEU_TOKEN>"
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/adminGroups', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' },
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/adminGroups', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' }
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to list groups where you are admin. On confirm, the backend must call GET /rest/group/{instance_key}/adminGroups on megaAPI using the configured instance and the securely stored token. Returns only the groups where the connected number is an administrator - the only ones where it can add or remove participants and change settings. Show loading, success, and error states; do not expose the token in the browser. Example data: no JSON body
Claude Code
Implement a TypeScript function called group_adminGroups that calls GET https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/adminGroups with Authorization Bearer <YOUR_TOKEN>. Returns only the groups where the connected number is an administrator - the only ones where it can add or remove participants and change settings. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: no JSON body
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the group.adminGroups integration in a Node.js service. Returns only the groups where the connected number is an administrator - the only ones where it can add or remove participants and change settings."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "GET",
      "url": "GET https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/adminGroups",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": null
    }
  ]
}
Cursor
In the current project, implement the group_adminGroups client in TypeScript for GET https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/adminGroups. Returns only the groups where the connected number is an administrator - the only ones where it can add or remove participants and change settings. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: no JSON body
Codex
Create a TypeScript function for GET https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/adminGroups. Auth: Bearer <YOUR_TOKEN>. Returns only the groups where the connected number is an administrator - the only ones where it can add or remove participants and change settings. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: no JSON body
GETGruposBusinesstestado na API real

Listar grupos de admin com participantes

A mesma lista de grupos em que você é admin, já com todos os membros de cada grupo. A resposta fica bem maior, então use apenas quando realmente precisar dos participantes.

GEThttps://{seu_host}/rest/group/{instance_key}/adminGroupsWithParticipants

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
curl
curl -X GET "https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/adminGroupsWithParticipants" \
  -H "Authorization: Bearer <SEU_TOKEN>"
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/adminGroupsWithParticipants', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' },
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/adminGroupsWithParticipants', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' }
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to list admin groups with participants. On confirm, the backend must call GET /rest/group/{instance_key}/adminGroupsWithParticipants on megaAPI using the configured instance and the securely stored token. The same list of groups where you are admin, already with every member of each group. The response gets much bigger, so only use it when you really need the participants. Show loading, success, and error states; do not expose the token in the browser. Example data: no JSON body
Claude Code
Implement a TypeScript function called group_adminGroupsWithParticipants that calls GET https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/adminGroupsWithParticipants with Authorization Bearer <YOUR_TOKEN>. The same list of groups where you are admin, already with every member of each group. The response gets much bigger, so only use it when you really need the participants. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: no JSON body
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the group.adminGroupsWithParticipants integration in a Node.js service. The same list of groups where you are admin, already with every member of each group. The response gets much bigger, so only use it when you really need the participants."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "GET",
      "url": "GET https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/adminGroupsWithParticipants",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": null
    }
  ]
}
Cursor
In the current project, implement the group_adminGroupsWithParticipants client in TypeScript for GET https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/adminGroupsWithParticipants. The same list of groups where you are admin, already with every member of each group. The response gets much bigger, so only use it when you really need the participants. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: no JSON body
Codex
Create a TypeScript function for GET https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/adminGroupsWithParticipants. Auth: Bearer <YOUR_TOKEN>. The same list of groups where you are admin, already with every member of each group. The response gets much bigger, so only use it when you really need the participants. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: no JSON body
POSTGruposBusinessStartNoCodetestado na API real

Criar grupo

Cria um novo grupo com o nome e os participantes informados. O número conectado entra como administrador do grupo.

POSThttps://{seu_host}/rest/group/{instance_key}/create

Disponível em mais de um plano — troque o host conforme a sua instância:

Business: apibusiness1.megaapi.com.brStart: apistart01.megaapi.com.br / apistart02.megaapi.com.br / apistart03.megaapi.com.brNoCode: apinocode01.megaapi.com.br / apinocode02.megaapi.com.br
CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
group_databodyobject
JSON
{
  "group_name": "<VALOR>",
  "participants": [
    ""
  ]
}
opcionalValor enviado no corpo: group data.
`group_name` é o nome do grupo e `participants` a lista de números, cada um com DDI+DDD e só dígitos (ex.: ["5511999998888"]).
AtributosTipoDescrição
group_namestringNome do Grupo
participantsarrayLista de contatos que serão adicionados no grupo ( EX: [email protected] )
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/create" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "group_data": {
    "group_name": "<VALOR>",
    "participants": [
      ""
    ]
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/create', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "group_data": {
    "group_name": "<VALOR>",
    "participants": [
      ""
    ]
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/create', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "group_data": {
    "group_name": "<VALOR>",
    "participants": [
      ""
    ]
  }
})
});
console.log(await response.json());
HTTP 200
{
  "error": false,
  "message": "Group created",
  "group": {
    "id": "[email protected]",
    "addressingMode": "lid",
    "subject": "Teste MegaAPI Jarvis",
    "subjectOwner": "113349136269369@lid",
    "subjectTime": 1787754453,
    "size": null,
    "creation": 1787754453,
    "owner": "113349136269369@lid",
    "restrict": false,
    "announce": false,
    "isCommunity": false,
    "isCommunityAnnounce": false,
    "joinApprovalMode": false,
    "participants": [
      {
        "id": "[email protected]",
        "lid": "113349136269369@lid",
        "admin": "superadmin"
      },
      {
        "id": "[email protected]",
        "lid": "90997556006924@lid",
        "admin": null
      }
    ],
    "inviteCode": "Cumw8mCw0NL29pCD915MQ8"
  }
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to create group. On confirm, the backend must call POST /rest/group/{instance_key}/create on megaAPI using the configured instance and the securely stored token. Creates a new group with the given name and participants. The connected number joins as the group's administrator. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "group_data": {
    "group_name": "<VALOR>",
    "participants": [
      ""
    ]
  }
}
Claude Code
Implement a TypeScript function called group_create that calls POST https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/create with Authorization Bearer <YOUR_TOKEN>. Creates a new group with the given name and participants. The connected number joins as the group's administrator. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "group_data": {
    "group_name": "<VALOR>",
    "participants": [
      ""
    ]
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the group.create integration in a Node.js service. Creates a new group with the given name and participants. The connected number joins as the group's administrator."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/create",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "group_data": {
          "group_name": "<VALOR>",
          "participants": [
            ""
          ]
        }
      }
    }
  ]
}
Cursor
In the current project, implement the group_create client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/create. Creates a new group with the given name and participants. The connected number joins as the group's administrator. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "group_data": {
    "group_name": "<VALOR>",
    "participants": [
      ""
    ]
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/create. Auth: Bearer <YOUR_TOKEN>. Creates a new group with the given name and participants. The connected number joins as the group's administrator. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "group_data": {
    "group_name": "<VALOR>",
    "participants": [
      ""
    ]
  }
}
POSTGruposBusinesstestado na API real

Remover privilégio de administrador

Tira o poder de administrador de um participante, que permanece no grupo como membro comum.

POSThttps://{seu_host}/rest/group/{instance_key}/demoteParticipants

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
group_databodyobject
JSON
{
  "jid": "<VALOR>",
  "participants": [
    ""
  ]
}
opcionalValor enviado no corpo: group data.
`jid` é o ID do grupo (terminado em @g.us) e `participants` a lista de números, cada um com DDI+DDD e só dígitos (ex.: ["5511999998888"]).
AtributosTipoDescrição
jidstringID do grupo
participantsarrayLista de contatos que serão rebaixados administradores do grupo ( EX: [email protected] )
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/demoteParticipants" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "group_data": {
    "jid": "<VALOR>",
    "participants": [
      ""
    ]
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/demoteParticipants', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "group_data": {
    "jid": "<VALOR>",
    "participants": [
      ""
    ]
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/demoteParticipants', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "group_data": {
    "jid": "<VALOR>",
    "participants": [
      ""
    ]
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to demote admin. On confirm, the backend must call POST /rest/group/{instance_key}/demoteParticipants on megaAPI using the configured instance and the securely stored token. Takes away the admin power from a participant, who stays in the group as a regular member. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "group_data": {
    "jid": "<VALOR>",
    "participants": [
      ""
    ]
  }
}
Claude Code
Implement a TypeScript function called group_demoteParticipants that calls POST https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/demoteParticipants with Authorization Bearer <YOUR_TOKEN>. Takes away the admin power from a participant, who stays in the group as a regular member. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "group_data": {
    "jid": "<VALOR>",
    "participants": [
      ""
    ]
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the group.demoteParticipants integration in a Node.js service. Takes away the admin power from a participant, who stays in the group as a regular member."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/demoteParticipants",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "group_data": {
          "jid": "<VALOR>",
          "participants": [
            ""
          ]
        }
      }
    }
  ]
}
Cursor
In the current project, implement the group_demoteParticipants client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/demoteParticipants. Takes away the admin power from a participant, who stays in the group as a regular member. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "group_data": {
    "jid": "<VALOR>",
    "participants": [
      ""
    ]
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/demoteParticipants. Auth: Bearer <YOUR_TOKEN>. Takes away the admin power from a participant, who stays in the group as a regular member. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "group_data": {
    "jid": "<VALOR>",
    "participants": [
      ""
    ]
  }
}
GETGruposBusinessStartNoCodetestado na API real

Ver informações do grupo

Traz as informações completas de um grupo: nome, descrição, quem o criou, participantes e configurações.

GEThttps://{seu_host}/rest/group/{instance_key}/group?jid=<VALOR>

Disponível em mais de um plano — troque o host conforme a sua instância:

Business: apibusiness1.megaapi.com.brStart: apistart01.megaapi.com.br / apistart02.megaapi.com.br / apistart03.megaapi.com.brNoCode: apinocode01.megaapi.com.br / apinocode02.megaapi.com.br
CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
jidquerystring"<VALOR>"opcionalFiltro ou opção da consulta: jid.
ID do grupo, aquele texto longo terminado em @g.us. Copie da lista de grupos — não é o número de telefone de ninguém.
curl
curl -X GET "https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/group?jid=<VALOR>" \
  -H "Authorization: Bearer <SEU_TOKEN>"
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/group?jid=<VALOR>', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' },
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/group?jid=<VALOR>', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' }
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to view group info. On confirm, the backend must call GET /rest/group/{instance_key}/group on megaAPI using the configured instance and the securely stored token. Brings the full information of a group: name, description, who created it, participants, and settings. Show loading, success, and error states; do not expose the token in the browser. Example data: no JSON body
Claude Code
Implement a TypeScript function called group_group that calls GET https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/group?jid=<VALOR> with Authorization Bearer <YOUR_TOKEN>. Brings the full information of a group: name, description, who created it, participants, and settings. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: no JSON body
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the group.group integration in a Node.js service. Brings the full information of a group: name, description, who created it, participants, and settings."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "GET",
      "url": "GET https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/group?jid=<VALOR>",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": null
    }
  ]
}
Cursor
In the current project, implement the group_group client in TypeScript for GET https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/group?jid=<VALOR>. Brings the full information of a group: name, description, who created it, participants, and settings. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: no JSON body
Codex
Create a TypeScript function for GET https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/group?jid=<VALOR>. Auth: Bearer <YOUR_TOKEN>. Brings the full information of a group: name, description, who created it, participants, and settings. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: no JSON body
GETGruposBusinesstestado na API real

Entrar em grupo por convite

Faz o número conectado entrar em um grupo usando o código de um link de convite.

GEThttps://{seu_host}/rest/group/{instance_key}/groupAcceptInviteCode?code=<VALOR>

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
codequerystring"<VALOR>"opcionalFiltro ou opção da consulta: code.
Só o código do convite, não o link inteiro: em chat.whatsapp.com/AbC123XyZ, o código é AbC123XyZ.
curl
curl -X GET "https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/groupAcceptInviteCode?code=<VALOR>" \
  -H "Authorization: Bearer <SEU_TOKEN>"
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/groupAcceptInviteCode?code=<VALOR>', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' },
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/groupAcceptInviteCode?code=<VALOR>', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' }
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to join group via invite. On confirm, the backend must call GET /rest/group/{instance_key}/groupAcceptInviteCode on megaAPI using the configured instance and the securely stored token. Makes the connected number join a group using an invite link's code. Show loading, success, and error states; do not expose the token in the browser. Example data: no JSON body
Claude Code
Implement a TypeScript function called group_groupAcceptInviteCode that calls GET https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/groupAcceptInviteCode?code=<VALOR> with Authorization Bearer <YOUR_TOKEN>. Makes the connected number join a group using an invite link's code. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: no JSON body
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the group.groupAcceptInviteCode integration in a Node.js service. Makes the connected number join a group using an invite link's code."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "GET",
      "url": "GET https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/groupAcceptInviteCode?code=<VALOR>",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": null
    }
  ]
}
Cursor
In the current project, implement the group_groupAcceptInviteCode client in TypeScript for GET https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/groupAcceptInviteCode?code=<VALOR>. Makes the connected number join a group using an invite link's code. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: no JSON body
Codex
Create a TypeScript function for GET https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/groupAcceptInviteCode?code=<VALOR>. Auth: Bearer <YOUR_TOKEN>. Makes the connected number join a group using an invite link's code. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: no JSON body
GETGruposBusinesstestado na API real

Obter link de convite do grupo

Retorna o código do link de convite do grupo, aquele compartilhado para que pessoas entrem. Qualquer pessoa com esse link pode entrar, então trate-o como informação sensível.

GEThttps://{seu_host}/rest/group/{instance_key}/groupInviteCode?jid=<VALOR>

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
jidquerystring"<VALOR>"opcionalFiltro ou opção da consulta: jid.
ID do grupo, aquele texto longo terminado em @g.us. Copie da lista de grupos — não é o número de telefone de ninguém.
curl
curl -X GET "https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/groupInviteCode?jid=<VALOR>" \
  -H "Authorization: Bearer <SEU_TOKEN>"
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/groupInviteCode?jid=<VALOR>', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' },
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/groupInviteCode?jid=<VALOR>', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' }
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to get group invite link. On confirm, the backend must call GET /rest/group/{instance_key}/groupInviteCode on megaAPI using the configured instance and the securely stored token. Returns the invite link code of the group, the one shared so people can join. Anyone with that link can get in, so treat it as sensitive information. Show loading, success, and error states; do not expose the token in the browser. Example data: no JSON body
Claude Code
Implement a TypeScript function called group_groupInviteCode that calls GET https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/groupInviteCode?jid=<VALOR> with Authorization Bearer <YOUR_TOKEN>. Returns the invite link code of the group, the one shared so people can join. Anyone with that link can get in, so treat it as sensitive information. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: no JSON body
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the group.groupInviteCode integration in a Node.js service. Returns the invite link code of the group, the one shared so people can join. Anyone with that link can get in, so treat it as sensitive information."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "GET",
      "url": "GET https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/groupInviteCode?jid=<VALOR>",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": null
    }
  ]
}
Cursor
In the current project, implement the group_groupInviteCode client in TypeScript for GET https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/groupInviteCode?jid=<VALOR>. Returns the invite link code of the group, the one shared so people can join. Anyone with that link can get in, so treat it as sensitive information. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: no JSON body
Codex
Create a TypeScript function for GET https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/groupInviteCode?jid=<VALOR>. Auth: Bearer <YOUR_TOKEN>. Returns the invite link code of the group, the one shared so people can join. Anyone with that link can get in, so treat it as sensitive information. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: no JSON body
GETGruposBusinesstestado na API real

Listar solicitações de entrada em grupo

Mostra quem pediu para entrar no grupo e está aguardando aprovação. Só faz sentido em um grupo configurado para exigir aprovação do admin.

GEThttps://{seu_host}/rest/group/{instance_key}/groupRequestParticipantsList?to=5511999998888

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
toquerystring"5511999998888"opcionalFiltro ou opção da consulta: to.
ID do grupo, aquele texto longo terminado em @g.us. Copie da lista de grupos — não é o número de telefone de ninguém.
curl
curl -X GET "https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/groupRequestParticipantsList?to=5511999998888" \
  -H "Authorization: Bearer <SEU_TOKEN>"
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/groupRequestParticipantsList?to=5511999998888', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' },
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/groupRequestParticipantsList?to=5511999998888', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' }
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to list group join requests. On confirm, the backend must call GET /rest/group/{instance_key}/groupRequestParticipantsList on megaAPI using the configured instance and the securely stored token. Shows who asked to join the group and is waiting for approval. Only makes sense on a group set to require admin approval. Show loading, success, and error states; do not expose the token in the browser. Example data: no JSON body
Claude Code
Implement a TypeScript function called group_groupRequestParticipantsList that calls GET https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/groupRequestParticipantsList?to=5511999998888 with Authorization Bearer <YOUR_TOKEN>. Shows who asked to join the group and is waiting for approval. Only makes sense on a group set to require admin approval. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: no JSON body
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the group.groupRequestParticipantsList integration in a Node.js service. Shows who asked to join the group and is waiting for approval. Only makes sense on a group set to require admin approval."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "GET",
      "url": "GET https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/groupRequestParticipantsList?to=5511999998888",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": null
    }
  ]
}
Cursor
In the current project, implement the group_groupRequestParticipantsList client in TypeScript for GET https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/groupRequestParticipantsList?to=5511999998888. Shows who asked to join the group and is waiting for approval. Only makes sense on a group set to require admin approval. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: no JSON body
Codex
Create a TypeScript function for GET https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/groupRequestParticipantsList?to=5511999998888. Auth: Bearer <YOUR_TOKEN>. Shows who asked to join the group and is waiting for approval. Only makes sense on a group set to require admin approval. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: no JSON body
POSTGruposBusinesstestado na API real

Aprovar ou rejeitar solicitações de entrada

Responde às solicitações de entrada na fila, aprovando ou rejeitando. Quem é rejeitado não entra e precisa pedir novamente.

POSThttps://{seu_host}/rest/group/{instance_key}/groupRequestParticipantsUpdate

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "to": "5511999998888",
  "participants": [
    ""
  ],
  "action": "approve"
}
opcionalValor enviado no corpo: message data.
Indique o grupo, os números que estão na fila e se cada pedido deve ser aprovado ou recusado.
AtributosTipoDescrição
tostring
participantsarray
actionstring
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/groupRequestParticipantsUpdate" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "to": "5511999998888",
    "participants": [
      ""
    ],
    "action": "approve"
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/groupRequestParticipantsUpdate', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "participants": [
      ""
    ],
    "action": "approve"
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/groupRequestParticipantsUpdate', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "participants": [
      ""
    ],
    "action": "approve"
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to approve or reject join requests. On confirm, the backend must call POST /rest/group/{instance_key}/groupRequestParticipantsUpdate on megaAPI using the configured instance and the securely stored token. Answers the join requests in the queue, approving or rejecting. Someone rejected is not let in and has to ask again. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "to": "5511999998888",
    "participants": [
      ""
    ],
    "action": "approve"
  }
}
Claude Code
Implement a TypeScript function called group_groupRequestParticipantsUpdate that calls POST https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/groupRequestParticipantsUpdate with Authorization Bearer <YOUR_TOKEN>. Answers the join requests in the queue, approving or rejecting. Someone rejected is not let in and has to ask again. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "to": "5511999998888",
    "participants": [
      ""
    ],
    "action": "approve"
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the group.groupRequestParticipantsUpdate integration in a Node.js service. Answers the join requests in the queue, approving or rejecting. Someone rejected is not let in and has to ask again."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/groupRequestParticipantsUpdate",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "to": "5511999998888",
          "participants": [
            ""
          ],
          "action": "approve"
        }
      }
    }
  ]
}
Cursor
In the current project, implement the group_groupRequestParticipantsUpdate client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/groupRequestParticipantsUpdate. Answers the join requests in the queue, approving or rejecting. Someone rejected is not let in and has to ask again. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "to": "5511999998888",
    "participants": [
      ""
    ],
    "action": "approve"
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/groupRequestParticipantsUpdate. Auth: Bearer <YOUR_TOKEN>. Answers the join requests in the queue, approving or rejecting. Someone rejected is not let in and has to ask again. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "to": "5511999998888",
    "participants": [
      ""
    ],
    "action": "approve"
  }
}
GETGruposBusinesstestado na API real

Revogar link de convite

Invalida o link de convite atual e gera outro no lugar. O link antigo para de funcionar imediatamente, para sempre: quem o tiver salvo não consegue mais entrar. Não há como voltar atrás nem recuperar o código anterior.

GEThttps://{seu_host}/rest/group/{instance_key}/groupRevokeInviteCode?jid=<VALOR>

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
jidquerystring"<VALOR>"opcionalFiltro ou opção da consulta: jid.
ID do grupo, aquele texto longo terminado em @g.us. Copie da lista de grupos — não é o número de telefone de ninguém.
curl
curl -X GET "https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/groupRevokeInviteCode?jid=<VALOR>" \
  -H "Authorization: Bearer <SEU_TOKEN>"
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/groupRevokeInviteCode?jid=<VALOR>', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' },
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/groupRevokeInviteCode?jid=<VALOR>', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' }
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to revoke invite link. On confirm, the backend must call GET /rest/group/{instance_key}/groupRevokeInviteCode on megaAPI using the configured instance and the securely stored token. Invalidates the current invite link and generates another in its place. The old link stops working right away, forever: whoever had it saved can no longer get in. There is no going back nor recovering the previous code. Show loading, success, and error states; do not expose the token in the browser. Example data: no JSON body
Claude Code
Implement a TypeScript function called group_groupRevokeInviteCode that calls GET https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/groupRevokeInviteCode?jid=<VALOR> with Authorization Bearer <YOUR_TOKEN>. Invalidates the current invite link and generates another in its place. The old link stops working right away, forever: whoever had it saved can no longer get in. There is no going back nor recovering the previous code. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: no JSON body
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the group.groupRevokeInviteCode integration in a Node.js service. Invalidates the current invite link and generates another in its place. The old link stops working right away, forever: whoever had it saved can no longer get in. There is no going back nor recovering the previous code."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "GET",
      "url": "GET https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/groupRevokeInviteCode?jid=<VALOR>",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": null
    }
  ]
}
Cursor
In the current project, implement the group_groupRevokeInviteCode client in TypeScript for GET https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/groupRevokeInviteCode?jid=<VALOR>. Invalidates the current invite link and generates another in its place. The old link stops working right away, forever: whoever had it saved can no longer get in. There is no going back nor recovering the previous code. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: no JSON body
Codex
Create a TypeScript function for GET https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/groupRevokeInviteCode?jid=<VALOR>. Auth: Bearer <YOUR_TOKEN>. Invalidates the current invite link and generates another in its place. The old link stops working right away, forever: whoever had it saved can no longer get in. There is no going back nor recovering the previous code. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: no JSON body
GETGruposBusinessStartNoCodetestado na API real

Listar grupos e comunidades

Lista todos os grupos e comunidades dos quais o número conectado participa. É daqui que vem o ID de grupo exigido pelos outros endpoints.

GEThttps://{seu_host}/rest/group/list/{instance_key}

Disponível em mais de um plano — troque o host conforme a sua instância:

Business: apibusiness1.megaapi.com.brStart: apistart01.megaapi.com.br / apistart02.megaapi.com.br / apistart03.megaapi.com.brNoCode: apinocode01.megaapi.com.br / apinocode02.megaapi.com.br
CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
curl
curl -X GET "https://apibusiness1.megaapi.com.br/rest/group/list/<INSTANCE_KEY>" \
  -H "Authorization: Bearer <SEU_TOKEN>"
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/group/list/<INSTANCE_KEY>', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' },
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/group/list/<INSTANCE_KEY>', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' }
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to list groups and communities. On confirm, the backend must call GET /rest/group/list/{instance_key} on megaAPI using the configured instance and the securely stored token. Lists every group and community the connected number is part of. This is where the group ID required by other endpoints comes from. Show loading, success, and error states; do not expose the token in the browser. Example data: no JSON body
Claude Code
Implement a TypeScript function called group_instance_key that calls GET https://apibusiness1.megaapi.com.br/rest/group/list/<INSTANCE_KEY> with Authorization Bearer <YOUR_TOKEN>. Lists every group and community the connected number is part of. This is where the group ID required by other endpoints comes from. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: no JSON body
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the group.instance_key integration in a Node.js service. Lists every group and community the connected number is part of. This is where the group ID required by other endpoints comes from."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "GET",
      "url": "GET https://apibusiness1.megaapi.com.br/rest/group/list/<INSTANCE_KEY>",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": null
    }
  ]
}
Cursor
In the current project, implement the group_instance_key client in TypeScript for GET https://apibusiness1.megaapi.com.br/rest/group/list/<INSTANCE_KEY>. Lists every group and community the connected number is part of. This is where the group ID required by other endpoints comes from. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: no JSON body
Codex
Create a TypeScript function for GET https://apibusiness1.megaapi.com.br/rest/group/list/<INSTANCE_KEY>. Auth: Bearer <YOUR_TOKEN>. Lists every group and community the connected number is part of. This is where the group ID required by other endpoints comes from. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: no JSON body
GETGruposBusinessStartNoCodetestado na API real

Ver informações do convite

A partir do código de um link de convite, mostra a qual grupo ele pertence antes de você entrar. Útil para conferir o grupo sem se comprometer.

GEThttps://{seu_host}/rest/group/{instance_key}/inviteInfo?code=<VALOR>

Disponível em mais de um plano — troque o host conforme a sua instância:

Business: apibusiness1.megaapi.com.brStart: apistart01.megaapi.com.br / apistart02.megaapi.com.br / apistart03.megaapi.com.brNoCode: apinocode01.megaapi.com.br / apinocode02.megaapi.com.br
CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
codequerystring"<VALOR>"opcionalFiltro ou opção da consulta: code.
Só o código do convite, não o link inteiro: em chat.whatsapp.com/AbC123XyZ, o código é AbC123XyZ.
curl
curl -X GET "https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/inviteInfo?code=<VALOR>" \
  -H "Authorization: Bearer <SEU_TOKEN>"
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/inviteInfo?code=<VALOR>', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' },
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/inviteInfo?code=<VALOR>', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' }
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to view invite info. On confirm, the backend must call GET /rest/group/{instance_key}/inviteInfo on megaAPI using the configured instance and the securely stored token. From an invite link's code, shows which group it belongs to before you join. Handy to check the group without committing. Show loading, success, and error states; do not expose the token in the browser. Example data: no JSON body
Claude Code
Implement a TypeScript function called group_inviteInfo that calls GET https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/inviteInfo?code=<VALOR> with Authorization Bearer <YOUR_TOKEN>. From an invite link's code, shows which group it belongs to before you join. Handy to check the group without committing. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: no JSON body
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the group.inviteInfo integration in a Node.js service. From an invite link's code, shows which group it belongs to before you join. Handy to check the group without committing."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "GET",
      "url": "GET https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/inviteInfo?code=<VALOR>",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": null
    }
  ]
}
Cursor
In the current project, implement the group_inviteInfo client in TypeScript for GET https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/inviteInfo?code=<VALOR>. From an invite link's code, shows which group it belongs to before you join. Handy to check the group without committing. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: no JSON body
Codex
Create a TypeScript function for GET https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/inviteInfo?code=<VALOR>. Auth: Bearer <YOUR_TOKEN>. From an invite link's code, shows which group it belongs to before you join. Handy to check the group without committing. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: no JSON body
DELETEGruposBusinessStartNoCodetestado na API real

Sair do grupo

Faz o número conectado sair do grupo. Sem desfazer aqui: para voltar, alguém precisa adicioná-lo novamente ou é necessário um link de convite válido.

DELETEhttps://{seu_host}/rest/group/{instance_key}/leaveGroup?jid=<VALOR>

Disponível em mais de um plano — troque o host conforme a sua instância:

Business: apibusiness1.megaapi.com.brStart: apistart01.megaapi.com.br / apistart02.megaapi.com.br / apistart03.megaapi.com.brNoCode: apinocode01.megaapi.com.br / apinocode02.megaapi.com.br
CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
jidquerystring"<VALOR>"opcionalFiltro ou opção da consulta: jid.
ID do grupo, aquele texto longo terminado em @g.us. Copie da lista de grupos — não é o número de telefone de ninguém.
curl
curl -X DELETE "https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/leaveGroup?jid=<VALOR>" \
  -H "Authorization: Bearer <SEU_TOKEN>"
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/leaveGroup?jid=<VALOR>', {
  method: 'DELETE',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' },
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/leaveGroup?jid=<VALOR>', {
  method: 'DELETE',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' }
});
console.log(await response.json());
HTTP 200
{
  "error": false,
  "message": "Left group"
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to leave group. On confirm, the backend must call DELETE /rest/group/{instance_key}/leaveGroup on megaAPI using the configured instance and the securely stored token. Makes the connected number leave the group. No undo here: to come back, someone has to add it again or you need a valid invite link. Show loading, success, and error states; do not expose the token in the browser. Example data: no JSON body
Claude Code
Implement a TypeScript function called group_leaveGroup that calls DELETE https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/leaveGroup?jid=<VALOR> with Authorization Bearer <YOUR_TOKEN>. Makes the connected number leave the group. No undo here: to come back, someone has to add it again or you need a valid invite link. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: no JSON body
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the group.leaveGroup integration in a Node.js service. Makes the connected number leave the group. No undo here: to come back, someone has to add it again or you need a valid invite link."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "DELETE",
      "url": "DELETE https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/leaveGroup?jid=<VALOR>",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": null
    }
  ]
}
Cursor
In the current project, implement the group_leaveGroup client in TypeScript for DELETE https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/leaveGroup?jid=<VALOR>. Makes the connected number leave the group. No undo here: to come back, someone has to add it again or you need a valid invite link. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: no JSON body
Codex
Create a TypeScript function for DELETE https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/leaveGroup?jid=<VALOR>. Auth: Bearer <YOUR_TOKEN>. Makes the connected number leave the group. No undo here: to come back, someone has to add it again or you need a valid invite link. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: no JSON body
POSTGruposBusinesstestado na API real

Promover a administrador

Dá poder de administrador a um participante: ele passa a poder adicionar e remover pessoas e alterar as configurações do grupo.

POSThttps://{seu_host}/rest/group/{instance_key}/promoteParticipants

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
group_databodyobject
JSON
{
  "jid": "<VALOR>",
  "participants": [
    ""
  ]
}
opcionalValor enviado no corpo: group data.
`jid` é o ID do grupo (terminado em @g.us) e `participants` a lista de números, cada um com DDI+DDD e só dígitos (ex.: ["5511999998888"]).
AtributosTipoDescrição
jidstringID do grupo
participantsarrayLista de contatos que serão promovidos á administradores do grupo ( EX: [email protected] )
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/promoteParticipants" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "group_data": {
    "jid": "<VALOR>",
    "participants": [
      ""
    ]
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/promoteParticipants', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "group_data": {
    "jid": "<VALOR>",
    "participants": [
      ""
    ]
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/promoteParticipants', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "group_data": {
    "jid": "<VALOR>",
    "participants": [
      ""
    ]
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to promote to admin. On confirm, the backend must call POST /rest/group/{instance_key}/promoteParticipants on megaAPI using the configured instance and the securely stored token. Gives admin power to a participant: they can now add and remove people and change the group settings. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "group_data": {
    "jid": "<VALOR>",
    "participants": [
      ""
    ]
  }
}
Claude Code
Implement a TypeScript function called group_promoteParticipants that calls POST https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/promoteParticipants with Authorization Bearer <YOUR_TOKEN>. Gives admin power to a participant: they can now add and remove people and change the group settings. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "group_data": {
    "jid": "<VALOR>",
    "participants": [
      ""
    ]
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the group.promoteParticipants integration in a Node.js service. Gives admin power to a participant: they can now add and remove people and change the group settings."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/promoteParticipants",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "group_data": {
          "jid": "<VALOR>",
          "participants": [
            ""
          ]
        }
      }
    }
  ]
}
Cursor
In the current project, implement the group_promoteParticipants client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/promoteParticipants. Gives admin power to a participant: they can now add and remove people and change the group settings. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "group_data": {
    "jid": "<VALOR>",
    "participants": [
      ""
    ]
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/promoteParticipants. Auth: Bearer <YOUR_TOKEN>. Gives admin power to a participant: they can now add and remove people and change the group settings. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "group_data": {
    "jid": "<VALOR>",
    "participants": [
      ""
    ]
  }
}
POSTGruposBusinessStartNoCodetestado na API real

Remover participantes do grupo

Remove um ou mais participantes do grupo. A pessoa sai imediatamente e só volta se for adicionada novamente ou entrar por convite — a remoção em si não pode ser desfeita.

POSThttps://{seu_host}/rest/group/{instance_key}/removeParticipants

Disponível em mais de um plano — troque o host conforme a sua instância:

Business: apibusiness1.megaapi.com.brStart: apistart01.megaapi.com.br / apistart02.megaapi.com.br / apistart03.megaapi.com.brNoCode: apinocode01.megaapi.com.br / apinocode02.megaapi.com.br
CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
group_databodyobject
JSON
{
  "jid": "<VALOR>",
  "participants": [
    ""
  ]
}
opcionalValor enviado no corpo: group data.
`jid` é o ID do grupo (terminado em @g.us) e `participants` a lista de números, cada um com DDI+DDD e só dígitos (ex.: ["5511999998888"]).
AtributosTipoDescrição
jidstringID do grupo
participantsarrayLista de contatos que serão removidos do grupo ( EX: [email protected] )
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/removeParticipants" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "group_data": {
    "jid": "<VALOR>",
    "participants": [
      ""
    ]
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/removeParticipants', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "group_data": {
    "jid": "<VALOR>",
    "participants": [
      ""
    ]
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/removeParticipants', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "group_data": {
    "jid": "<VALOR>",
    "participants": [
      ""
    ]
  }
})
});
console.log(await response.json());
HTTP 200
{
  "error": false,
  "message": "Participants updated",
  "updatedParticipants": [
    {
      "status": "404",
      "jid": "90997556006924@lid"
    }
  ]
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to remove participants from group. On confirm, the backend must call POST /rest/group/{instance_key}/removeParticipants on megaAPI using the configured instance and the securely stored token. Removes one or more participants from the group. The person leaves right away and only comes back if added again or joining via invite - the removal itself cannot be undone. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "group_data": {
    "jid": "<VALOR>",
    "participants": [
      ""
    ]
  }
}
Claude Code
Implement a TypeScript function called group_removeParticipants that calls POST https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/removeParticipants with Authorization Bearer <YOUR_TOKEN>. Removes one or more participants from the group. The person leaves right away and only comes back if added again or joining via invite - the removal itself cannot be undone. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "group_data": {
    "jid": "<VALOR>",
    "participants": [
      ""
    ]
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the group.removeParticipants integration in a Node.js service. Removes one or more participants from the group. The person leaves right away and only comes back if added again or joining via invite - the removal itself cannot be undone."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/removeParticipants",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "group_data": {
          "jid": "<VALOR>",
          "participants": [
            ""
          ]
        }
      }
    }
  ]
}
Cursor
In the current project, implement the group_removeParticipants client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/removeParticipants. Removes one or more participants from the group. The person leaves right away and only comes back if added again or joining via invite - the removal itself cannot be undone. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "group_data": {
    "jid": "<VALOR>",
    "participants": [
      ""
    ]
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/removeParticipants. Auth: Bearer <YOUR_TOKEN>. Removes one or more participants from the group. The person leaves right away and only comes back if added again or joining via invite - the removal itself cannot be undone. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "group_data": {
    "jid": "<VALOR>",
    "participants": [
      ""
    ]
  }
}
POSTGruposBusinesstestado na API real

Enviar convite de grupo por mensagem

Envia o link de convite do grupo diretamente para um contato, como mensagem do WhatsApp.

POSThttps://{seu_host}/rest/group/{instance_key}/sendLinkInviteGroup

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "to": "5511999998888",
  "textWithLink": "<VALOR>"
}
opcionalValor enviado no corpo: message data.
Informe o grupo do convite e o número que vai recebê-lo, com DDI+DDD e só dígitos.
AtributosTipoDescrição
tostring
textWithLinkstring
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/sendLinkInviteGroup" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "to": "5511999998888",
    "textWithLink": "<VALOR>"
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/sendLinkInviteGroup', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "textWithLink": "<VALOR>"
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/sendLinkInviteGroup', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "textWithLink": "<VALOR>"
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to send group invite by message. On confirm, the backend must call POST /rest/group/{instance_key}/sendLinkInviteGroup on megaAPI using the configured instance and the securely stored token. Sends the group invite link straight to a contact, as a WhatsApp message. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "to": "5511999998888",
    "textWithLink": "<VALOR>"
  }
}
Claude Code
Implement a TypeScript function called group_sendLinkInviteGroup that calls POST https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/sendLinkInviteGroup with Authorization Bearer <YOUR_TOKEN>. Sends the group invite link straight to a contact, as a WhatsApp message. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "to": "5511999998888",
    "textWithLink": "<VALOR>"
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the group.sendLinkInviteGroup integration in a Node.js service. Sends the group invite link straight to a contact, as a WhatsApp message."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/sendLinkInviteGroup",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "to": "5511999998888",
          "textWithLink": "<VALOR>"
        }
      }
    }
  ]
}
Cursor
In the current project, implement the group_sendLinkInviteGroup client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/sendLinkInviteGroup. Sends the group invite link straight to a contact, as a WhatsApp message. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "to": "5511999998888",
    "textWithLink": "<VALOR>"
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/sendLinkInviteGroup. Auth: Bearer <YOUR_TOKEN>. Sends the group invite link straight to a contact, as a WhatsApp message. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "to": "5511999998888",
    "textWithLink": "<VALOR>"
  }
}
PUTGruposBusinesstestado na API real

Definir quem pode editar o grupo

Escolhe se qualquer participante pode alterar o nome, a foto e a descrição do grupo, ou se isso continua restrito aos administradores.

PUThttps://{seu_host}/rest/group/{instance_key}/setWhoCanChangeSettings?jid=<VALOR>&allowOnlyAdmins=false

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
jidquerystring"<VALOR>"opcionalFiltro ou opção da consulta: jid.
ID do grupo, aquele texto longo terminado em @g.us. Copie da lista de grupos — não é o número de telefone de ninguém.
allowOnlyAdminsquerybooleanfalseopcionalFiltro ou opção da consulta: allow only admins.
true restringe as alterações aos administradores; false libera para todos os participantes.
curl
curl -X PUT "https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/setWhoCanChangeSettings?jid=<VALOR>&allowOnlyAdmins=false" \
  -H "Authorization: Bearer <SEU_TOKEN>"
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/setWhoCanChangeSettings?jid=<VALOR>&allowOnlyAdmins=false', {
  method: 'PUT',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' },
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/setWhoCanChangeSettings?jid=<VALOR>&allowOnlyAdmins=false', {
  method: 'PUT',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' }
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to set who can edit the group. On confirm, the backend must call PUT /rest/group/{instance_key}/setWhoCanChangeSettings on megaAPI using the configured instance and the securely stored token. Chooses whether any participant can change the group's name, photo, and description, or whether that stays restricted to the admins. Show loading, success, and error states; do not expose the token in the browser. Example data: no JSON body
Claude Code
Implement a TypeScript function called group_setWhoCanChangeSettings that calls PUT https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/setWhoCanChangeSettings?jid=<VALOR>&allowOnlyAdmins=false with Authorization Bearer <YOUR_TOKEN>. Chooses whether any participant can change the group's name, photo, and description, or whether that stays restricted to the admins. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: no JSON body
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the group.setWhoCanChangeSettings integration in a Node.js service. Chooses whether any participant can change the group's name, photo, and description, or whether that stays restricted to the admins."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "PUT",
      "url": "PUT https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/setWhoCanChangeSettings?jid=<VALOR>&allowOnlyAdmins=false",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": null
    }
  ]
}
Cursor
In the current project, implement the group_setWhoCanChangeSettings client in TypeScript for PUT https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/setWhoCanChangeSettings?jid=<VALOR>&allowOnlyAdmins=false. Chooses whether any participant can change the group's name, photo, and description, or whether that stays restricted to the admins. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: no JSON body
Codex
Create a TypeScript function for PUT https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/setWhoCanChangeSettings?jid=<VALOR>&allowOnlyAdmins=false. Auth: Bearer <YOUR_TOKEN>. Chooses whether any participant can change the group's name, photo, and description, or whether that stays restricted to the admins. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: no JSON body
PUTGruposBusinesstestado na API real

Definir quem pode enviar mensagens

Abre o grupo para todos conversarem ou o fecha para apenas administradores. Quando fechado, os demais participantes só podem ler.

PUThttps://{seu_host}/rest/group/{instance_key}/setWhoCanSendMessage?jid=<VALOR>&allowOnlyAdmins=false

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
jidquerystring"<VALOR>"opcionalFiltro ou opção da consulta: jid.
ID do grupo, aquele texto longo terminado em @g.us. Copie da lista de grupos — não é o número de telefone de ninguém.
allowOnlyAdminsquerybooleanfalseopcionalFiltro ou opção da consulta: allow only admins.
true deixa só os administradores enviarem mensagens; false libera para todos os participantes.
curl
curl -X PUT "https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/setWhoCanSendMessage?jid=<VALOR>&allowOnlyAdmins=false" \
  -H "Authorization: Bearer <SEU_TOKEN>"
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/setWhoCanSendMessage?jid=<VALOR>&allowOnlyAdmins=false', {
  method: 'PUT',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' },
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/setWhoCanSendMessage?jid=<VALOR>&allowOnlyAdmins=false', {
  method: 'PUT',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' }
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to set who can send messages. On confirm, the backend must call PUT /rest/group/{instance_key}/setWhoCanSendMessage on megaAPI using the configured instance and the securely stored token. Makes the group open for everyone to talk or closes it to admins only. When closed, the other participants can only read. Show loading, success, and error states; do not expose the token in the browser. Example data: no JSON body
Claude Code
Implement a TypeScript function called group_setWhoCanSendMessage that calls PUT https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/setWhoCanSendMessage?jid=<VALOR>&allowOnlyAdmins=false with Authorization Bearer <YOUR_TOKEN>. Makes the group open for everyone to talk or closes it to admins only. When closed, the other participants can only read. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: no JSON body
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the group.setWhoCanSendMessage integration in a Node.js service. Makes the group open for everyone to talk or closes it to admins only. When closed, the other participants can only read."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "PUT",
      "url": "PUT https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/setWhoCanSendMessage?jid=<VALOR>&allowOnlyAdmins=false",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": null
    }
  ]
}
Cursor
In the current project, implement the group_setWhoCanSendMessage client in TypeScript for PUT https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/setWhoCanSendMessage?jid=<VALOR>&allowOnlyAdmins=false. Makes the group open for everyone to talk or closes it to admins only. When closed, the other participants can only read. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: no JSON body
Codex
Create a TypeScript function for PUT https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/setWhoCanSendMessage?jid=<VALOR>&allowOnlyAdmins=false. Auth: Bearer <YOUR_TOKEN>. Makes the group open for everyone to talk or closes it to admins only. When closed, the other participants can only read. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: no JSON body
POSTGruposBusinesstestado na API real

Alterar descrição do grupo

Altera o texto da descrição do grupo, aquele exibido nas informações do grupo. A descrição anterior é substituída.

POSThttps://{seu_host}/rest/group/{instance_key}/updateGroupDescription

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "jid": "<VALOR>",
  "description": "<VALOR>"
}
opcionalValor enviado no corpo: message data.
Informe o ID do grupo (terminado em @g.us) e o novo texto de descrição.
AtributosTipoDescrição
jidstring
descriptionstring
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/updateGroupDescription" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "jid": "<VALOR>",
    "description": "<VALOR>"
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/updateGroupDescription', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "jid": "<VALOR>",
    "description": "<VALOR>"
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/updateGroupDescription', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "jid": "<VALOR>",
    "description": "<VALOR>"
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to change group description. On confirm, the backend must call POST /rest/group/{instance_key}/updateGroupDescription on megaAPI using the configured instance and the securely stored token. Changes the group's description text, the one shown in group info. The previous description is replaced. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "jid": "<VALOR>",
    "description": "<VALOR>"
  }
}
Claude Code
Implement a TypeScript function called group_updateGroupDescription that calls POST https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/updateGroupDescription with Authorization Bearer <YOUR_TOKEN>. Changes the group's description text, the one shown in group info. The previous description is replaced. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "jid": "<VALOR>",
    "description": "<VALOR>"
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the group.updateGroupDescription integration in a Node.js service. Changes the group's description text, the one shown in group info. The previous description is replaced."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/updateGroupDescription",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "jid": "<VALOR>",
          "description": "<VALOR>"
        }
      }
    }
  ]
}
Cursor
In the current project, implement the group_updateGroupDescription client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/updateGroupDescription. Changes the group's description text, the one shown in group info. The previous description is replaced. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "jid": "<VALOR>",
    "description": "<VALOR>"
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/updateGroupDescription. Auth: Bearer <YOUR_TOKEN>. Changes the group's description text, the one shown in group info. The previous description is replaced. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "jid": "<VALOR>",
    "description": "<VALOR>"
  }
}
POSTGruposBusinesstestado na API real

Alterar foto do grupo por arquivo

Troca a imagem do grupo enviando o arquivo da foto. A imagem anterior é substituída e não é mantida.

POSThttps://{seu_host}/rest/group/{instance_key}/updateGroupPicture?to=5511999998888

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
toquerystring"5511999998888"opcionalFiltro ou opção da consulta: to.
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/updateGroupPicture?to=5511999998888" \
  -H "Authorization: Bearer <SEU_TOKEN>"
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/updateGroupPicture?to=5511999998888', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' },
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/updateGroupPicture?to=5511999998888', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' }
});
console.log(await response.json());
HTTP 400
{
  "name": "BAD_REQUEST",
  "message": "<VALOR>",
  "status": 400,
  "errors": [],
  "stack": "<VALOR>"
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to change group photo by file. On confirm, the backend must call POST /rest/group/{instance_key}/updateGroupPicture on megaAPI using the configured instance and the securely stored token. Swaps the group image by sending the photo file. The previous image is replaced and not kept. Show loading, success, and error states; do not expose the token in the browser. Example data: no JSON body
Claude Code
Implement a TypeScript function called group_updateGroupPicture that calls POST https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/updateGroupPicture?to=5511999998888 with Authorization Bearer <YOUR_TOKEN>. Swaps the group image by sending the photo file. The previous image is replaced and not kept. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: no JSON body
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the group.updateGroupPicture integration in a Node.js service. Swaps the group image by sending the photo file. The previous image is replaced and not kept."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/updateGroupPicture?to=5511999998888",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": null
    }
  ]
}
Cursor
In the current project, implement the group_updateGroupPicture client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/updateGroupPicture?to=5511999998888. Swaps the group image by sending the photo file. The previous image is replaced and not kept. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: no JSON body
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/updateGroupPicture?to=5511999998888. Auth: Bearer <YOUR_TOKEN>. Swaps the group image by sending the photo file. The previous image is replaced and not kept. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: no JSON body
POSTGruposBusinesstestado na API real

Alterar foto do grupo por Base64

Troca a imagem do grupo enviando a própria foto convertida em texto (Base64), sem hospedar nada em lugar algum.

POSThttps://{seu_host}/rest/group/{instance_key}/updateGroupPictureBase64

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "to": "5511999998888",
  "base64": "<VALOR>"
}
opcionalValor enviado no corpo: message data.
Envie só o conteúdo em Base64, sem o prefixo "data:image/png;base64,".
AtributosTipoDescrição
tostring
base64string
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/updateGroupPictureBase64" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "to": "5511999998888",
    "base64": "<VALOR>"
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/updateGroupPictureBase64', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "base64": "<VALOR>"
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/updateGroupPictureBase64', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "base64": "<VALOR>"
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to change group photo by base64. On confirm, the backend must call POST /rest/group/{instance_key}/updateGroupPictureBase64 on megaAPI using the configured instance and the securely stored token. Swaps the group image by sending the photo itself converted to text (Base64), without hosting anything anywhere. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "to": "5511999998888",
    "base64": "<VALOR>"
  }
}
Claude Code
Implement a TypeScript function called group_updateGroupPictureBase64 that calls POST https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/updateGroupPictureBase64 with Authorization Bearer <YOUR_TOKEN>. Swaps the group image by sending the photo itself converted to text (Base64), without hosting anything anywhere. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "to": "5511999998888",
    "base64": "<VALOR>"
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the group.updateGroupPictureBase64 integration in a Node.js service. Swaps the group image by sending the photo itself converted to text (Base64), without hosting anything anywhere."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/updateGroupPictureBase64",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "to": "5511999998888",
          "base64": "<VALOR>"
        }
      }
    }
  ]
}
Cursor
In the current project, implement the group_updateGroupPictureBase64 client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/updateGroupPictureBase64. Swaps the group image by sending the photo itself converted to text (Base64), without hosting anything anywhere. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "to": "5511999998888",
    "base64": "<VALOR>"
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/updateGroupPictureBase64. Auth: Bearer <YOUR_TOKEN>. Swaps the group image by sending the photo itself converted to text (Base64), without hosting anything anywhere. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "to": "5511999998888",
    "base64": "<VALOR>"
  }
}
POSTGruposBusinesstestado na API real

Alterar foto do grupo por URL

Troca a imagem do grupo usando o endereço de uma foto publicada na internet. O link deve abrir diretamente na imagem, sem senha nem página de login.

POSThttps://{seu_host}/rest/group/{instance_key}/updateGroupPictureUrl

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "to": "5511999998888",
  "url": "https://seu-dominio.com/webhook"
}
opcionalValor enviado no corpo: message data.
Use um link público que termina no arquivo (…/foto.jpg). Endereço de pasta do Google Drive ou de página com login não funciona.
AtributosTipoDescrição
tostring
urlstring
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/updateGroupPictureUrl" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "to": "5511999998888",
    "url": "https://seu-dominio.com/webhook"
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/updateGroupPictureUrl', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "url": "https://seu-dominio.com/webhook"
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/updateGroupPictureUrl', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "url": "https://seu-dominio.com/webhook"
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to change group photo by url. On confirm, the backend must call POST /rest/group/{instance_key}/updateGroupPictureUrl on megaAPI using the configured instance and the securely stored token. Swaps the group image using the address of a photo published on the internet. The link must open directly on the image, with no password or login page. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "to": "5511999998888",
    "url": "https://seu-dominio.com/webhook"
  }
}
Claude Code
Implement a TypeScript function called group_updateGroupPictureUrl that calls POST https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/updateGroupPictureUrl with Authorization Bearer <YOUR_TOKEN>. Swaps the group image using the address of a photo published on the internet. The link must open directly on the image, with no password or login page. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "to": "5511999998888",
    "url": "https://seu-dominio.com/webhook"
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the group.updateGroupPictureUrl integration in a Node.js service. Swaps the group image using the address of a photo published on the internet. The link must open directly on the image, with no password or login page."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/updateGroupPictureUrl",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "to": "5511999998888",
          "url": "https://seu-dominio.com/webhook"
        }
      }
    }
  ]
}
Cursor
In the current project, implement the group_updateGroupPictureUrl client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/updateGroupPictureUrl. Swaps the group image using the address of a photo published on the internet. The link must open directly on the image, with no password or login page. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "to": "5511999998888",
    "url": "https://seu-dominio.com/webhook"
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/updateGroupPictureUrl. Auth: Bearer <YOUR_TOKEN>. Swaps the group image using the address of a photo published on the internet. The link must open directly on the image, with no password or login page. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "to": "5511999998888",
    "url": "https://seu-dominio.com/webhook"
  }
}
POSTGruposBusinesstestado na API real

Alterar nome do grupo

Altera o nome do grupo. Normalmente só os administradores podem, e a mudança fica visível para todos os participantes.

POSThttps://{seu_host}/rest/group/{instance_key}/updateGroupSubject

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "jid": "<VALOR>",
  "subject": "<VALOR>"
}
opcionalValor enviado no corpo: message data.
Informe o ID do grupo (terminado em @g.us) e o novo nome.
AtributosTipoDescrição
jidstring
subjectstring
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/updateGroupSubject" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "jid": "<VALOR>",
    "subject": "<VALOR>"
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/updateGroupSubject', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "jid": "<VALOR>",
    "subject": "<VALOR>"
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/updateGroupSubject', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "jid": "<VALOR>",
    "subject": "<VALOR>"
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to change group name. On confirm, the backend must call POST /rest/group/{instance_key}/updateGroupSubject on megaAPI using the configured instance and the securely stored token. Changes the group name. Usually only admins can, and the change shows for all participants. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "jid": "<VALOR>",
    "subject": "<VALOR>"
  }
}
Claude Code
Implement a TypeScript function called group_updateGroupSubject that calls POST https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/updateGroupSubject with Authorization Bearer <YOUR_TOKEN>. Changes the group name. Usually only admins can, and the change shows for all participants. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "jid": "<VALOR>",
    "subject": "<VALOR>"
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the group.updateGroupSubject integration in a Node.js service. Changes the group name. Usually only admins can, and the change shows for all participants."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/updateGroupSubject",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "jid": "<VALOR>",
          "subject": "<VALOR>"
        }
      }
    }
  ]
}
Cursor
In the current project, implement the group_updateGroupSubject client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/updateGroupSubject. Changes the group name. Usually only admins can, and the change shows for all participants. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "jid": "<VALOR>",
    "subject": "<VALOR>"
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/group/<INSTANCE_KEY>/updateGroupSubject. Auth: Bearer <YOUR_TOKEN>. Changes the group name. Usually only admins can, and the change shows for all participants. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "jid": "<VALOR>",
    "subject": "<VALOR>"
  }
}
GETInstânciaBusinessStartNoCodetestado na API real

Verificar limites de envio

Busca os limites de envio configurados para a instância: o tempo de espera antes de iniciar uma conversa com um novo contato e o teto de mensagens por conversa. Ajuda a explicar por que um lote de envios começou a ser bloqueado.

GEThttps://{seu_host}/rest/instance/timeLock/{instance_key}

Disponível em mais de um plano — troque o host conforme a sua instância:

Business: apibusiness1.megaapi.com.brStart: apistart01.megaapi.com.br / apistart02.megaapi.com.br / apistart03.megaapi.com.brNoCode: apinocode01.megaapi.com.br / apinocode02.megaapi.com.br
CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
curl
curl -X GET "https://apibusiness1.megaapi.com.br/rest/instance/timeLock/<INSTANCE_KEY>" \
  -H "Authorization: Bearer <SEU_TOKEN>"
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/timeLock/<INSTANCE_KEY>', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' },
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/timeLock/<INSTANCE_KEY>', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' }
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to check sending limits. On confirm, the backend must call GET /rest/instance/timeLock/{instance_key} on megaAPI using the configured instance and the securely stored token. Fetches the sending limits configured for the instance: the wait time before you can start a conversation with a new contact and the cap on messages per conversation. Helps explain why a batch of sends started being blocked. Show loading, success, and error states; do not expose the token in the browser. Example data: no JSON body
Claude Code
Implement a TypeScript function called instance_get_instance_key that calls GET https://apibusiness1.megaapi.com.br/rest/instance/timeLock/<INSTANCE_KEY> with Authorization Bearer <YOUR_TOKEN>. Fetches the sending limits configured for the instance: the wait time before you can start a conversation with a new contact and the cap on messages per conversation. Helps explain why a batch of sends started being blocked. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: no JSON body
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the instance.get.instance_key integration in a Node.js service. Fetches the sending limits configured for the instance: the wait time before you can start a conversation with a new contact and the cap on messages per conversation. Helps explain why a batch of sends started being blocked."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "GET",
      "url": "GET https://apibusiness1.megaapi.com.br/rest/instance/timeLock/<INSTANCE_KEY>",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": null
    }
  ]
}
Cursor
In the current project, implement the instance_get_instance_key client in TypeScript for GET https://apibusiness1.megaapi.com.br/rest/instance/timeLock/<INSTANCE_KEY>. Fetches the sending limits configured for the instance: the wait time before you can start a conversation with a new contact and the cap on messages per conversation. Helps explain why a batch of sends started being blocked. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: no JSON body
Codex
Create a TypeScript function for GET https://apibusiness1.megaapi.com.br/rest/instance/timeLock/<INSTANCE_KEY>. Auth: Bearer <YOUR_TOKEN>. Fetches the sending limits configured for the instance: the wait time before you can start a conversation with a new contact and the cap on messages per conversation. Helps explain why a batch of sends started being blocked. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: no JSON body
GETInstânciaBusinessStartNoCodetestado na API real

Verificar status da instância

Mostra se a instância está conectada ao WhatsApp e qual número de telefone está vinculado a ela. Verifique antes de enviar qualquer mensagem: se a instância estiver desconectada, todas as outras chamadas falham.

GEThttps://{seu_host}/rest/instance/{instance_key}

Disponível em mais de um plano — troque o host conforme a sua instância:

Business: apibusiness1.megaapi.com.brStart: apistart01.megaapi.com.br / apistart02.megaapi.com.br / apistart03.megaapi.com.brNoCode: apinocode01.megaapi.com.br / apinocode02.megaapi.com.br
CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
curl
curl -X GET "https://apibusiness1.megaapi.com.br/rest/instance/<INSTANCE_KEY>" \
  -H "Authorization: Bearer <SEU_TOKEN>"
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/<INSTANCE_KEY>', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' },
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/<INSTANCE_KEY>', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' }
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to check instance status. On confirm, the backend must call GET /rest/instance/{instance_key} on megaAPI using the configured instance and the securely stored token. Shows whether the instance is connected to WhatsApp and which phone number is paired with it. Check before sending any message: if the instance is disconnected, all other calls fail. Show loading, success, and error states; do not expose the token in the browser. Example data: no JSON body
Claude Code
Implement a TypeScript function called instance_instance_key that calls GET https://apibusiness1.megaapi.com.br/rest/instance/<INSTANCE_KEY> with Authorization Bearer <YOUR_TOKEN>. Shows whether the instance is connected to WhatsApp and which phone number is paired with it. Check before sending any message: if the instance is disconnected, all other calls fail. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: no JSON body
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the instance.instance_key integration in a Node.js service. Shows whether the instance is connected to WhatsApp and which phone number is paired with it. Check before sending any message: if the instance is disconnected, all other calls fail."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "GET",
      "url": "GET https://apibusiness1.megaapi.com.br/rest/instance/<INSTANCE_KEY>",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": null
    }
  ]
}
Cursor
In the current project, implement the instance_instance_key client in TypeScript for GET https://apibusiness1.megaapi.com.br/rest/instance/<INSTANCE_KEY>. Shows whether the instance is connected to WhatsApp and which phone number is paired with it. Check before sending any message: if the instance is disconnected, all other calls fail. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: no JSON body
Codex
Create a TypeScript function for GET https://apibusiness1.megaapi.com.br/rest/instance/<INSTANCE_KEY>. Auth: Bearer <YOUR_TOKEN>. Shows whether the instance is connected to WhatsApp and which phone number is paired with it. Check before sending any message: if the instance is disconnected, all other calls fail. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: no JSON body
POSTInstânciaBusinesstestado na API real

Editar ou excluir etiqueta

Altera o nome ou a cor de uma etiqueta existente, e também é aqui que você exclui uma. A exclusão é definitiva: a etiqueta desaparece de todas as conversas em que estava aplicada e não pode ser desfeita.

POSThttps://{seu_host}/rest/instance/labels/editLabel/{instance_key}

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
databodyobject
JSON
{
  "labelId": "<VALOR>",
  "name": "<VALOR>",
  "color": 1,
  "deleted": false
}
opcionalValor enviado no corpo: data.
Informe o `labelId` da etiqueta. Enviar `deleted: true` exclui a etiqueta em vez de apenas editá-la.
AtributosTipoDescrição
labelIdstring
namestring
colornumber
deletedboolean
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/instance/labels/editLabel/<INSTANCE_KEY>" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "data": {
    "labelId": "<VALOR>",
    "name": "<VALOR>",
    "color": 1,
    "deleted": false
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/labels/editLabel/<INSTANCE_KEY>', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "data": {
    "labelId": "<VALOR>",
    "name": "<VALOR>",
    "color": 1,
    "deleted": false
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/labels/editLabel/<INSTANCE_KEY>', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "data": {
    "labelId": "<VALOR>",
    "name": "<VALOR>",
    "color": 1,
    "deleted": false
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to edit or delete label. On confirm, the backend must call POST /rest/instance/labels/editLabel/{instance_key} on megaAPI using the configured instance and the securely stored token. Changes the name or color of an existing label, and this is also where you delete one. Deletion is final: the label disappears from every conversation it was on and cannot be undone. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "data": {
    "labelId": "<VALOR>",
    "name": "<VALOR>",
    "color": 1,
    "deleted": false
  }
}
Claude Code
Implement a TypeScript function called instance_instance_key-10 that calls POST https://apibusiness1.megaapi.com.br/rest/instance/labels/editLabel/<INSTANCE_KEY> with Authorization Bearer <YOUR_TOKEN>. Changes the name or color of an existing label, and this is also where you delete one. Deletion is final: the label disappears from every conversation it was on and cannot be undone. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "data": {
    "labelId": "<VALOR>",
    "name": "<VALOR>",
    "color": 1,
    "deleted": false
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the instance.instance_key-10 integration in a Node.js service. Changes the name or color of an existing label, and this is also where you delete one. Deletion is final: the label disappears from every conversation it was on and cannot be undone."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/instance/labels/editLabel/<INSTANCE_KEY>",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "data": {
          "labelId": "<VALOR>",
          "name": "<VALOR>",
          "color": 1,
          "deleted": false
        }
      }
    }
  ]
}
Cursor
In the current project, implement the instance_instance_key-10 client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/instance/labels/editLabel/<INSTANCE_KEY>. Changes the name or color of an existing label, and this is also where you delete one. Deletion is final: the label disappears from every conversation it was on and cannot be undone. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "data": {
    "labelId": "<VALOR>",
    "name": "<VALOR>",
    "color": 1,
    "deleted": false
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/instance/labels/editLabel/<INSTANCE_KEY>. Auth: Bearer <YOUR_TOKEN>. Changes the name or color of an existing label, and this is also where you delete one. Deletion is final: the label disappears from every conversation it was on and cannot be undone. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "data": {
    "labelId": "<VALOR>",
    "name": "<VALOR>",
    "color": 1,
    "deleted": false
  }
}
GETInstânciaBusinesstestado na API real

Ver etiquetas de uma conversa

Mostra quais etiquetas estão aplicadas a uma conversa específica.

GEThttps://{seu_host}/rest/instance/labels/getChatLabels/{instance_key}?chatId=[email protected]

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
chatIdquerystring"[email protected]"opcionalFiltro ou opção da consulta: chat id.
Identificador da conversa: [email protected] para pessoa, ou o ID terminado em @g.us para grupo.
curl
curl -X GET "https://apibusiness1.megaapi.com.br/rest/instance/labels/getChatLabels/<INSTANCE_KEY>[email protected]" \
  -H "Authorization: Bearer <SEU_TOKEN>"
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/labels/getChatLabels/<INSTANCE_KEY>[email protected]', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' },
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/labels/getChatLabels/<INSTANCE_KEY>[email protected]', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' }
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to view conversation labels. On confirm, the backend must call GET /rest/instance/labels/getChatLabels/{instance_key} on megaAPI using the configured instance and the securely stored token. Shows which labels are applied to a specific conversation. Show loading, success, and error states; do not expose the token in the browser. Example data: no JSON body
Claude Code
Implement a TypeScript function called instance_instance_key-11 that calls GET https://apibusiness1.megaapi.com.br/rest/instance/labels/getChatLabels/<INSTANCE_KEY>[email protected] with Authorization Bearer <YOUR_TOKEN>. Shows which labels are applied to a specific conversation. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: no JSON body
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the instance.instance_key-11 integration in a Node.js service. Shows which labels are applied to a specific conversation."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "GET",
      "url": "GET https://apibusiness1.megaapi.com.br/rest/instance/labels/getChatLabels/<INSTANCE_KEY>[email protected]",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": null
    }
  ]
}
Cursor
In the current project, implement the instance_instance_key-11 client in TypeScript for GET https://apibusiness1.megaapi.com.br/rest/instance/labels/getChatLabels/<INSTANCE_KEY>[email protected]. Shows which labels are applied to a specific conversation. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: no JSON body
Codex
Create a TypeScript function for GET https://apibusiness1.megaapi.com.br/rest/instance/labels/getChatLabels/<INSTANCE_KEY>[email protected]. Auth: Bearer <YOUR_TOKEN>. Shows which labels are applied to a specific conversation. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: no JSON body
POSTInstânciaBusinesstestado na API real

Aplicar etiquetas a uma conversa

Aplica ou remove etiquetas em uma conversa. Você informa a conversa, quais etiquetas e o que fazer com elas.

POSThttps://{seu_host}/rest/instance/labels/setChatLabels/{instance_key}

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
databodyobject
JSON
{
  "chatId": "[email protected]",
  "messageId": "<VALOR>",
  "labelId": [
    ""
  ],
  "action": "add"
}
opcionalValor enviado no corpo: data.
`chatId` é a conversa, `labelId` a lista de etiquetas e `action` diz o que fazer: "add" para colar, "remove" para tirar.
AtributosTipoDescrição
chatIdstring
messageIdstring
labelIdarray
actionstring
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/instance/labels/setChatLabels/<INSTANCE_KEY>" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "data": {
    "chatId": "[email protected]",
    "messageId": "<VALOR>",
    "labelId": [
      ""
    ],
    "action": "add"
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/labels/setChatLabels/<INSTANCE_KEY>', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "data": {
    "chatId": "[email protected]",
    "messageId": "<VALOR>",
    "labelId": [
      ""
    ],
    "action": "add"
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/labels/setChatLabels/<INSTANCE_KEY>', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "data": {
    "chatId": "[email protected]",
    "messageId": "<VALOR>",
    "labelId": [
      ""
    ],
    "action": "add"
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to apply labels to a conversation. On confirm, the backend must call POST /rest/instance/labels/setChatLabels/{instance_key} on megaAPI using the configured instance and the securely stored token. Attaches or removes labels on a conversation. You specify the conversation, which labels, and what to do with them. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "data": {
    "chatId": "[email protected]",
    "messageId": "<VALOR>",
    "labelId": [
      ""
    ],
    "action": "add"
  }
}
Claude Code
Implement a TypeScript function called instance_instance_key-12 that calls POST https://apibusiness1.megaapi.com.br/rest/instance/labels/setChatLabels/<INSTANCE_KEY> with Authorization Bearer <YOUR_TOKEN>. Attaches or removes labels on a conversation. You specify the conversation, which labels, and what to do with them. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "data": {
    "chatId": "[email protected]",
    "messageId": "<VALOR>",
    "labelId": [
      ""
    ],
    "action": "add"
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the instance.instance_key-12 integration in a Node.js service. Attaches or removes labels on a conversation. You specify the conversation, which labels, and what to do with them."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/instance/labels/setChatLabels/<INSTANCE_KEY>",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "data": {
          "chatId": "[email protected]",
          "messageId": "<VALOR>",
          "labelId": [
            ""
          ],
          "action": "add"
        }
      }
    }
  ]
}
Cursor
In the current project, implement the instance_instance_key-12 client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/instance/labels/setChatLabels/<INSTANCE_KEY>. Attaches or removes labels on a conversation. You specify the conversation, which labels, and what to do with them. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "data": {
    "chatId": "[email protected]",
    "messageId": "<VALOR>",
    "labelId": [
      ""
    ],
    "action": "add"
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/instance/labels/setChatLabels/<INSTANCE_KEY>. Auth: Bearer <YOUR_TOKEN>. Attaches or removes labels on a conversation. You specify the conversation, which labels, and what to do with them. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "data": {
    "chatId": "[email protected]",
    "messageId": "<VALOR>",
    "labelId": [
      ""
    ],
    "action": "add"
  }
}
POSTInstânciaBusinessStartNoCodetestado na API real

Baixar mídia de mensagem

Recupera o arquivo — imagem, áudio, vídeo ou documento — de uma mensagem que passou pela instância. Funciona apenas com os dados técnicos da mídia em mãos, que chegam junto com a notificação da mensagem no seu webhook.

POSThttps://{seu_host}/rest/instance/downloadMediaMessage/{instance_key}

Disponível em mais de um plano — troque o host conforme a sua instância:

Business: apibusiness1.megaapi.com.brStart: apistart01.megaapi.com.br / apistart02.megaapi.com.br / apistart03.megaapi.com.brNoCode: apinocode01.megaapi.com.br / apinocode02.megaapi.com.br
CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageKeysbodyobject
JSON
{
  "mediaKey": "<VALOR>",
  "directPath": "<VALOR>",
  "url": "https://seu-dominio.com/webhook",
  "mimetype": "<VALOR>",
  "messageType": "<VALOR>"
}
opcionalValor enviado no corpo: message keys.
Dados técnicos da mídia (`mediaKey`, `directPath`, `mimetype`, `messageType`). Copie exatamente como vieram no webhook da mensagem; eles não podem ser montados à mão.
AtributosTipoDescrição
mediaKeystringKey retornado pelo Whatsapp
directPathstringPath retornado pelo Whatsapp
urlstringURL retornado pelo Whatsapp
mimetypestringMineType retornado pelo Whatsapp
messageTypestringimage, document, audio, video
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/instance/downloadMediaMessage/<INSTANCE_KEY>" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageKeys": {
    "mediaKey": "<VALOR>",
    "directPath": "<VALOR>",
    "url": "https://seu-dominio.com/webhook",
    "mimetype": "<VALOR>",
    "messageType": "<VALOR>"
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/downloadMediaMessage/<INSTANCE_KEY>', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageKeys": {
    "mediaKey": "<VALOR>",
    "directPath": "<VALOR>",
    "url": "https://seu-dominio.com/webhook",
    "mimetype": "<VALOR>",
    "messageType": "<VALOR>"
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/downloadMediaMessage/<INSTANCE_KEY>', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageKeys": {
    "mediaKey": "<VALOR>",
    "directPath": "<VALOR>",
    "url": "https://seu-dominio.com/webhook",
    "mimetype": "<VALOR>",
    "messageType": "<VALOR>"
  }
})
});
console.log(await response.json());
HTTP 200
{
  "error": false,
  "message": "Media message downloaded",
  "data": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEABsbGxscGx4hIR4qLSgtKj04MzM4PV1CR0JHQl2NWGdYWGdYjX2Xe3N7l33gsJycsOD/2c7Z//////////////8... [truncado — arquivo completo: 118.880 bytes]"
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to download message media. On confirm, the backend must call POST /rest/instance/downloadMediaMessage/{instance_key} on megaAPI using the configured instance and the securely stored token. Retrieves the file - image, audio, video, or document - from a message that went through the instance. It only works with the media's technical data in hand, which arrives along with the message notification on your webhook. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageKeys": {
    "mediaKey": "<VALOR>",
    "directPath": "<VALOR>",
    "url": "https://seu-dominio.com/webhook",
    "mimetype": "<VALOR>",
    "messageType": "<VALOR>"
  }
}
Claude Code
Implement a TypeScript function called instance_instance_key-13 that calls POST https://apibusiness1.megaapi.com.br/rest/instance/downloadMediaMessage/<INSTANCE_KEY> with Authorization Bearer <YOUR_TOKEN>. Retrieves the file - image, audio, video, or document - from a message that went through the instance. It only works with the media's technical data in hand, which arrives along with the message notification on your webhook. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageKeys": {
    "mediaKey": "<VALOR>",
    "directPath": "<VALOR>",
    "url": "https://seu-dominio.com/webhook",
    "mimetype": "<VALOR>",
    "messageType": "<VALOR>"
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the instance.instance_key-13 integration in a Node.js service. Retrieves the file - image, audio, video, or document - from a message that went through the instance. It only works with the media's technical data in hand, which arrives along with the message notification on your webhook."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/instance/downloadMediaMessage/<INSTANCE_KEY>",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageKeys": {
          "mediaKey": "<VALOR>",
          "directPath": "<VALOR>",
          "url": "https://seu-dominio.com/webhook",
          "mimetype": "<VALOR>",
          "messageType": "<VALOR>"
        }
      }
    }
  ]
}
Cursor
In the current project, implement the instance_instance_key-13 client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/instance/downloadMediaMessage/<INSTANCE_KEY>. Retrieves the file - image, audio, video, or document - from a message that went through the instance. It only works with the media's technical data in hand, which arrives along with the message notification on your webhook. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageKeys": {
    "mediaKey": "<VALOR>",
    "directPath": "<VALOR>",
    "url": "https://seu-dominio.com/webhook",
    "mimetype": "<VALOR>",
    "messageType": "<VALOR>"
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/instance/downloadMediaMessage/<INSTANCE_KEY>. Auth: Bearer <YOUR_TOKEN>. Retrieves the file - image, audio, video, or document - from a message that went through the instance. It only works with the media's technical data in hand, which arrives along with the message notification on your webhook. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageKeys": {
    "mediaKey": "<VALOR>",
    "directPath": "<VALOR>",
    "url": "https://seu-dominio.com/webhook",
    "mimetype": "<VALOR>",
    "messageType": "<VALOR>"
  }
}
GETInstânciaBusinessStarttestado na API real

Ver foto de perfil

Retorna a foto de perfil de um número de telefone ou de um grupo no WhatsApp. Se a pessoa restringir a foto nas configurações de privacidade, não há imagem para retornar.

GEThttps://{seu_host}/rest/instance/getProfilePicture/{instance_key}?to=5511999998888&type=<VALOR>

Disponível em mais de um plano — troque o host conforme a sua instância:

Business: apibusiness1.megaapi.com.brStart: apistart01.megaapi.com.br / apistart02.megaapi.com.br / apistart03.megaapi.com.br
CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
toquerystring"5511999998888"opcionalFiltro ou opção da consulta: to.
Número com DDI+DDD, só dígitos (ex.: 5511999998888), ou o ID do grupo terminado em @g.us.
typequerystring"<VALOR>"opcionalFiltro ou opção da consulta: type.
curl
curl -X GET "https://apibusiness1.megaapi.com.br/rest/instance/getProfilePicture/<INSTANCE_KEY>?to=5511999998888&type=<VALOR>" \
  -H "Authorization: Bearer <SEU_TOKEN>"
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/getProfilePicture/<INSTANCE_KEY>?to=5511999998888&type=<VALOR>', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' },
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/getProfilePicture/<INSTANCE_KEY>?to=5511999998888&type=<VALOR>', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' }
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to view profile photo. On confirm, the backend must call GET /rest/instance/getProfilePicture/{instance_key} on megaAPI using the configured instance and the securely stored token. Returns the profile photo of a phone number or a group on WhatsApp. If the person restricts the photo in their privacy settings, there is no image to return. Show loading, success, and error states; do not expose the token in the browser. Example data: no JSON body
Claude Code
Implement a TypeScript function called instance_instance_key-14 that calls GET https://apibusiness1.megaapi.com.br/rest/instance/getProfilePicture/<INSTANCE_KEY>?to=5511999998888&type=<VALOR> with Authorization Bearer <YOUR_TOKEN>. Returns the profile photo of a phone number or a group on WhatsApp. If the person restricts the photo in their privacy settings, there is no image to return. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: no JSON body
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the instance.instance_key-14 integration in a Node.js service. Returns the profile photo of a phone number or a group on WhatsApp. If the person restricts the photo in their privacy settings, there is no image to return."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "GET",
      "url": "GET https://apibusiness1.megaapi.com.br/rest/instance/getProfilePicture/<INSTANCE_KEY>?to=5511999998888&type=<VALOR>",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": null
    }
  ]
}
Cursor
In the current project, implement the instance_instance_key-14 client in TypeScript for GET https://apibusiness1.megaapi.com.br/rest/instance/getProfilePicture/<INSTANCE_KEY>?to=5511999998888&type=<VALOR>. Returns the profile photo of a phone number or a group on WhatsApp. If the person restricts the photo in their privacy settings, there is no image to return. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: no JSON body
Codex
Create a TypeScript function for GET https://apibusiness1.megaapi.com.br/rest/instance/getProfilePicture/<INSTANCE_KEY>?to=5511999998888&type=<VALOR>. Auth: Bearer <YOUR_TOKEN>. Returns the profile photo of a phone number or a group on WhatsApp. If the person restricts the photo in their privacy settings, there is no image to return. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: no JSON body
POSTInstânciaBusinesstestado na API real

Alterar bio do perfil

Altera a bio do perfil — o texto curto exibido nas informações de contato — do número conectado à instância.

POSThttps://{seu_host}/rest/instance/setProfileStatus/{instance_key}

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "status": "<VALOR>"
}
opcionalValor enviado no corpo: message data.
AtributosTipoDescrição
statusstringMensagem que deseja adicionar na descrição do perfil
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/instance/setProfileStatus/<INSTANCE_KEY>" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "status": "<VALOR>"
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/setProfileStatus/<INSTANCE_KEY>', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "status": "<VALOR>"
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/setProfileStatus/<INSTANCE_KEY>', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "status": "<VALOR>"
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to change profile about. On confirm, the backend must call POST /rest/instance/setProfileStatus/{instance_key} on megaAPI using the configured instance and the securely stored token. Changes the profile about - the short text shown in the contact info - of the number connected to the instance. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "status": "<VALOR>"
  }
}
Claude Code
Implement a TypeScript function called instance_instance_key-15 that calls POST https://apibusiness1.megaapi.com.br/rest/instance/setProfileStatus/<INSTANCE_KEY> with Authorization Bearer <YOUR_TOKEN>. Changes the profile about - the short text shown in the contact info - of the number connected to the instance. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "status": "<VALOR>"
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the instance.instance_key-15 integration in a Node.js service. Changes the profile about - the short text shown in the contact info - of the number connected to the instance."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/instance/setProfileStatus/<INSTANCE_KEY>",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "status": "<VALOR>"
        }
      }
    }
  ]
}
Cursor
In the current project, implement the instance_instance_key-15 client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/instance/setProfileStatus/<INSTANCE_KEY>. Changes the profile about - the short text shown in the contact info - of the number connected to the instance. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "status": "<VALOR>"
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/instance/setProfileStatus/<INSTANCE_KEY>. Auth: Bearer <YOUR_TOKEN>. Changes the profile about - the short text shown in the contact info - of the number connected to the instance. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "status": "<VALOR>"
  }
}
POSTInstânciaBusinesstestado na API real

Alterar nome do perfil

Altera o nome que as outras pessoas veem ao receber uma mensagem do número conectado à instância.

POSThttps://{seu_host}/rest/instance/setProfileName/{instance_key}

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "name": "<VALOR>"
}
opcionalValor enviado no corpo: message data.
AtributosTipoDescrição
namestringNome que deseja adicionar no perfil do Whatsapp
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/instance/setProfileName/<INSTANCE_KEY>" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "name": "<VALOR>"
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/setProfileName/<INSTANCE_KEY>', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "name": "<VALOR>"
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/setProfileName/<INSTANCE_KEY>', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "name": "<VALOR>"
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to change profile name. On confirm, the backend must call POST /rest/instance/setProfileName/{instance_key} on megaAPI using the configured instance and the securely stored token. Changes the name other people see when they receive a message from the number connected to the instance. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "name": "<VALOR>"
  }
}
Claude Code
Implement a TypeScript function called instance_instance_key-16 that calls POST https://apibusiness1.megaapi.com.br/rest/instance/setProfileName/<INSTANCE_KEY> with Authorization Bearer <YOUR_TOKEN>. Changes the name other people see when they receive a message from the number connected to the instance. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "name": "<VALOR>"
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the instance.instance_key-16 integration in a Node.js service. Changes the name other people see when they receive a message from the number connected to the instance."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/instance/setProfileName/<INSTANCE_KEY>",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "name": "<VALOR>"
        }
      }
    }
  ]
}
Cursor
In the current project, implement the instance_instance_key-16 client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/instance/setProfileName/<INSTANCE_KEY>. Changes the name other people see when they receive a message from the number connected to the instance. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "name": "<VALOR>"
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/instance/setProfileName/<INSTANCE_KEY>. Auth: Bearer <YOUR_TOKEN>. Changes the name other people see when they receive a message from the number connected to the instance. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "name": "<VALOR>"
  }
}
POSTInstânciaBusinesstestado na API real

Alterar foto de perfil por arquivo

Troca a foto de perfil do número conectado enviando o arquivo de imagem. A foto anterior é substituída e não é mantida.

POSThttps://{seu_host}/rest/instance/setProfilePicture/{instance_key}?to=5511999998888

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
toquerystring"5511999998888"opcionalFiltro ou opção da consulta: to.
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/instance/setProfilePicture/<INSTANCE_KEY>?to=5511999998888" \
  -H "Authorization: Bearer <SEU_TOKEN>"
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/setProfilePicture/<INSTANCE_KEY>?to=5511999998888', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' },
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/setProfilePicture/<INSTANCE_KEY>?to=5511999998888', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' }
});
console.log(await response.json());
HTTP 400
{
  "name": "BAD_REQUEST",
  "message": "<VALOR>",
  "status": 400,
  "errors": [],
  "stack": "<VALOR>"
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to change profile photo by file. On confirm, the backend must call POST /rest/instance/setProfilePicture/{instance_key} on megaAPI using the configured instance and the securely stored token. Swaps the profile photo of the connected number by sending the image file. The previous photo is replaced and not kept. Show loading, success, and error states; do not expose the token in the browser. Example data: no JSON body
Claude Code
Implement a TypeScript function called instance_instance_key-17 that calls POST https://apibusiness1.megaapi.com.br/rest/instance/setProfilePicture/<INSTANCE_KEY>?to=5511999998888 with Authorization Bearer <YOUR_TOKEN>. Swaps the profile photo of the connected number by sending the image file. The previous photo is replaced and not kept. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: no JSON body
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the instance.instance_key-17 integration in a Node.js service. Swaps the profile photo of the connected number by sending the image file. The previous photo is replaced and not kept."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/instance/setProfilePicture/<INSTANCE_KEY>?to=5511999998888",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": null
    }
  ]
}
Cursor
In the current project, implement the instance_instance_key-17 client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/instance/setProfilePicture/<INSTANCE_KEY>?to=5511999998888. Swaps the profile photo of the connected number by sending the image file. The previous photo is replaced and not kept. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: no JSON body
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/instance/setProfilePicture/<INSTANCE_KEY>?to=5511999998888. Auth: Bearer <YOUR_TOKEN>. Swaps the profile photo of the connected number by sending the image file. The previous photo is replaced and not kept. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: no JSON body
POSTInstânciaBusinesstestado na API real

Alterar foto de perfil por URL

Troca a foto de perfil usando o endereço de uma imagem já publicada na internet. O link deve abrir diretamente no arquivo de imagem, sem senha ou página de login.

POSThttps://{seu_host}/rest/instance/setProfilePictureUrl/{instance_key}

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "to": "5511999998888",
  "url": "https://seu-dominio.com/webhook"
}
opcionalValor enviado no corpo: message data.
Use um link público que termina no arquivo (…/foto.jpg). Endereço de pasta do Google Drive ou de página com login não funciona.
AtributosTipoDescrição
tostringWhatsapp que esta conectado na api para troca da imagem do perfil
urlstringURL da imagem
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/instance/setProfilePictureUrl/<INSTANCE_KEY>" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "to": "5511999998888",
    "url": "https://seu-dominio.com/webhook"
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/setProfilePictureUrl/<INSTANCE_KEY>', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "url": "https://seu-dominio.com/webhook"
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/setProfilePictureUrl/<INSTANCE_KEY>', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "url": "https://seu-dominio.com/webhook"
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to change profile photo by url. On confirm, the backend must call POST /rest/instance/setProfilePictureUrl/{instance_key} on megaAPI using the configured instance and the securely stored token. Swaps the profile photo using the address of an image already published on the internet. The link must open directly on the image file, with no password or login page. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "to": "5511999998888",
    "url": "https://seu-dominio.com/webhook"
  }
}
Claude Code
Implement a TypeScript function called instance_instance_key-18 that calls POST https://apibusiness1.megaapi.com.br/rest/instance/setProfilePictureUrl/<INSTANCE_KEY> with Authorization Bearer <YOUR_TOKEN>. Swaps the profile photo using the address of an image already published on the internet. The link must open directly on the image file, with no password or login page. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "to": "5511999998888",
    "url": "https://seu-dominio.com/webhook"
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the instance.instance_key-18 integration in a Node.js service. Swaps the profile photo using the address of an image already published on the internet. The link must open directly on the image file, with no password or login page."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/instance/setProfilePictureUrl/<INSTANCE_KEY>",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "to": "5511999998888",
          "url": "https://seu-dominio.com/webhook"
        }
      }
    }
  ]
}
Cursor
In the current project, implement the instance_instance_key-18 client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/instance/setProfilePictureUrl/<INSTANCE_KEY>. Swaps the profile photo using the address of an image already published on the internet. The link must open directly on the image file, with no password or login page. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "to": "5511999998888",
    "url": "https://seu-dominio.com/webhook"
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/instance/setProfilePictureUrl/<INSTANCE_KEY>. Auth: Bearer <YOUR_TOKEN>. Swaps the profile photo using the address of an image already published on the internet. The link must open directly on the image file, with no password or login page. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "to": "5511999998888",
    "url": "https://seu-dominio.com/webhook"
  }
}
POSTInstânciaBusinesstestado na API real

Alterar foto de perfil por Base64

Troca a foto de perfil enviando a própria imagem convertida em texto (Base64). Use quando a imagem estiver no seu servidor e você não tiver um link público para ela.

POSThttps://{seu_host}/rest/instance/setProfilePictureBase64/{instance_key}

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "to": "5511999998888",
  "base64": "<VALOR>"
}
opcionalValor enviado no corpo: message data.
Base64 é a imagem transformada em um texto longo. Envie só o conteúdo, sem o prefixo "data:image/png;base64,".
AtributosTipoDescrição
tostring
base64string
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/instance/setProfilePictureBase64/<INSTANCE_KEY>" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "to": "5511999998888",
    "base64": "<VALOR>"
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/setProfilePictureBase64/<INSTANCE_KEY>', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "base64": "<VALOR>"
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/setProfilePictureBase64/<INSTANCE_KEY>', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "base64": "<VALOR>"
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to change profile photo by base64. On confirm, the backend must call POST /rest/instance/setProfilePictureBase64/{instance_key} on megaAPI using the configured instance and the securely stored token. Swaps the profile photo by sending the image itself converted to text (Base64). Use it when the image is on your server and you have no public link for it. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "to": "5511999998888",
    "base64": "<VALOR>"
  }
}
Claude Code
Implement a TypeScript function called instance_instance_key-19 that calls POST https://apibusiness1.megaapi.com.br/rest/instance/setProfilePictureBase64/<INSTANCE_KEY> with Authorization Bearer <YOUR_TOKEN>. Swaps the profile photo by sending the image itself converted to text (Base64). Use it when the image is on your server and you have no public link for it. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "to": "5511999998888",
    "base64": "<VALOR>"
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the instance.instance_key-19 integration in a Node.js service. Swaps the profile photo by sending the image itself converted to text (Base64). Use it when the image is on your server and you have no public link for it."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/instance/setProfilePictureBase64/<INSTANCE_KEY>",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "to": "5511999998888",
          "base64": "<VALOR>"
        }
      }
    }
  ]
}
Cursor
In the current project, implement the instance_instance_key-19 client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/instance/setProfilePictureBase64/<INSTANCE_KEY>. Swaps the profile photo by sending the image itself converted to text (Base64). Use it when the image is on your server and you have no public link for it. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "to": "5511999998888",
    "base64": "<VALOR>"
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/instance/setProfilePictureBase64/<INSTANCE_KEY>. Auth: Bearer <YOUR_TOKEN>. Swaps the profile photo by sending the image itself converted to text (Base64). Use it when the image is on your server and you have no public link for it. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "to": "5511999998888",
    "base64": "<VALOR>"
  }
}
GETInstânciaBusinesstestado na API real

Listar conversas

Lista todas as conversas da instância, incluindo chats privados e em grupos. É aqui que você obtém o identificador de cada conversa, usado pela maioria dos outros endpoints.

GEThttps://{seu_host}/rest/instance/chats/{instance_key}

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
curl
curl -X GET "https://apibusiness1.megaapi.com.br/rest/instance/chats/<INSTANCE_KEY>" \
  -H "Authorization: Bearer <SEU_TOKEN>"
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/chats/<INSTANCE_KEY>', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' },
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/chats/<INSTANCE_KEY>', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' }
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to list conversations. On confirm, the backend must call GET /rest/instance/chats/{instance_key} on megaAPI using the configured instance and the securely stored token. Lists all conversations on the instance, private and group chats. This is where you get each conversation identifier, used by most other endpoints. Show loading, success, and error states; do not expose the token in the browser. Example data: no JSON body
Claude Code
Implement a TypeScript function called instance_instance_key-2 that calls GET https://apibusiness1.megaapi.com.br/rest/instance/chats/<INSTANCE_KEY> with Authorization Bearer <YOUR_TOKEN>. Lists all conversations on the instance, private and group chats. This is where you get each conversation identifier, used by most other endpoints. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: no JSON body
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the instance.instance_key-2 integration in a Node.js service. Lists all conversations on the instance, private and group chats. This is where you get each conversation identifier, used by most other endpoints."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "GET",
      "url": "GET https://apibusiness1.megaapi.com.br/rest/instance/chats/<INSTANCE_KEY>",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": null
    }
  ]
}
Cursor
In the current project, implement the instance_instance_key-2 client in TypeScript for GET https://apibusiness1.megaapi.com.br/rest/instance/chats/<INSTANCE_KEY>. Lists all conversations on the instance, private and group chats. This is where you get each conversation identifier, used by most other endpoints. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: no JSON body
Codex
Create a TypeScript function for GET https://apibusiness1.megaapi.com.br/rest/instance/chats/<INSTANCE_KEY>. Auth: Bearer <YOUR_TOKEN>. Lists all conversations on the instance, private and group chats. This is where you get each conversation identifier, used by most other endpoints. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: no JSON body
GETInstânciaBusinessStartNoCodetestado na API real

Verificar número no WhatsApp

Verifica se um número realmente existe no WhatsApp antes de tentar contatá-lo. Evita desperdiçar um envio em um número inválido ou digitado errado.

GEThttps://{seu_host}/rest/instance/isOnWhatsApp/{instance_key}?jid=<VALOR>

Disponível em mais de um plano — troque o host conforme a sua instância:

Business: apibusiness1.megaapi.com.brStart: apistart01.megaapi.com.br / apistart02.megaapi.com.br / apistart03.megaapi.com.brNoCode: apinocode01.megaapi.com.br / apinocode02.megaapi.com.br
CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
jidquerystring"<VALOR>"opcionalFiltro ou opção da consulta: jid.
Número a verificar, com DDI+DDD e só dígitos. Ex.: 5511999998888. Aqui não é ID de grupo.
curl
curl -X GET "https://apibusiness1.megaapi.com.br/rest/instance/isOnWhatsApp/<INSTANCE_KEY>?jid=<VALOR>" \
  -H "Authorization: Bearer <SEU_TOKEN>"
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/isOnWhatsApp/<INSTANCE_KEY>?jid=<VALOR>', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' },
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/isOnWhatsApp/<INSTANCE_KEY>?jid=<VALOR>', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' }
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to check number on whatsapp. On confirm, the backend must call GET /rest/instance/isOnWhatsApp/{instance_key} on megaAPI using the configured instance and the securely stored token. Checks whether a number actually exists on WhatsApp before you try to contact it. Avoids wasting a send on an invalid or mistyped number. Show loading, success, and error states; do not expose the token in the browser. Example data: no JSON body
Claude Code
Implement a TypeScript function called instance_instance_key-20 that calls GET https://apibusiness1.megaapi.com.br/rest/instance/isOnWhatsApp/<INSTANCE_KEY>?jid=<VALOR> with Authorization Bearer <YOUR_TOKEN>. Checks whether a number actually exists on WhatsApp before you try to contact it. Avoids wasting a send on an invalid or mistyped number. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: no JSON body
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the instance.instance_key-20 integration in a Node.js service. Checks whether a number actually exists on WhatsApp before you try to contact it. Avoids wasting a send on an invalid or mistyped number."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "GET",
      "url": "GET https://apibusiness1.megaapi.com.br/rest/instance/isOnWhatsApp/<INSTANCE_KEY>?jid=<VALOR>",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": null
    }
  ]
}
Cursor
In the current project, implement the instance_instance_key-20 client in TypeScript for GET https://apibusiness1.megaapi.com.br/rest/instance/isOnWhatsApp/<INSTANCE_KEY>?jid=<VALOR>. Checks whether a number actually exists on WhatsApp before you try to contact it. Avoids wasting a send on an invalid or mistyped number. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: no JSON body
Codex
Create a TypeScript function for GET https://apibusiness1.megaapi.com.br/rest/instance/isOnWhatsApp/<INSTANCE_KEY>?jid=<VALOR>. Auth: Bearer <YOUR_TOKEN>. Checks whether a number actually exists on WhatsApp before you try to contact it. Avoids wasting a send on an invalid or mistyped number. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: no JSON body
GETInstânciaBusinessStartNoCodetestado na API real

Obter QR Code de conexão

Retorna o QR Code que deve ser escaneado pelo celular para conectar o WhatsApp à instância. O código tem validade curta: se ninguém o escanear a tempo, solicite um novo.

GEThttps://{seu_host}/rest/instance/qrcode/{instance_key}

Disponível em mais de um plano — troque o host conforme a sua instância:

Business: apibusiness1.megaapi.com.brStart: apistart01.megaapi.com.br / apistart02.megaapi.com.br / apistart03.megaapi.com.brNoCode: apinocode01.megaapi.com.br / apinocode02.megaapi.com.br
CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
curl
curl -X GET "https://apibusiness1.megaapi.com.br/rest/instance/qrcode/<INSTANCE_KEY>" \
  -H "Authorization: Bearer <SEU_TOKEN>"
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/qrcode/<INSTANCE_KEY>', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' },
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/qrcode/<INSTANCE_KEY>', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' }
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to get connection qr code. On confirm, the backend must call GET /rest/instance/qrcode/{instance_key} on megaAPI using the configured instance and the securely stored token. Returns the QR Code that must be scanned by the phone to connect WhatsApp to the instance. The code is short-lived: if nobody scans it in time, request a new one. Show loading, success, and error states; do not expose the token in the browser. Example data: no JSON body
Claude Code
Implement a TypeScript function called instance_instance_key-21 that calls GET https://apibusiness1.megaapi.com.br/rest/instance/qrcode/<INSTANCE_KEY> with Authorization Bearer <YOUR_TOKEN>. Returns the QR Code that must be scanned by the phone to connect WhatsApp to the instance. The code is short-lived: if nobody scans it in time, request a new one. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: no JSON body
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the instance.instance_key-21 integration in a Node.js service. Returns the QR Code that must be scanned by the phone to connect WhatsApp to the instance. The code is short-lived: if nobody scans it in time, request a new one."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "GET",
      "url": "GET https://apibusiness1.megaapi.com.br/rest/instance/qrcode/<INSTANCE_KEY>",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": null
    }
  ]
}
Cursor
In the current project, implement the instance_instance_key-21 client in TypeScript for GET https://apibusiness1.megaapi.com.br/rest/instance/qrcode/<INSTANCE_KEY>. Returns the QR Code that must be scanned by the phone to connect WhatsApp to the instance. The code is short-lived: if nobody scans it in time, request a new one. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: no JSON body
Codex
Create a TypeScript function for GET https://apibusiness1.megaapi.com.br/rest/instance/qrcode/<INSTANCE_KEY>. Auth: Bearer <YOUR_TOKEN>. Returns the QR Code that must be scanned by the phone to connect WhatsApp to the instance. The code is short-lived: if nobody scans it in time, request a new one. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: no JSON body
GETInstânciaBusinessStartNoCodetestado na API real

Obter QR Code como imagem

O mesmo QR Code de conexão, já entregue como imagem pronta. Use quando quiser exibir o código diretamente na tela sem precisar desenhá-lo você mesmo.

GEThttps://{seu_host}/rest/instance/qrcode-img/{instance_key}

Disponível em mais de um plano — troque o host conforme a sua instância:

Business: apibusiness1.megaapi.com.brStart: apistart01.megaapi.com.br / apistart02.megaapi.com.br / apistart03.megaapi.com.brNoCode: apinocode01.megaapi.com.br / apinocode02.megaapi.com.br
CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
curl
curl -X GET "https://apibusiness1.megaapi.com.br/rest/instance/qrcode-img/<INSTANCE_KEY>" \
  -H "Authorization: Bearer <SEU_TOKEN>"
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/qrcode-img/<INSTANCE_KEY>', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' },
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/qrcode-img/<INSTANCE_KEY>', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' }
});
console.log(await response.json());
HTTP 200
{
  "error": false,
  "message": "QR code da instancia (imagem PNG)",
  "data": "<base64 do PNG — image/png>"
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to get qr code as image. On confirm, the backend must call GET /rest/instance/qrcode-img/{instance_key} on megaAPI using the configured instance and the securely stored token. The same connection QR Code, already delivered as a ready-made image. Use it when you want to show the code directly on screen without having to draw it yourself. Show loading, success, and error states; do not expose the token in the browser. Example data: no JSON body
Claude Code
Implement a TypeScript function called instance_instance_key-22 that calls GET https://apibusiness1.megaapi.com.br/rest/instance/qrcode-img/<INSTANCE_KEY> with Authorization Bearer <YOUR_TOKEN>. The same connection QR Code, already delivered as a ready-made image. Use it when you want to show the code directly on screen without having to draw it yourself. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: no JSON body
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the instance.instance_key-22 integration in a Node.js service. The same connection QR Code, already delivered as a ready-made image. Use it when you want to show the code directly on screen without having to draw it yourself."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "GET",
      "url": "GET https://apibusiness1.megaapi.com.br/rest/instance/qrcode-img/<INSTANCE_KEY>",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": null
    }
  ]
}
Cursor
In the current project, implement the instance_instance_key-22 client in TypeScript for GET https://apibusiness1.megaapi.com.br/rest/instance/qrcode-img/<INSTANCE_KEY>. The same connection QR Code, already delivered as a ready-made image. Use it when you want to show the code directly on screen without having to draw it yourself. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: no JSON body
Codex
Create a TypeScript function for GET https://apibusiness1.megaapi.com.br/rest/instance/qrcode-img/<INSTANCE_KEY>. Auth: Bearer <YOUR_TOKEN>. The same connection QR Code, already delivered as a ready-made image. Use it when you want to show the code directly on screen without having to draw it yourself. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: no JSON body
GETInstânciaBusinessStartNoCodetestado na API real

Obter QR Code como Base64

Retorna o QR Code como texto Base64, um formato que você pode inserir diretamente em uma tag de imagem em uma página. A forma mais prática de montar sua própria tela de conexão.

GEThttps://{seu_host}/rest/instance/qrcode_base64/{instance_key}

Disponível em mais de um plano — troque o host conforme a sua instância:

Business: apibusiness1.megaapi.com.brStart: apistart01.megaapi.com.br / apistart02.megaapi.com.br / apistart03.megaapi.com.brNoCode: apinocode01.megaapi.com.br / apinocode02.megaapi.com.br
CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
curl
curl -X GET "https://apibusiness1.megaapi.com.br/rest/instance/qrcode_base64/<INSTANCE_KEY>" \
  -H "Authorization: Bearer <SEU_TOKEN>"
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/qrcode_base64/<INSTANCE_KEY>', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' },
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/qrcode_base64/<INSTANCE_KEY>', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' }
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to get qr code as base64. On confirm, the backend must call GET /rest/instance/qrcode_base64/{instance_key} on megaAPI using the configured instance and the securely stored token. Returns the QR Code as Base64 text, a format you can drop straight into an image tag on a page. The most practical way to build your own connection screen. Show loading, success, and error states; do not expose the token in the browser. Example data: no JSON body
Claude Code
Implement a TypeScript function called instance_instance_key-23 that calls GET https://apibusiness1.megaapi.com.br/rest/instance/qrcode_base64/<INSTANCE_KEY> with Authorization Bearer <YOUR_TOKEN>. Returns the QR Code as Base64 text, a format you can drop straight into an image tag on a page. The most practical way to build your own connection screen. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: no JSON body
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the instance.instance_key-23 integration in a Node.js service. Returns the QR Code as Base64 text, a format you can drop straight into an image tag on a page. The most practical way to build your own connection screen."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "GET",
      "url": "GET https://apibusiness1.megaapi.com.br/rest/instance/qrcode_base64/<INSTANCE_KEY>",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": null
    }
  ]
}
Cursor
In the current project, implement the instance_instance_key-23 client in TypeScript for GET https://apibusiness1.megaapi.com.br/rest/instance/qrcode_base64/<INSTANCE_KEY>. Returns the QR Code as Base64 text, a format you can drop straight into an image tag on a page. The most practical way to build your own connection screen. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: no JSON body
Codex
Create a TypeScript function for GET https://apibusiness1.megaapi.com.br/rest/instance/qrcode_base64/<INSTANCE_KEY>. Auth: Bearer <YOUR_TOKEN>. Returns the QR Code as Base64 text, a format you can drop straight into an image tag on a page. The most practical way to build your own connection screen. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: no JSON body
GETInstânciaBusinessStartNoCodetestado na API real

Obter código de pareamento

Alternativa ao QR Code: gera um código que a pessoa digita no próprio WhatsApp para conectar. Útil quando apontar a câmera do celular para outra tela não é uma opção.

GEThttps://{seu_host}/rest/instance/pairingCode/{instance_key}?phoneNumber=5511999998888&customPairingCode=<VALOR>

Disponível em mais de um plano — troque o host conforme a sua instância:

Business: apibusiness1.megaapi.com.brStart: apistart01.megaapi.com.br / apistart02.megaapi.com.br / apistart03.megaapi.com.brNoCode: apinocode01.megaapi.com.br / apinocode02.megaapi.com.br
CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
phoneNumberquerystring"5511999998888"opcionalFiltro ou opção da consulta: phone number.
Número que vai ser conectado, com DDI+DDD e só dígitos. Ex.: 5511999998888.
customPairingCodequerystring"<VALOR>"opcionalFiltro ou opção da consulta: custom pairing code.
Opcional: use para escolher você mesmo o código em vez de receber um sorteado.
curl
curl -X GET "https://apibusiness1.megaapi.com.br/rest/instance/pairingCode/<INSTANCE_KEY>?phoneNumber=5511999998888&customPairingCode=<VALOR>" \
  -H "Authorization: Bearer <SEU_TOKEN>"
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/pairingCode/<INSTANCE_KEY>?phoneNumber=5511999998888&customPairingCode=<VALOR>', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' },
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/pairingCode/<INSTANCE_KEY>?phoneNumber=5511999998888&customPairingCode=<VALOR>', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' }
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to get pairing code. On confirm, the backend must call GET /rest/instance/pairingCode/{instance_key} on megaAPI using the configured instance and the securely stored token. Alternative to the QR Code: generates a code the person types in their own WhatsApp to connect. Useful when pointing the phone camera at another screen is not an option. Show loading, success, and error states; do not expose the token in the browser. Example data: no JSON body
Claude Code
Implement a TypeScript function called instance_instance_key-24 that calls GET https://apibusiness1.megaapi.com.br/rest/instance/pairingCode/<INSTANCE_KEY>?phoneNumber=5511999998888&customPairingCode=<VALOR> with Authorization Bearer <YOUR_TOKEN>. Alternative to the QR Code: generates a code the person types in their own WhatsApp to connect. Useful when pointing the phone camera at another screen is not an option. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: no JSON body
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the instance.instance_key-24 integration in a Node.js service. Alternative to the QR Code: generates a code the person types in their own WhatsApp to connect. Useful when pointing the phone camera at another screen is not an option."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "GET",
      "url": "GET https://apibusiness1.megaapi.com.br/rest/instance/pairingCode/<INSTANCE_KEY>?phoneNumber=5511999998888&customPairingCode=<VALOR>",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": null
    }
  ]
}
Cursor
In the current project, implement the instance_instance_key-24 client in TypeScript for GET https://apibusiness1.megaapi.com.br/rest/instance/pairingCode/<INSTANCE_KEY>?phoneNumber=5511999998888&customPairingCode=<VALOR>. Alternative to the QR Code: generates a code the person types in their own WhatsApp to connect. Useful when pointing the phone camera at another screen is not an option. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: no JSON body
Codex
Create a TypeScript function for GET https://apibusiness1.megaapi.com.br/rest/instance/pairingCode/<INSTANCE_KEY>?phoneNumber=5511999998888&customPairingCode=<VALOR>. Auth: Bearer <YOUR_TOKEN>. Alternative to the QR Code: generates a code the person types in their own WhatsApp to connect. Useful when pointing the phone camera at another screen is not an option. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: no JSON body
GETInstânciaBusinesstestado na API real

Listar mensagens de uma conversa

Retorna o histórico de mensagens de uma conversa específica. Informe a conversa em `chat_id`; sem isso a API não tem como saber de onde buscar.

GEThttps://{seu_host}/rest/instance/messages/{instance_key}?chat_id=[email protected]

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
chat_idquerystring"[email protected]"opcionalFiltro ou opção da consulta: chat id.
Identificador da conversa: [email protected] para pessoa, ou o ID terminado em @g.us para grupo. Pegue na lista de conversas.
curl
curl -X GET "https://apibusiness1.megaapi.com.br/rest/instance/messages/<INSTANCE_KEY>[email protected]" \
  -H "Authorization: Bearer <SEU_TOKEN>"
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/messages/<INSTANCE_KEY>[email protected]', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' },
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/messages/<INSTANCE_KEY>[email protected]', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' }
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to list conversation messages. On confirm, the backend must call GET /rest/instance/messages/{instance_key} on megaAPI using the configured instance and the securely stored token. Returns the message history of a specific conversation. Pass the conversation in `chat_id`; without it the API has no way of knowing where to fetch from. Show loading, success, and error states; do not expose the token in the browser. Example data: no JSON body
Claude Code
Implement a TypeScript function called instance_instance_key-3 that calls GET https://apibusiness1.megaapi.com.br/rest/instance/messages/<INSTANCE_KEY>[email protected] with Authorization Bearer <YOUR_TOKEN>. Returns the message history of a specific conversation. Pass the conversation in `chat_id`; without it the API has no way of knowing where to fetch from. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: no JSON body
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the instance.instance_key-3 integration in a Node.js service. Returns the message history of a specific conversation. Pass the conversation in `chat_id`; without it the API has no way of knowing where to fetch from."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "GET",
      "url": "GET https://apibusiness1.megaapi.com.br/rest/instance/messages/<INSTANCE_KEY>[email protected]",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": null
    }
  ]
}
Cursor
In the current project, implement the instance_instance_key-3 client in TypeScript for GET https://apibusiness1.megaapi.com.br/rest/instance/messages/<INSTANCE_KEY>[email protected]. Returns the message history of a specific conversation. Pass the conversation in `chat_id`; without it the API has no way of knowing where to fetch from. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: no JSON body
Codex
Create a TypeScript function for GET https://apibusiness1.megaapi.com.br/rest/instance/messages/<INSTANCE_KEY>[email protected]. Auth: Bearer <YOUR_TOKEN>. Returns the message history of a specific conversation. Pass the conversation in `chat_id`; without it the API has no way of knowing where to fetch from. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: no JSON body
GETInstânciaBusinessStartNoCodetestado na API real

Listar contatos

Retorna todos os contatos visíveis para o WhatsApp conectado à instância. Use para montar uma agenda telefônica dentro do seu próprio sistema.

GEThttps://{seu_host}/rest/instance/contacts/{instance_key}

Disponível em mais de um plano — troque o host conforme a sua instância:

Business: apibusiness1.megaapi.com.brStart: apistart01.megaapi.com.br / apistart02.megaapi.com.br / apistart03.megaapi.com.brNoCode: apinocode01.megaapi.com.br / apinocode02.megaapi.com.br
CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
curl
curl -X GET "https://apibusiness1.megaapi.com.br/rest/instance/contacts/<INSTANCE_KEY>" \
  -H "Authorization: Bearer <SEU_TOKEN>"
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/contacts/<INSTANCE_KEY>', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' },
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/contacts/<INSTANCE_KEY>', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' }
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to list contacts. On confirm, the backend must call GET /rest/instance/contacts/{instance_key} on megaAPI using the configured instance and the securely stored token. Returns every contact visible to the WhatsApp connected to the instance. Use it to build an address book inside your own system. Show loading, success, and error states; do not expose the token in the browser. Example data: no JSON body
Claude Code
Implement a TypeScript function called instance_instance_key-4 that calls GET https://apibusiness1.megaapi.com.br/rest/instance/contacts/<INSTANCE_KEY> with Authorization Bearer <YOUR_TOKEN>. Returns every contact visible to the WhatsApp connected to the instance. Use it to build an address book inside your own system. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: no JSON body
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the instance.instance_key-4 integration in a Node.js service. Returns every contact visible to the WhatsApp connected to the instance. Use it to build an address book inside your own system."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "GET",
      "url": "GET https://apibusiness1.megaapi.com.br/rest/instance/contacts/<INSTANCE_KEY>",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": null
    }
  ]
}
Cursor
In the current project, implement the instance_instance_key-4 client in TypeScript for GET https://apibusiness1.megaapi.com.br/rest/instance/contacts/<INSTANCE_KEY>. Returns every contact visible to the WhatsApp connected to the instance. Use it to build an address book inside your own system. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: no JSON body
Codex
Create a TypeScript function for GET https://apibusiness1.megaapi.com.br/rest/instance/contacts/<INSTANCE_KEY>. Auth: Bearer <YOUR_TOKEN>. Returns every contact visible to the WhatsApp connected to the instance. Use it to build an address book inside your own system. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: no JSON body
GETInstânciaBusinessStartNoCodetestado na API real

Mapear identificadores e números de telefone

Mostra o mapeamento entre o identificador interno que o WhatsApp usa para cada pessoa (LID) e o número de telefone dela (PN). Use quando chegar uma mensagem com um identificador que você não reconhece como número de telefone.

GEThttps://{seu_host}/rest/instance/lidPnMapping/{instance_key}

Disponível em mais de um plano — troque o host conforme a sua instância:

Business: apibusiness1.megaapi.com.brStart: apistart01.megaapi.com.br / apistart02.megaapi.com.br / apistart03.megaapi.com.brNoCode: apinocode01.megaapi.com.br / apinocode02.megaapi.com.br
CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
curl
curl -X GET "https://apibusiness1.megaapi.com.br/rest/instance/lidPnMapping/<INSTANCE_KEY>" \
  -H "Authorization: Bearer <SEU_TOKEN>"
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/lidPnMapping/<INSTANCE_KEY>', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' },
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/lidPnMapping/<INSTANCE_KEY>', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' }
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to map identifiers and phone numbers. On confirm, the backend must call GET /rest/instance/lidPnMapping/{instance_key} on megaAPI using the configured instance and the securely stored token. Shows the mapping between the internal identifier WhatsApp uses for each person (LID) and their phone number (PN). Use when a message arrives with an identifier you do not recognize as a phone number. Show loading, success, and error states; do not expose the token in the browser. Example data: no JSON body
Claude Code
Implement a TypeScript function called instance_instance_key-5 that calls GET https://apibusiness1.megaapi.com.br/rest/instance/lidPnMapping/<INSTANCE_KEY> with Authorization Bearer <YOUR_TOKEN>. Shows the mapping between the internal identifier WhatsApp uses for each person (LID) and their phone number (PN). Use when a message arrives with an identifier you do not recognize as a phone number. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: no JSON body
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the instance.instance_key-5 integration in a Node.js service. Shows the mapping between the internal identifier WhatsApp uses for each person (LID) and their phone number (PN). Use when a message arrives with an identifier you do not recognize as a phone number."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "GET",
      "url": "GET https://apibusiness1.megaapi.com.br/rest/instance/lidPnMapping/<INSTANCE_KEY>",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": null
    }
  ]
}
Cursor
In the current project, implement the instance_instance_key-5 client in TypeScript for GET https://apibusiness1.megaapi.com.br/rest/instance/lidPnMapping/<INSTANCE_KEY>. Shows the mapping between the internal identifier WhatsApp uses for each person (LID) and their phone number (PN). Use when a message arrives with an identifier you do not recognize as a phone number. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: no JSON body
Codex
Create a TypeScript function for GET https://apibusiness1.megaapi.com.br/rest/instance/lidPnMapping/<INSTANCE_KEY>. Auth: Bearer <YOUR_TOKEN>. Shows the mapping between the internal identifier WhatsApp uses for each person (LID) and their phone number (PN). Use when a message arrives with an identifier you do not recognize as a phone number. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: no JSON body
POSTInstânciaBusinesstestado na API real

Remover contato

Exclui um contato da agenda de contatos do WhatsApp conectado. A remoção não pode ser desfeita aqui: para recuperar o contato é necessário adicioná-lo novamente. Conversas antigas com esse número permanecem.

POSThttps://{seu_host}/rest/instance/removeContact/{instance_key}

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
tobodystring"5511999998888"opcionalValor enviado no corpo: to.
Número do contato com DDI+DDD, só dígitos. Ex.: 5511999998888. Nunca use +, espaço ou traço.
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/instance/removeContact/<INSTANCE_KEY>" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "to": "5511999998888"
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/removeContact/<INSTANCE_KEY>', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "to": "5511999998888"
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/removeContact/<INSTANCE_KEY>', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "to": "5511999998888"
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to remove contact. On confirm, the backend must call POST /rest/instance/removeContact/{instance_key} on megaAPI using the configured instance and the securely stored token. Deletes a contact from the connected WhatsApp's address book. The removal cannot be undone here: to get the contact back you have to add them again. Old conversations with that number remain. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "to": "5511999998888"
}
Claude Code
Implement a TypeScript function called instance_instance_key-6 that calls POST https://apibusiness1.megaapi.com.br/rest/instance/removeContact/<INSTANCE_KEY> with Authorization Bearer <YOUR_TOKEN>. Deletes a contact from the connected WhatsApp's address book. The removal cannot be undone here: to get the contact back you have to add them again. Old conversations with that number remain. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "to": "5511999998888"
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the instance.instance_key-6 integration in a Node.js service. Deletes a contact from the connected WhatsApp's address book. The removal cannot be undone here: to get the contact back you have to add them again. Old conversations with that number remain."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/instance/removeContact/<INSTANCE_KEY>",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "to": "5511999998888"
      }
    }
  ]
}
Cursor
In the current project, implement the instance_instance_key-6 client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/instance/removeContact/<INSTANCE_KEY>. Deletes a contact from the connected WhatsApp's address book. The removal cannot be undone here: to get the contact back you have to add them again. Old conversations with that number remain. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "to": "5511999998888"
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/instance/removeContact/<INSTANCE_KEY>. Auth: Bearer <YOUR_TOKEN>. Deletes a contact from the connected WhatsApp's address book. The removal cannot be undone here: to get the contact back you have to add them again. Old conversations with that number remain. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "to": "5511999998888"
}
GETInstânciaBusinesstestado na API real

Listar etiquetas

Lista as etiquetas (as tags coloridas do WhatsApp Business) criadas nesta conta.

GEThttps://{seu_host}/rest/instance/labels/{instance_key}

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
curl
curl -X GET "https://apibusiness1.megaapi.com.br/rest/instance/labels/<INSTANCE_KEY>" \
  -H "Authorization: Bearer <SEU_TOKEN>"
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/labels/<INSTANCE_KEY>', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' },
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/labels/<INSTANCE_KEY>', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' }
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to list labels. On confirm, the backend must call GET /rest/instance/labels/{instance_key} on megaAPI using the configured instance and the securely stored token. Lists the labels (the colored tags from WhatsApp Business) created in this account. Show loading, success, and error states; do not expose the token in the browser. Example data: no JSON body
Claude Code
Implement a TypeScript function called instance_instance_key-7 that calls GET https://apibusiness1.megaapi.com.br/rest/instance/labels/<INSTANCE_KEY> with Authorization Bearer <YOUR_TOKEN>. Lists the labels (the colored tags from WhatsApp Business) created in this account. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: no JSON body
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the instance.instance_key-7 integration in a Node.js service. Lists the labels (the colored tags from WhatsApp Business) created in this account."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "GET",
      "url": "GET https://apibusiness1.megaapi.com.br/rest/instance/labels/<INSTANCE_KEY>",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": null
    }
  ]
}
Cursor
In the current project, implement the instance_instance_key-7 client in TypeScript for GET https://apibusiness1.megaapi.com.br/rest/instance/labels/<INSTANCE_KEY>. Lists the labels (the colored tags from WhatsApp Business) created in this account. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: no JSON body
Codex
Create a TypeScript function for GET https://apibusiness1.megaapi.com.br/rest/instance/labels/<INSTANCE_KEY>. Auth: Bearer <YOUR_TOKEN>. Lists the labels (the colored tags from WhatsApp Business) created in this account. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: no JSON body
GETInstânciaBusinesstestado na API real

Listar etiquetas aplicadas

Mostra quais etiquetas estão aplicadas a quais conversas. A lista de etiquetas diz o que existe; esta diz onde cada uma está sendo usada.

GEThttps://{seu_host}/rest/instance/labelAssociations/{instance_key}

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
curl
curl -X GET "https://apibusiness1.megaapi.com.br/rest/instance/labelAssociations/<INSTANCE_KEY>" \
  -H "Authorization: Bearer <SEU_TOKEN>"
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/labelAssociations/<INSTANCE_KEY>', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' },
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/labelAssociations/<INSTANCE_KEY>', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' }
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to list applied labels. On confirm, the backend must call GET /rest/instance/labelAssociations/{instance_key} on megaAPI using the configured instance and the securely stored token. Shows which labels are attached to which conversations. The labels list tells you what exists; this one tells you where each one is being used. Show loading, success, and error states; do not expose the token in the browser. Example data: no JSON body
Claude Code
Implement a TypeScript function called instance_instance_key-8 that calls GET https://apibusiness1.megaapi.com.br/rest/instance/labelAssociations/<INSTANCE_KEY> with Authorization Bearer <YOUR_TOKEN>. Shows which labels are attached to which conversations. The labels list tells you what exists; this one tells you where each one is being used. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: no JSON body
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the instance.instance_key-8 integration in a Node.js service. Shows which labels are attached to which conversations. The labels list tells you what exists; this one tells you where each one is being used."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "GET",
      "url": "GET https://apibusiness1.megaapi.com.br/rest/instance/labelAssociations/<INSTANCE_KEY>",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": null
    }
  ]
}
Cursor
In the current project, implement the instance_instance_key-8 client in TypeScript for GET https://apibusiness1.megaapi.com.br/rest/instance/labelAssociations/<INSTANCE_KEY>. Shows which labels are attached to which conversations. The labels list tells you what exists; this one tells you where each one is being used. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: no JSON body
Codex
Create a TypeScript function for GET https://apibusiness1.megaapi.com.br/rest/instance/labelAssociations/<INSTANCE_KEY>. Auth: Bearer <YOUR_TOKEN>. Shows which labels are attached to which conversations. The labels list tells you what exists; this one tells you where each one is being used. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: no JSON body
POSTInstânciaBusinesstestado na API real

Criar etiqueta

Cria uma nova etiqueta na conta do WhatsApp Business, com um nome e uma cor.

POSThttps://{seu_host}/rest/instance/labels/createLabel/{instance_key}

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
databodyobject
JSON
{
  "labelId": "<VALOR>",
  "name": "<VALOR>",
  "color": 1
}
opcionalValor enviado no corpo: data.
`name` é o texto da etiqueta e `color` é o número da cor no padrão do WhatsApp Business.
AtributosTipoDescrição
labelIdstring
namestring
colornumber
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/instance/labels/createLabel/<INSTANCE_KEY>" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "data": {
    "labelId": "<VALOR>",
    "name": "<VALOR>",
    "color": 1
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/labels/createLabel/<INSTANCE_KEY>', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "data": {
    "labelId": "<VALOR>",
    "name": "<VALOR>",
    "color": 1
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/labels/createLabel/<INSTANCE_KEY>', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "data": {
    "labelId": "<VALOR>",
    "name": "<VALOR>",
    "color": 1
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to create label. On confirm, the backend must call POST /rest/instance/labels/createLabel/{instance_key} on megaAPI using the configured instance and the securely stored token. Creates a new label in the WhatsApp Business account, with a name and a color. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "data": {
    "labelId": "<VALOR>",
    "name": "<VALOR>",
    "color": 1
  }
}
Claude Code
Implement a TypeScript function called instance_instance_key-9 that calls POST https://apibusiness1.megaapi.com.br/rest/instance/labels/createLabel/<INSTANCE_KEY> with Authorization Bearer <YOUR_TOKEN>. Creates a new label in the WhatsApp Business account, with a name and a color. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "data": {
    "labelId": "<VALOR>",
    "name": "<VALOR>",
    "color": 1
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the instance.instance_key-9 integration in a Node.js service. Creates a new label in the WhatsApp Business account, with a name and a color."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/instance/labels/createLabel/<INSTANCE_KEY>",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "data": {
          "labelId": "<VALOR>",
          "name": "<VALOR>",
          "color": 1
        }
      }
    }
  ]
}
Cursor
In the current project, implement the instance_instance_key-9 client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/instance/labels/createLabel/<INSTANCE_KEY>. Creates a new label in the WhatsApp Business account, with a name and a color. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "data": {
    "labelId": "<VALOR>",
    "name": "<VALOR>",
    "color": 1
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/instance/labels/createLabel/<INSTANCE_KEY>. Auth: Bearer <YOUR_TOKEN>. Creates a new label in the WhatsApp Business account, with a name and a color. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "data": {
    "labelId": "<VALOR>",
    "name": "<VALOR>",
    "color": 1
  }
}
DELETEInstânciaBusinessStartNoCodetestado na API real

Desconectar a instância

Encerra a sessão do WhatsApp na instância, como se você tocasse em "Desconectar" no celular. Sem desfazer: para voltar a enviar mensagens, é preciso reconectar escaneando um QR Code ou usando um código de pareamento.

DELETEhttps://{seu_host}/rest/instance/{instance_key}/logout

Disponível em mais de um plano — troque o host conforme a sua instância:

Business: apibusiness1.megaapi.com.brStart: apistart01.megaapi.com.br / apistart02.megaapi.com.br / apistart03.megaapi.com.brNoCode: apinocode01.megaapi.com.br / apinocode02.megaapi.com.br
CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
curl
curl -X DELETE "https://apibusiness1.megaapi.com.br/rest/instance/<INSTANCE_KEY>/logout" \
  -H "Authorization: Bearer <SEU_TOKEN>"
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/<INSTANCE_KEY>/logout', {
  method: 'DELETE',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' },
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/<INSTANCE_KEY>/logout', {
  method: 'DELETE',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' }
});
console.log(await response.json());
HTTP 200
{
  "error": false,
  "message": "Instance logged out"
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to disconnect the instance. On confirm, the backend must call DELETE /rest/instance/{instance_key}/logout on megaAPI using the configured instance and the securely stored token. Ends the WhatsApp session on the instance, as if you tapped "Disconnect" on the phone. No undo: to send messages again you must reconnect by scanning a QR Code or using a pairing code. Show loading, success, and error states; do not expose the token in the browser. Example data: no JSON body
Claude Code
Implement a TypeScript function called instance_logout that calls DELETE https://apibusiness1.megaapi.com.br/rest/instance/<INSTANCE_KEY>/logout with Authorization Bearer <YOUR_TOKEN>. Ends the WhatsApp session on the instance, as if you tapped "Disconnect" on the phone. No undo: to send messages again you must reconnect by scanning a QR Code or using a pairing code. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: no JSON body
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the instance.logout integration in a Node.js service. Ends the WhatsApp session on the instance, as if you tapped \"Disconnect\" on the phone. No undo: to send messages again you must reconnect by scanning a QR Code or using a pairing code."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "DELETE",
      "url": "DELETE https://apibusiness1.megaapi.com.br/rest/instance/<INSTANCE_KEY>/logout",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": null
    }
  ]
}
Cursor
In the current project, implement the instance_logout client in TypeScript for DELETE https://apibusiness1.megaapi.com.br/rest/instance/<INSTANCE_KEY>/logout. Ends the WhatsApp session on the instance, as if you tapped "Disconnect" on the phone. No undo: to send messages again you must reconnect by scanning a QR Code or using a pairing code. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: no JSON body
Codex
Create a TypeScript function for DELETE https://apibusiness1.megaapi.com.br/rest/instance/<INSTANCE_KEY>/logout. Auth: Bearer <YOUR_TOKEN>. Ends the WhatsApp session on the instance, as if you tapped "Disconnect" on the phone. No undo: to send messages again you must reconnect by scanning a QR Code or using a pairing code. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: no JSON body
POSTInstânciaBusinesstestado na API real

Adicionar ou editar contato

Cria um novo contato na agenda de contatos do WhatsApp conectado ou atualiza o nome de um contato existente.

POSThttps://{seu_host}/rest/instance/addContact/{instance_key}

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
databodyobject
JSON
{
  "to": "5511999998888",
  "fullName": "<VALOR>",
  "firstName": "<VALOR>",
  "lidJid": "<VALOR>",
  "pnJid": "<VALOR>",
  "username": "<VALOR>",
  "saveOnPrimaryAddressbook": true
}
opcionalValor enviado no corpo: data.
Em `to` vai o número com DDI+DDD, só dígitos; `fullName` e `firstName` são o nome que será salvo na agenda.
AtributosTipoDescrição
tostring
fullNamestring
firstNamestring
lidJidstring
pnJidstring
usernamestring
saveOnPrimaryAddressbookboolean
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/instance/addContact/<INSTANCE_KEY>" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "data": {
    "to": "5511999998888",
    "fullName": "<VALOR>",
    "firstName": "<VALOR>",
    "lidJid": "<VALOR>",
    "pnJid": "<VALOR>",
    "username": "<VALOR>",
    "saveOnPrimaryAddressbook": true
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/addContact/<INSTANCE_KEY>', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "data": {
    "to": "5511999998888",
    "fullName": "<VALOR>",
    "firstName": "<VALOR>",
    "lidJid": "<VALOR>",
    "pnJid": "<VALOR>",
    "username": "<VALOR>",
    "saveOnPrimaryAddressbook": true
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/addContact/<INSTANCE_KEY>', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "data": {
    "to": "5511999998888",
    "fullName": "<VALOR>",
    "firstName": "<VALOR>",
    "lidJid": "<VALOR>",
    "pnJid": "<VALOR>",
    "username": "<VALOR>",
    "saveOnPrimaryAddressbook": true
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to add or edit contact. On confirm, the backend must call POST /rest/instance/addContact/{instance_key} on megaAPI using the configured instance and the securely stored token. Creates a new contact in the connected WhatsApp's address book or updates the name of an existing contact. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "data": {
    "to": "5511999998888",
    "fullName": "<VALOR>",
    "firstName": "<VALOR>",
    "lidJid": "<VALOR>",
    "pnJid": "<VALOR>",
    "username": "<VALOR>",
    "saveOnPrimaryAddressbook": true
  }
}
Claude Code
Implement a TypeScript function called instance_post_instance_key that calls POST https://apibusiness1.megaapi.com.br/rest/instance/addContact/<INSTANCE_KEY> with Authorization Bearer <YOUR_TOKEN>. Creates a new contact in the connected WhatsApp's address book or updates the name of an existing contact. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "data": {
    "to": "5511999998888",
    "fullName": "<VALOR>",
    "firstName": "<VALOR>",
    "lidJid": "<VALOR>",
    "pnJid": "<VALOR>",
    "username": "<VALOR>",
    "saveOnPrimaryAddressbook": true
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the instance.post.instance_key integration in a Node.js service. Creates a new contact in the connected WhatsApp's address book or updates the name of an existing contact."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/instance/addContact/<INSTANCE_KEY>",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "data": {
          "to": "5511999998888",
          "fullName": "<VALOR>",
          "firstName": "<VALOR>",
          "lidJid": "<VALOR>",
          "pnJid": "<VALOR>",
          "username": "<VALOR>",
          "saveOnPrimaryAddressbook": true
        }
      }
    }
  ]
}
Cursor
In the current project, implement the instance_post_instance_key client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/instance/addContact/<INSTANCE_KEY>. Creates a new contact in the connected WhatsApp's address book or updates the name of an existing contact. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "data": {
    "to": "5511999998888",
    "fullName": "<VALOR>",
    "firstName": "<VALOR>",
    "lidJid": "<VALOR>",
    "pnJid": "<VALOR>",
    "username": "<VALOR>",
    "saveOnPrimaryAddressbook": true
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/instance/addContact/<INSTANCE_KEY>. Auth: Bearer <YOUR_TOKEN>. Creates a new contact in the connected WhatsApp's address book or updates the name of an existing contact. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "data": {
    "to": "5511999998888",
    "fullName": "<VALOR>",
    "firstName": "<VALOR>",
    "lidJid": "<VALOR>",
    "pnJid": "<VALOR>",
    "username": "<VALOR>",
    "saveOnPrimaryAddressbook": true
  }
}
DELETEInstânciaBusinessStartNoCodetestado na API real

Reiniciar a instância

Reinicia a conexão da instância sem desconectar a conta do WhatsApp. Use quando a instância travar ou parar de responder. Ela fica indisponível por alguns momentos durante a reinicialização.

DELETEhttps://{seu_host}/rest/instance/{instance_key}/restart

Disponível em mais de um plano — troque o host conforme a sua instância:

Business: apibusiness1.megaapi.com.brStart: apistart01.megaapi.com.br / apistart02.megaapi.com.br / apistart03.megaapi.com.brNoCode: apinocode01.megaapi.com.br / apinocode02.megaapi.com.br
CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
curl
curl -X DELETE "https://apibusiness1.megaapi.com.br/rest/instance/<INSTANCE_KEY>/restart" \
  -H "Authorization: Bearer <SEU_TOKEN>"
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/<INSTANCE_KEY>/restart', {
  method: 'DELETE',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' },
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/instance/<INSTANCE_KEY>/restart', {
  method: 'DELETE',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' }
});
console.log(await response.json());
HTTP 200
{
  "error": false,
  "message": "Instance restarted"
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to restart the instance. On confirm, the backend must call DELETE /rest/instance/{instance_key}/restart on megaAPI using the configured instance and the securely stored token. Restarts the instance connection without disconnecting the WhatsApp account. Use when the instance froze or stopped responding. It stays unavailable for a few moments during the restart. Show loading, success, and error states; do not expose the token in the browser. Example data: no JSON body
Claude Code
Implement a TypeScript function called instance_restart that calls DELETE https://apibusiness1.megaapi.com.br/rest/instance/<INSTANCE_KEY>/restart with Authorization Bearer <YOUR_TOKEN>. Restarts the instance connection without disconnecting the WhatsApp account. Use when the instance froze or stopped responding. It stays unavailable for a few moments during the restart. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: no JSON body
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the instance.restart integration in a Node.js service. Restarts the instance connection without disconnecting the WhatsApp account. Use when the instance froze or stopped responding. It stays unavailable for a few moments during the restart."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "DELETE",
      "url": "DELETE https://apibusiness1.megaapi.com.br/rest/instance/<INSTANCE_KEY>/restart",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": null
    }
  ]
}
Cursor
In the current project, implement the instance_restart client in TypeScript for DELETE https://apibusiness1.megaapi.com.br/rest/instance/<INSTANCE_KEY>/restart. Restarts the instance connection without disconnecting the WhatsApp account. Use when the instance froze or stopped responding. It stays unavailable for a few moments during the restart. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: no JSON body
Codex
Create a TypeScript function for DELETE https://apibusiness1.megaapi.com.br/rest/instance/<INSTANCE_KEY>/restart. Auth: Bearer <YOUR_TOKEN>. Restarts the instance connection without disconnecting the WhatsApp account. Use when the instance froze or stopped responding. It stays unavailable for a few moments during the restart. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: no JSON body
POSTPrivacidadeBusinesstestado na API real

Ativar mensagens temporárias

Ativa o modo em que as mensagens desaparecem sozinhas depois de um tempo na conversa. Enquanto ligado, as mensagens são apagadas no temporizador escolhido e não voltam.

POSThttps://{seu_host}/rest/privacy/{instance_key}/disappearingMode

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "to": "5511999998888",
  "duration": 604800
}
opcionalValor enviado no corpo: message data.
`to` é a conversa e `duration` é o prazo em segundos até a mensagem sumir. Ex.: 604800 = 7 dias, 86400 = 24 horas.
AtributosTipoDescrição
tostring
durationnumber
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/disappearingMode" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "to": "5511999998888",
    "duration": 604800
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/disappearingMode', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "duration": 604800
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/disappearingMode', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "duration": 604800
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to enable disappearing messages. On confirm, the backend must call POST /rest/privacy/{instance_key}/disappearingMode on megaAPI using the configured instance and the securely stored token. Turns on the mode where messages disappear by themselves after a while in a conversation. While on, messages are deleted at the chosen timer and do not come back. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "to": "5511999998888",
    "duration": 604800
  }
}
Claude Code
Implement a TypeScript function called privacy_disappearingMode that calls POST https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/disappearingMode with Authorization Bearer <YOUR_TOKEN>. Turns on the mode where messages disappear by themselves after a while in a conversation. While on, messages are deleted at the chosen timer and do not come back. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "to": "5511999998888",
    "duration": 604800
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the privacy.disappearingMode integration in a Node.js service. Turns on the mode where messages disappear by themselves after a while in a conversation. While on, messages are deleted at the chosen timer and do not come back."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/disappearingMode",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "to": "5511999998888",
          "duration": 604800
        }
      }
    }
  ]
}
Cursor
In the current project, implement the privacy_disappearingMode client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/disappearingMode. Turns on the mode where messages disappear by themselves after a while in a conversation. While on, messages are deleted at the chosen timer and do not come back. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "to": "5511999998888",
    "duration": 604800
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/disappearingMode. Auth: Bearer <YOUR_TOKEN>. Turns on the mode where messages disappear by themselves after a while in a conversation. While on, messages are deleted at the chosen timer and do not come back. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "to": "5511999998888",
    "duration": 604800
  }
}
GETPrivacidadeBusinesstestado na API real

Ver configurações de privacidade

Mostra de uma só vez o estado de todas as opções de privacidade do número conectado: quem pode ver o visto por último, a foto, o sobre, e assim por diante. Confira antes de alterar qualquer coisa.

GEThttps://{seu_host}/rest/privacy/{instance_key}

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
curl
curl -X GET "https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>" \
  -H "Authorization: Bearer <SEU_TOKEN>"
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' },
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' }
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to view privacy settings. On confirm, the backend must call GET /rest/privacy/{instance_key} on megaAPI using the configured instance and the securely stored token. Shows at once the state of every privacy option for the connected number: who can see last seen, the photo, the about, and so on. Check before changing anything. Show loading, success, and error states; do not expose the token in the browser. Example data: no JSON body
Claude Code
Implement a TypeScript function called privacy_instance_key that calls GET https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY> with Authorization Bearer <YOUR_TOKEN>. Shows at once the state of every privacy option for the connected number: who can see last seen, the photo, the about, and so on. Check before changing anything. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: no JSON body
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the privacy.instance_key integration in a Node.js service. Shows at once the state of every privacy option for the connected number: who can see last seen, the photo, the about, and so on. Check before changing anything."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "GET",
      "url": "GET https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": null
    }
  ]
}
Cursor
In the current project, implement the privacy_instance_key client in TypeScript for GET https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>. Shows at once the state of every privacy option for the connected number: who can see last seen, the photo, the about, and so on. Check before changing anything. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: no JSON body
Codex
Create a TypeScript function for GET https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>. Auth: Bearer <YOUR_TOKEN>. Shows at once the state of every privacy option for the connected number: who can see last seen, the photo, the about, and so on. Check before changing anything. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: no JSON body
POSTPrivacidadeBusinesstestado na API real

Definir quem pode ligar para você

Controla quem pode fazer chamadas de voz e vídeo para o número conectado.

POSThttps://{seu_host}/rest/privacy/{instance_key}/updateCallAdd

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
optionbodystring"<VALOR>"opcionalValor enviado no corpo: option.
Texto que define quem enxerga essa informação. Envie exatamente um dos valores aceitos pelo WhatsApp para essa configuração; qualquer outro é recusado.
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateCallAdd" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "option": "<VALOR>"
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateCallAdd', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "option": "<VALOR>"
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateCallAdd', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "option": "<VALOR>"
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to set who can call you. On confirm, the backend must call POST /rest/privacy/{instance_key}/updateCallAdd on megaAPI using the configured instance and the securely stored token. Controls who can make voice and video calls to the connected number. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "option": "<VALOR>"
}
Claude Code
Implement a TypeScript function called privacy_updateCallAdd that calls POST https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateCallAdd with Authorization Bearer <YOUR_TOKEN>. Controls who can make voice and video calls to the connected number. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "option": "<VALOR>"
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the privacy.updateCallAdd integration in a Node.js service. Controls who can make voice and video calls to the connected number."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateCallAdd",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "option": "<VALOR>"
      }
    }
  ]
}
Cursor
In the current project, implement the privacy_updateCallAdd client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateCallAdd. Controls who can make voice and video calls to the connected number. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "option": "<VALOR>"
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateCallAdd. Auth: Bearer <YOUR_TOKEN>. Controls who can make voice and video calls to the connected number. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "option": "<VALOR>"
}
POSTPrivacidadeBusinesstestado na API real

Definir quem pode adicionar você a grupos

Define quem pode adicionar o número conectado a grupos diretamente, sem passar por um convite.

POSThttps://{seu_host}/rest/privacy/{instance_key}/updateGroupsAdd

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
optionbodystring"<VALOR>"opcionalValor enviado no corpo: option.
Texto que define quem enxerga essa informação. Envie exatamente um dos valores aceitos pelo WhatsApp para essa configuração; qualquer outro é recusado.
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateGroupsAdd" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "option": "<VALOR>"
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateGroupsAdd', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "option": "<VALOR>"
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateGroupsAdd', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "option": "<VALOR>"
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to set who can add you to groups. On confirm, the backend must call POST /rest/privacy/{instance_key}/updateGroupsAdd on megaAPI using the configured instance and the securely stored token. Chooses who is allowed to add the connected number to groups directly, without going through an invite. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "option": "<VALOR>"
}
Claude Code
Implement a TypeScript function called privacy_updateGroupsAdd that calls POST https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateGroupsAdd with Authorization Bearer <YOUR_TOKEN>. Chooses who is allowed to add the connected number to groups directly, without going through an invite. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "option": "<VALOR>"
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the privacy.updateGroupsAdd integration in a Node.js service. Chooses who is allowed to add the connected number to groups directly, without going through an invite."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateGroupsAdd",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "option": "<VALOR>"
      }
    }
  ]
}
Cursor
In the current project, implement the privacy_updateGroupsAdd client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateGroupsAdd. Chooses who is allowed to add the connected number to groups directly, without going through an invite. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "option": "<VALOR>"
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateGroupsAdd. Auth: Bearer <YOUR_TOKEN>. Chooses who is allowed to add the connected number to groups directly, without going through an invite. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "option": "<VALOR>"
}
POSTPrivacidadeBusinesstestado na API real

Definir quem pode ver o visto por último

Define quem pode ver o último horário em que o número conectado esteve no WhatsApp.

POSThttps://{seu_host}/rest/privacy/{instance_key}/updateLastSeen

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
optionbodystring"<VALOR>"opcionalValor enviado no corpo: option.
Texto que define quem enxerga essa informação. Envie exatamente um dos valores aceitos pelo WhatsApp para essa configuração; qualquer outro é recusado.
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateLastSeen" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "option": "<VALOR>"
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateLastSeen', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "option": "<VALOR>"
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateLastSeen', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "option": "<VALOR>"
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to set who can see your last seen. On confirm, the backend must call POST /rest/privacy/{instance_key}/updateLastSeen on megaAPI using the configured instance and the securely stored token. Chooses who can see the last time the connected number was on WhatsApp. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "option": "<VALOR>"
}
Claude Code
Implement a TypeScript function called privacy_updateLastSeen that calls POST https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateLastSeen with Authorization Bearer <YOUR_TOKEN>. Chooses who can see the last time the connected number was on WhatsApp. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "option": "<VALOR>"
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the privacy.updateLastSeen integration in a Node.js service. Chooses who can see the last time the connected number was on WhatsApp."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateLastSeen",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "option": "<VALOR>"
      }
    }
  ]
}
Cursor
In the current project, implement the privacy_updateLastSeen client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateLastSeen. Chooses who can see the last time the connected number was on WhatsApp. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "option": "<VALOR>"
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateLastSeen. Auth: Bearer <YOUR_TOKEN>. Chooses who can see the last time the connected number was on WhatsApp. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "option": "<VALOR>"
}
POSTPrivacidadeBusinesstestado na API real

Definir privacidade de mensagens

Ajusta a configuração de privacidade de mensagens do número conectado. Envie a opção desejada no corpo da requisição.

POSThttps://{seu_host}/rest/privacy/{instance_key}/updateMessages

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodystring"<VALOR>"opcionalValor enviado no corpo: message data.
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateMessages" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": "<VALOR>"
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateMessages', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": "<VALOR>"
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateMessages', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": "<VALOR>"
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to set message privacy. On confirm, the backend must call POST /rest/privacy/{instance_key}/updateMessages on megaAPI using the configured instance and the securely stored token. Adjusts the message privacy setting of the connected number. Send the desired option in the request body. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": "<VALOR>"
}
Claude Code
Implement a TypeScript function called privacy_updateMessages that calls POST https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateMessages with Authorization Bearer <YOUR_TOKEN>. Adjusts the message privacy setting of the connected number. Send the desired option in the request body. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": "<VALOR>"
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the privacy.updateMessages integration in a Node.js service. Adjusts the message privacy setting of the connected number. Send the desired option in the request body."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateMessages",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": "<VALOR>"
      }
    }
  ]
}
Cursor
In the current project, implement the privacy_updateMessages client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateMessages. Adjusts the message privacy setting of the connected number. Send the desired option in the request body. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": "<VALOR>"
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateMessages. Auth: Bearer <YOUR_TOKEN>. Adjusts the message privacy setting of the connected number. Send the desired option in the request body. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": "<VALOR>"
}
POSTPrivacidadeBusinesstestado na API real

Definir quem pode ver você online

Define quem vê o aviso "online" enquanto o número conectado está usando o WhatsApp. Diferente do visto por último: é o que aparece no topo da conversa enquanto você está ali.

POSThttps://{seu_host}/rest/privacy/{instance_key}/updateOnline

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
optionbodystring"<VALOR>"opcionalValor enviado no corpo: option.
Texto que define quem enxerga essa informação. Envie exatamente um dos valores aceitos pelo WhatsApp para essa configuração; qualquer outro é recusado.
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateOnline" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "option": "<VALOR>"
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateOnline', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "option": "<VALOR>"
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateOnline', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "option": "<VALOR>"
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to set who can see you online. On confirm, the backend must call POST /rest/privacy/{instance_key}/updateOnline on megaAPI using the configured instance and the securely stored token. Chooses who sees the "online" notice while the connected number is using WhatsApp. Different from last seen: this is what appears at the top of the conversation while you are there. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "option": "<VALOR>"
}
Claude Code
Implement a TypeScript function called privacy_updateOnline that calls POST https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateOnline with Authorization Bearer <YOUR_TOKEN>. Chooses who sees the "online" notice while the connected number is using WhatsApp. Different from last seen: this is what appears at the top of the conversation while you are there. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "option": "<VALOR>"
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the privacy.updateOnline integration in a Node.js service. Chooses who sees the \"online\" notice while the connected number is using WhatsApp. Different from last seen: this is what appears at the top of the conversation while you are there."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateOnline",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "option": "<VALOR>"
      }
    }
  ]
}
Cursor
In the current project, implement the privacy_updateOnline client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateOnline. Chooses who sees the "online" notice while the connected number is using WhatsApp. Different from last seen: this is what appears at the top of the conversation while you are there. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "option": "<VALOR>"
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateOnline. Auth: Bearer <YOUR_TOKEN>. Chooses who sees the "online" notice while the connected number is using WhatsApp. Different from last seen: this is what appears at the top of the conversation while you are there. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "option": "<VALOR>"
}
POSTPrivacidadeBusinesstestado na API real

Definir quem pode ver sua foto

Define quem pode ver a foto de perfil do número conectado.

POSThttps://{seu_host}/rest/privacy/{instance_key}/updateProfilePicture

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
optionbodystring"<VALOR>"opcionalValor enviado no corpo: option.
Texto que define quem enxerga essa informação. Envie exatamente um dos valores aceitos pelo WhatsApp para essa configuração; qualquer outro é recusado.
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateProfilePicture" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "option": "<VALOR>"
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateProfilePicture', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "option": "<VALOR>"
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateProfilePicture', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "option": "<VALOR>"
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to set who can see your photo. On confirm, the backend must call POST /rest/privacy/{instance_key}/updateProfilePicture on megaAPI using the configured instance and the securely stored token. Chooses who can see the profile photo of the connected number. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "option": "<VALOR>"
}
Claude Code
Implement a TypeScript function called privacy_updateProfilePicture that calls POST https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateProfilePicture with Authorization Bearer <YOUR_TOKEN>. Chooses who can see the profile photo of the connected number. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "option": "<VALOR>"
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the privacy.updateProfilePicture integration in a Node.js service. Chooses who can see the profile photo of the connected number."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateProfilePicture",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "option": "<VALOR>"
      }
    }
  ]
}
Cursor
In the current project, implement the privacy_updateProfilePicture client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateProfilePicture. Chooses who can see the profile photo of the connected number. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "option": "<VALOR>"
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateProfilePicture. Auth: Bearer <YOUR_TOKEN>. Chooses who can see the profile photo of the connected number. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "option": "<VALOR>"
}
POSTPrivacidadeBusinesstestado na API real

Ativar ou desativar as confirmações de leitura

Controla os checkmarks azuis do número conectado. Com as confirmações desativadas, outras pessoas não sabem mais que você leu — e você também deixa de ver quando elas leem suas mensagens.

POSThttps://{seu_host}/rest/privacy/{instance_key}/updateReadReceipts

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
optionbodystring"<VALOR>"opcionalValor enviado no corpo: option.
Texto que define quem enxerga essa informação. Envie exatamente um dos valores aceitos pelo WhatsApp para essa configuração; qualquer outro é recusado.
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateReadReceipts" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "option": "<VALOR>"
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateReadReceipts', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "option": "<VALOR>"
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateReadReceipts', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "option": "<VALOR>"
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to turn read receipts on or off. On confirm, the backend must call POST /rest/privacy/{instance_key}/updateReadReceipts on megaAPI using the configured instance and the securely stored token. Controls the blue ticks of the connected number. With receipts off, other people no longer know you read - and you also stop seeing when they read your messages. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "option": "<VALOR>"
}
Claude Code
Implement a TypeScript function called privacy_updateReadReceipts that calls POST https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateReadReceipts with Authorization Bearer <YOUR_TOKEN>. Controls the blue ticks of the connected number. With receipts off, other people no longer know you read - and you also stop seeing when they read your messages. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "option": "<VALOR>"
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the privacy.updateReadReceipts integration in a Node.js service. Controls the blue ticks of the connected number. With receipts off, other people no longer know you read - and you also stop seeing when they read your messages."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateReadReceipts",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "option": "<VALOR>"
      }
    }
  ]
}
Cursor
In the current project, implement the privacy_updateReadReceipts client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateReadReceipts. Controls the blue ticks of the connected number. With receipts off, other people no longer know you read - and you also stop seeing when they read your messages. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "option": "<VALOR>"
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateReadReceipts. Auth: Bearer <YOUR_TOKEN>. Controls the blue ticks of the connected number. With receipts off, other people no longer know you read - and you also stop seeing when they read your messages. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "option": "<VALOR>"
}
POSTPrivacidadeBusinesstestado na API real

Definir quem pode ver seu sobre

Define quem pode ver o sobre do perfil e os status publicados pelo número conectado.

POSThttps://{seu_host}/rest/privacy/{instance_key}/updateStatus

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
optionbodystring"<VALOR>"opcionalValor enviado no corpo: option.
Texto que define quem enxerga essa informação. Envie exatamente um dos valores aceitos pelo WhatsApp para essa configuração; qualquer outro é recusado.
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateStatus" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "option": "<VALOR>"
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateStatus', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "option": "<VALOR>"
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateStatus', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "option": "<VALOR>"
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to set who can see your about. On confirm, the backend must call POST /rest/privacy/{instance_key}/updateStatus on megaAPI using the configured instance and the securely stored token. Chooses who can see the profile about and the statuses published by the connected number. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "option": "<VALOR>"
}
Claude Code
Implement a TypeScript function called privacy_updateStatus that calls POST https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateStatus with Authorization Bearer <YOUR_TOKEN>. Chooses who can see the profile about and the statuses published by the connected number. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "option": "<VALOR>"
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the privacy.updateStatus integration in a Node.js service. Chooses who can see the profile about and the statuses published by the connected number."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateStatus",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "option": "<VALOR>"
      }
    }
  ]
}
Cursor
In the current project, implement the privacy_updateStatus client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateStatus. Chooses who can see the profile about and the statuses published by the connected number. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "option": "<VALOR>"
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateStatus. Auth: Bearer <YOUR_TOKEN>. Chooses who can see the profile about and the statuses published by the connected number. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "option": "<VALOR>"
}
POSTPrivacidadeBusinesstestado na API real

Definir privacidade de figurinhas

Ajusta a configuração de privacidade relacionada a figurinhas do número conectado.

POSThttps://{seu_host}/rest/privacy/{instance_key}/updateStickers

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodystring"<VALOR>"opcionalValor enviado no corpo: message data.
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateStickers" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": "<VALOR>"
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateStickers', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": "<VALOR>"
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateStickers', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": "<VALOR>"
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to set sticker privacy. On confirm, the backend must call POST /rest/privacy/{instance_key}/updateStickers on megaAPI using the configured instance and the securely stored token. Adjusts the privacy setting related to stickers of the connected number. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": "<VALOR>"
}
Claude Code
Implement a TypeScript function called privacy_updateStickers that calls POST https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateStickers with Authorization Bearer <YOUR_TOKEN>. Adjusts the privacy setting related to stickers of the connected number. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": "<VALOR>"
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the privacy.updateStickers integration in a Node.js service. Adjusts the privacy setting related to stickers of the connected number."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateStickers",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": "<VALOR>"
      }
    }
  ]
}
Cursor
In the current project, implement the privacy_updateStickers client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateStickers. Adjusts the privacy setting related to stickers of the connected number. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": "<VALOR>"
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/privacy/<INSTANCE_KEY>/updateStickers. Auth: Bearer <YOUR_TOKEN>. Adjusts the privacy setting related to stickers of the connected number. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": "<VALOR>"
}
DELETEProdutosBusinesstestado na API real

Excluir produto

Exclui um produto do catálogo de forma permanente. Não há desfazer: para recuperar o produto, é preciso registrá-lo do zero. Se você só quer tirá-lo da exibição, use o endpoint que oculta o produto.

DELETEhttps://{seu_host}/rest/product/deleteProduct/{instance_key}

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "productIds": [
    ""
  ],
  "retailerIds": [
    ""
  ]
}
opcionalValor enviado no corpo: message data.
Informe o identificador do produto a excluir. Confira antes de enviar — a exclusão não tem volta.
AtributosTipoDescrição
productIdsarray
retailerIdsarray
curl
curl -X DELETE "https://apibusiness1.megaapi.com.br/rest/product/deleteProduct/<INSTANCE_KEY>" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "productIds": [
      ""
    ],
    "retailerIds": [
      ""
    ]
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/product/deleteProduct/<INSTANCE_KEY>', {
  method: 'DELETE',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "productIds": [
      ""
    ],
    "retailerIds": [
      ""
    ]
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/product/deleteProduct/<INSTANCE_KEY>', {
  method: 'DELETE',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "productIds": [
      ""
    ],
    "retailerIds": [
      ""
    ]
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to delete product. On confirm, the backend must call DELETE /rest/product/deleteProduct/{instance_key} on megaAPI using the configured instance and the securely stored token. Deletes a product from the catalog permanently. No undo: to get the product back you have to register it from scratch. If you only want it out of the display, use the endpoint that hides the product. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "productIds": [
      ""
    ],
    "retailerIds": [
      ""
    ]
  }
}
Claude Code
Implement a TypeScript function called product_delete_instance_key that calls DELETE https://apibusiness1.megaapi.com.br/rest/product/deleteProduct/<INSTANCE_KEY> with Authorization Bearer <YOUR_TOKEN>. Deletes a product from the catalog permanently. No undo: to get the product back you have to register it from scratch. If you only want it out of the display, use the endpoint that hides the product. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "productIds": [
      ""
    ],
    "retailerIds": [
      ""
    ]
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the product.delete.instance_key integration in a Node.js service. Deletes a product from the catalog permanently. No undo: to get the product back you have to register it from scratch. If you only want it out of the display, use the endpoint that hides the product."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "DELETE",
      "url": "DELETE https://apibusiness1.megaapi.com.br/rest/product/deleteProduct/<INSTANCE_KEY>",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "productIds": [
            ""
          ],
          "retailerIds": [
            ""
          ]
        }
      }
    }
  ]
}
Cursor
In the current project, implement the product_delete_instance_key client in TypeScript for DELETE https://apibusiness1.megaapi.com.br/rest/product/deleteProduct/<INSTANCE_KEY>. Deletes a product from the catalog permanently. No undo: to get the product back you have to register it from scratch. If you only want it out of the display, use the endpoint that hides the product. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "productIds": [
      ""
    ],
    "retailerIds": [
      ""
    ]
  }
}
Codex
Create a TypeScript function for DELETE https://apibusiness1.megaapi.com.br/rest/product/deleteProduct/<INSTANCE_KEY>. Auth: Bearer <YOUR_TOKEN>. Deletes a product from the catalog permanently. No undo: to get the product back you have to register it from scratch. If you only want it out of the display, use the endpoint that hides the product. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "productIds": [
      ""
    ],
    "retailerIds": [
      ""
    ]
  }
}
GETProdutosBusinesstestado na API real

Listar catálogo de outro número

Mostra os produtos do catálogo de outra empresa no WhatsApp. Só funciona se esse número tiver um catálogo público no WhatsApp Business.

GEThttps://{seu_host}/rest/product/listCatalog/{instance_key}?to=5511999998888&limit=0

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
toquerystring"5511999998888"opcionalFiltro ou opção da consulta: to.
Número da empresa dona do catálogo, com DDI+DDD e só dígitos. Ex.: 5511999998888.
limitquerynumber0opcionalFiltro ou opção da consulta: limit.
Quantos itens trazer por vez. Comece baixo (ex.: 10) para não puxar o catálogo inteiro de uma vez.
curl
curl -X GET "https://apibusiness1.megaapi.com.br/rest/product/listCatalog/<INSTANCE_KEY>?to=5511999998888&limit=0" \
  -H "Authorization: Bearer <SEU_TOKEN>"
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/product/listCatalog/<INSTANCE_KEY>?to=5511999998888&limit=0', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' },
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/product/listCatalog/<INSTANCE_KEY>?to=5511999998888&limit=0', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' }
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to list another number's catalog. On confirm, the backend must call GET /rest/product/listCatalog/{instance_key} on megaAPI using the configured instance and the securely stored token. Shows the products of another company's catalog on WhatsApp. Only works if that number has a public catalog on WhatsApp Business. Show loading, success, and error states; do not expose the token in the browser. Example data: no JSON body
Claude Code
Implement a TypeScript function called product_get_instance_key that calls GET https://apibusiness1.megaapi.com.br/rest/product/listCatalog/<INSTANCE_KEY>?to=5511999998888&limit=0 with Authorization Bearer <YOUR_TOKEN>. Shows the products of another company's catalog on WhatsApp. Only works if that number has a public catalog on WhatsApp Business. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: no JSON body
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the product.get.instance_key integration in a Node.js service. Shows the products of another company's catalog on WhatsApp. Only works if that number has a public catalog on WhatsApp Business."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "GET",
      "url": "GET https://apibusiness1.megaapi.com.br/rest/product/listCatalog/<INSTANCE_KEY>?to=5511999998888&limit=0",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": null
    }
  ]
}
Cursor
In the current project, implement the product_get_instance_key client in TypeScript for GET https://apibusiness1.megaapi.com.br/rest/product/listCatalog/<INSTANCE_KEY>?to=5511999998888&limit=0. Shows the products of another company's catalog on WhatsApp. Only works if that number has a public catalog on WhatsApp Business. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: no JSON body
Codex
Create a TypeScript function for GET https://apibusiness1.megaapi.com.br/rest/product/listCatalog/<INSTANCE_KEY>?to=5511999998888&limit=0. Auth: Bearer <YOUR_TOKEN>. Shows the products of another company's catalog on WhatsApp. Only works if that number has a public catalog on WhatsApp Business. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: no JSON body
GETProdutosBusinesstestado na API real

Listar meu catálogo

Lista os produtos do catálogo do WhatsApp Business do número conectado, com preço, descrição e o identificador de cada item.

GEThttps://{seu_host}/rest/product/listMyCatalog/{instance_key}?limit=0

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
limitquerynumber0opcionalFiltro ou opção da consulta: limit.
Quantos itens trazer por vez. Comece baixo (ex.: 10) para não puxar o catálogo inteiro de uma vez.
curl
curl -X GET "https://apibusiness1.megaapi.com.br/rest/product/listMyCatalog/<INSTANCE_KEY>?limit=0" \
  -H "Authorization: Bearer <SEU_TOKEN>"
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/product/listMyCatalog/<INSTANCE_KEY>?limit=0', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' },
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/product/listMyCatalog/<INSTANCE_KEY>?limit=0', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' }
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to list my catalog. On confirm, the backend must call GET /rest/product/listMyCatalog/{instance_key} on megaAPI using the configured instance and the securely stored token. Lists the products in the connected number's WhatsApp Business catalog, with price, description, and the identifier of each item. Show loading, success, and error states; do not expose the token in the browser. Example data: no JSON body
Claude Code
Implement a TypeScript function called product_instance_key that calls GET https://apibusiness1.megaapi.com.br/rest/product/listMyCatalog/<INSTANCE_KEY>?limit=0 with Authorization Bearer <YOUR_TOKEN>. Lists the products in the connected number's WhatsApp Business catalog, with price, description, and the identifier of each item. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: no JSON body
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the product.instance_key integration in a Node.js service. Lists the products in the connected number's WhatsApp Business catalog, with price, description, and the identifier of each item."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "GET",
      "url": "GET https://apibusiness1.megaapi.com.br/rest/product/listMyCatalog/<INSTANCE_KEY>?limit=0",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": null
    }
  ]
}
Cursor
In the current project, implement the product_instance_key client in TypeScript for GET https://apibusiness1.megaapi.com.br/rest/product/listMyCatalog/<INSTANCE_KEY>?limit=0. Lists the products in the connected number's WhatsApp Business catalog, with price, description, and the identifier of each item. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: no JSON body
Codex
Create a TypeScript function for GET https://apibusiness1.megaapi.com.br/rest/product/listMyCatalog/<INSTANCE_KEY>?limit=0. Auth: Bearer <YOUR_TOKEN>. Lists the products in the connected number's WhatsApp Business catalog, with price, description, and the identifier of each item. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: no JSON body
POSTProdutosBusinesstestado na API real

Enviar coleção

Envia uma coleção de produtos para um contato, como uma mensagem do WhatsApp.

POSThttps://{seu_host}/rest/product/sendCollection/{instance_key}

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "to": "5511999998888",
  "collectionId": "<VALOR>"
}
opcionalValor enviado no corpo: message data.
Informe o número que vai receber, com DDI+DDD e só dígitos, e o identificador da coleção.
AtributosTipoDescrição
tostring
collectionIdstring
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/product/sendCollection/<INSTANCE_KEY>" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "to": "5511999998888",
    "collectionId": "<VALOR>"
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/product/sendCollection/<INSTANCE_KEY>', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "collectionId": "<VALOR>"
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/product/sendCollection/<INSTANCE_KEY>', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "collectionId": "<VALOR>"
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to send collection. On confirm, the backend must call POST /rest/product/sendCollection/{instance_key} on megaAPI using the configured instance and the securely stored token. Sends a collection of products to a contact, as a WhatsApp message. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "to": "5511999998888",
    "collectionId": "<VALOR>"
  }
}
Claude Code
Implement a TypeScript function called product_instance_key-10 that calls POST https://apibusiness1.megaapi.com.br/rest/product/sendCollection/<INSTANCE_KEY> with Authorization Bearer <YOUR_TOKEN>. Sends a collection of products to a contact, as a WhatsApp message. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "to": "5511999998888",
    "collectionId": "<VALOR>"
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the product.instance_key-10 integration in a Node.js service. Sends a collection of products to a contact, as a WhatsApp message."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/product/sendCollection/<INSTANCE_KEY>",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "to": "5511999998888",
          "collectionId": "<VALOR>"
        }
      }
    }
  ]
}
Cursor
In the current project, implement the product_instance_key-10 client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/product/sendCollection/<INSTANCE_KEY>. Sends a collection of products to a contact, as a WhatsApp message. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "to": "5511999998888",
    "collectionId": "<VALOR>"
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/product/sendCollection/<INSTANCE_KEY>. Auth: Bearer <YOUR_TOKEN>. Sends a collection of products to a contact, as a WhatsApp message. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "to": "5511999998888",
    "collectionId": "<VALOR>"
  }
}
DELETEProdutosBusinesstestado na API real

Excluir coleção

Exclui uma coleção do catálogo de forma permanente. Não há desfazer — só recriando a coleção do zero.

DELETEhttps://{seu_host}/rest/product/deleteCollection/{instance_key}?id=<VALOR>

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
idquerystring"<VALOR>"opcionalFiltro ou opção da consulta: id.
Identificador da coleção, retornado na listagem de coleções. Confira antes de enviar: a exclusão não tem volta.
curl
curl -X DELETE "https://apibusiness1.megaapi.com.br/rest/product/deleteCollection/<INSTANCE_KEY>?id=<VALOR>" \
  -H "Authorization: Bearer <SEU_TOKEN>"
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/product/deleteCollection/<INSTANCE_KEY>?id=<VALOR>', {
  method: 'DELETE',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' },
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/product/deleteCollection/<INSTANCE_KEY>?id=<VALOR>', {
  method: 'DELETE',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' }
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to delete collection. On confirm, the backend must call DELETE /rest/product/deleteCollection/{instance_key} on megaAPI using the configured instance and the securely stored token. Deletes a collection from the catalog permanently. No undo - only by recreating the collection from scratch. Show loading, success, and error states; do not expose the token in the browser. Example data: no JSON body
Claude Code
Implement a TypeScript function called product_instance_key-11 that calls DELETE https://apibusiness1.megaapi.com.br/rest/product/deleteCollection/<INSTANCE_KEY>?id=<VALOR> with Authorization Bearer <YOUR_TOKEN>. Deletes a collection from the catalog permanently. No undo - only by recreating the collection from scratch. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: no JSON body
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the product.instance_key-11 integration in a Node.js service. Deletes a collection from the catalog permanently. No undo - only by recreating the collection from scratch."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "DELETE",
      "url": "DELETE https://apibusiness1.megaapi.com.br/rest/product/deleteCollection/<INSTANCE_KEY>?id=<VALOR>",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": null
    }
  ]
}
Cursor
In the current project, implement the product_instance_key-11 client in TypeScript for DELETE https://apibusiness1.megaapi.com.br/rest/product/deleteCollection/<INSTANCE_KEY>?id=<VALOR>. Deletes a collection from the catalog permanently. No undo - only by recreating the collection from scratch. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: no JSON body
Codex
Create a TypeScript function for DELETE https://apibusiness1.megaapi.com.br/rest/product/deleteCollection/<INSTANCE_KEY>?id=<VALOR>. Auth: Bearer <YOUR_TOKEN>. Deletes a collection from the catalog permanently. No undo - only by recreating the collection from scratch. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: no JSON body
POSTProdutosBusinesstestado na API real

Visualizar informações do pedido

Traz os detalhes de um pedido montado pelo cliente pelo catálogo: itens, quantidades e valores.

POSThttps://{seu_host}/rest/product/getOrderInfo/{instance_key}

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "orderId": "<VALOR>",
  "tokenBase64": "<VALOR>"
}
opcionalValor enviado no corpo: message data.
`orderId` e `tokenBase64` chegam junto com a mensagem de pedido no seu webhook; copie os dois exatamente como vieram.
AtributosTipoDescrição
orderIdstring
tokenBase64string
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/product/getOrderInfo/<INSTANCE_KEY>" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "orderId": "<VALOR>",
    "tokenBase64": "<VALOR>"
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/product/getOrderInfo/<INSTANCE_KEY>', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "orderId": "<VALOR>",
    "tokenBase64": "<VALOR>"
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/product/getOrderInfo/<INSTANCE_KEY>', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "orderId": "<VALOR>",
    "tokenBase64": "<VALOR>"
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to view order info. On confirm, the backend must call POST /rest/product/getOrderInfo/{instance_key} on megaAPI using the configured instance and the securely stored token. Brings the details of an order the customer built through the catalog: items, quantities, and amounts. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "orderId": "<VALOR>",
    "tokenBase64": "<VALOR>"
  }
}
Claude Code
Implement a TypeScript function called product_instance_key-12 that calls POST https://apibusiness1.megaapi.com.br/rest/product/getOrderInfo/<INSTANCE_KEY> with Authorization Bearer <YOUR_TOKEN>. Brings the details of an order the customer built through the catalog: items, quantities, and amounts. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "orderId": "<VALOR>",
    "tokenBase64": "<VALOR>"
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the product.instance_key-12 integration in a Node.js service. Brings the details of an order the customer built through the catalog: items, quantities, and amounts."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/product/getOrderInfo/<INSTANCE_KEY>",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "orderId": "<VALOR>",
          "tokenBase64": "<VALOR>"
        }
      }
    }
  ]
}
Cursor
In the current project, implement the product_instance_key-12 client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/product/getOrderInfo/<INSTANCE_KEY>. Brings the details of an order the customer built through the catalog: items, quantities, and amounts. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "orderId": "<VALOR>",
    "tokenBase64": "<VALOR>"
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/product/getOrderInfo/<INSTANCE_KEY>. Auth: Bearer <YOUR_TOKEN>. Brings the details of an order the customer built through the catalog: items, quantities, and amounts. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "orderId": "<VALOR>",
    "tokenBase64": "<VALOR>"
  }
}
POSTProdutosBusinesstestado na API real

Enviar solicitação de pagamento do pedido

Envia ao cliente a solicitação de pagamento de um pedido feito pelo catálogo, já com frete, desconto e imposto somados ao total.

POSThttps://{seu_host}/rest/product/sendOrderPayment/{instance_key}

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "to": "5511999998888",
  "body": "<VALOR>",
  "footer": "<VALOR>",
  "imageThumbnail": "<VALOR>",
  "orderId": "<VALOR>",
  "tokenBase64": "<VALOR>",
  "shipping": 1000,
  "discount": 1000,
  "tax": 1000,
  "paymentName": "<VALOR>",
  "paymentKeyType": "<VALOR>",
  "paymentKey": "<VALOR>"
}
opcionalValor enviado no corpo: message data.
`shipping`, `discount` e `tax` seguem o padrão de valor multiplicado por 1000 — R$ 10,00 vira 10000. `orderId` e `tokenBase64` vêm da mensagem de pedido.
AtributosTipoDescrição
tostring
bodystring
footerstring
imageThumbnailstring
orderIdstring
tokenBase64string
shippingnumber
discountnumber
taxnumber
paymentNamestring
paymentKeyTypestring
paymentKeystring
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/product/sendOrderPayment/<INSTANCE_KEY>" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "to": "5511999998888",
    "body": "<VALOR>",
    "footer": "<VALOR>",
    "imageThumbnail": "<VALOR>",
    "orderId": "<VALOR>",
    "tokenBase64": "<VALOR>",
    "shipping": 1000,
    "discount": 1000,
    "tax": 1000,
    "paymentName": "<VALOR>",
    "paymentKeyType": "<VALOR>",
    "paymentKey": "<VALOR>"
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/product/sendOrderPayment/<INSTANCE_KEY>', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "body": "<VALOR>",
    "footer": "<VALOR>",
    "imageThumbnail": "<VALOR>",
    "orderId": "<VALOR>",
    "tokenBase64": "<VALOR>",
    "shipping": 1000,
    "discount": 1000,
    "tax": 1000,
    "paymentName": "<VALOR>",
    "paymentKeyType": "<VALOR>",
    "paymentKey": "<VALOR>"
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/product/sendOrderPayment/<INSTANCE_KEY>', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "body": "<VALOR>",
    "footer": "<VALOR>",
    "imageThumbnail": "<VALOR>",
    "orderId": "<VALOR>",
    "tokenBase64": "<VALOR>",
    "shipping": 1000,
    "discount": 1000,
    "tax": 1000,
    "paymentName": "<VALOR>",
    "paymentKeyType": "<VALOR>",
    "paymentKey": "<VALOR>"
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to send order payment request. On confirm, the backend must call POST /rest/product/sendOrderPayment/{instance_key} on megaAPI using the configured instance and the securely stored token. Sends the customer the payment request for an order made through the catalog, already with shipping, discount, and tax added to the total. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "to": "5511999998888",
    "body": "<VALOR>",
    "footer": "<VALOR>",
    "imageThumbnail": "<VALOR>",
    "orderId": "<VALOR>",
    "tokenBase64": "<VALOR>",
    "shipping": 1000,
    "discount": 1000,
    "tax": 1000,
    "paymentName": "<VALOR>",
    "paymentKeyType": "<VALOR>",
    "paymentKey": "<VALOR>"
  }
}
Claude Code
Implement a TypeScript function called product_instance_key-13 that calls POST https://apibusiness1.megaapi.com.br/rest/product/sendOrderPayment/<INSTANCE_KEY> with Authorization Bearer <YOUR_TOKEN>. Sends the customer the payment request for an order made through the catalog, already with shipping, discount, and tax added to the total. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "to": "5511999998888",
    "body": "<VALOR>",
    "footer": "<VALOR>",
    "imageThumbnail": "<VALOR>",
    "orderId": "<VALOR>",
    "tokenBase64": "<VALOR>",
    "shipping": 1000,
    "discount": 1000,
    "tax": 1000,
    "paymentName": "<VALOR>",
    "paymentKeyType": "<VALOR>",
    "paymentKey": "<VALOR>"
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the product.instance_key-13 integration in a Node.js service. Sends the customer the payment request for an order made through the catalog, already with shipping, discount, and tax added to the total."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/product/sendOrderPayment/<INSTANCE_KEY>",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "to": "5511999998888",
          "body": "<VALOR>",
          "footer": "<VALOR>",
          "imageThumbnail": "<VALOR>",
          "orderId": "<VALOR>",
          "tokenBase64": "<VALOR>",
          "shipping": 1000,
          "discount": 1000,
          "tax": 1000,
          "paymentName": "<VALOR>",
          "paymentKeyType": "<VALOR>",
          "paymentKey": "<VALOR>"
        }
      }
    }
  ]
}
Cursor
In the current project, implement the product_instance_key-13 client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/product/sendOrderPayment/<INSTANCE_KEY>. Sends the customer the payment request for an order made through the catalog, already with shipping, discount, and tax added to the total. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "to": "5511999998888",
    "body": "<VALOR>",
    "footer": "<VALOR>",
    "imageThumbnail": "<VALOR>",
    "orderId": "<VALOR>",
    "tokenBase64": "<VALOR>",
    "shipping": 1000,
    "discount": 1000,
    "tax": 1000,
    "paymentName": "<VALOR>",
    "paymentKeyType": "<VALOR>",
    "paymentKey": "<VALOR>"
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/product/sendOrderPayment/<INSTANCE_KEY>. Auth: Bearer <YOUR_TOKEN>. Sends the customer the payment request for an order made through the catalog, already with shipping, discount, and tax added to the total. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "to": "5511999998888",
    "body": "<VALOR>",
    "footer": "<VALOR>",
    "imageThumbnail": "<VALOR>",
    "orderId": "<VALOR>",
    "tokenBase64": "<VALOR>",
    "shipping": 1000,
    "discount": 1000,
    "tax": 1000,
    "paymentName": "<VALOR>",
    "paymentKeyType": "<VALOR>",
    "paymentKey": "<VALOR>"
  }
}
POSTProdutosBusinesstestado na API real

Criar produto

Registra um novo produto no catálogo do WhatsApp Business, com nome, descrição, preço e fotos.

POSThttps://{seu_host}/rest/product/createProduct/{instance_key}

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "name": "<VALOR>",
  "url": "https://seu-dominio.com/webhook",
  "description": "<VALOR>",
  "priceAmount1000": 0,
  "currency": "BRL",
  "isHidden": false,
  "retailerId": "<VALOR>",
  "originCountryCode": "BR",
  "images": [
    {
      "url": ""
    }
  ]
}
opcionalValor enviado no corpo: message data.
`priceAmount1000` é o preço multiplicado por 1000 — R$ 49,90 vira 49900. `images` recebe links públicos das fotos, e `currency` a moeda (ex.: "BRL").
AtributosTipoDescrição
namestring
urlstring
descriptionstring
priceAmount1000number
currencystring
isHiddenboolean
retailerIdstring
originCountryCodestring
imagesarray
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/product/createProduct/<INSTANCE_KEY>" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "name": "<VALOR>",
    "url": "https://seu-dominio.com/webhook",
    "description": "<VALOR>",
    "priceAmount1000": 0,
    "currency": "BRL",
    "isHidden": false,
    "retailerId": "<VALOR>",
    "originCountryCode": "BR",
    "images": [
      {
        "url": ""
      }
    ]
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/product/createProduct/<INSTANCE_KEY>', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "name": "<VALOR>",
    "url": "https://seu-dominio.com/webhook",
    "description": "<VALOR>",
    "priceAmount1000": 0,
    "currency": "BRL",
    "isHidden": false,
    "retailerId": "<VALOR>",
    "originCountryCode": "BR",
    "images": [
      {
        "url": ""
      }
    ]
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/product/createProduct/<INSTANCE_KEY>', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "name": "<VALOR>",
    "url": "https://seu-dominio.com/webhook",
    "description": "<VALOR>",
    "priceAmount1000": 0,
    "currency": "BRL",
    "isHidden": false,
    "retailerId": "<VALOR>",
    "originCountryCode": "BR",
    "images": [
      {
        "url": ""
      }
    ]
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to create product. On confirm, the backend must call POST /rest/product/createProduct/{instance_key} on megaAPI using the configured instance and the securely stored token. Registers a new product in the WhatsApp Business catalog, with name, description, price, and photos. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "name": "<VALOR>",
    "url": "https://seu-dominio.com/webhook",
    "description": "<VALOR>",
    "priceAmount1000": 0,
    "currency": "BRL",
    "isHidden": false,
    "retailerId": "<VALOR>",
    "originCountryCode": "BR",
    "images": [
      {
        "url": ""
      }
    ]
  }
}
Claude Code
Implement a TypeScript function called product_instance_key-2 that calls POST https://apibusiness1.megaapi.com.br/rest/product/createProduct/<INSTANCE_KEY> with Authorization Bearer <YOUR_TOKEN>. Registers a new product in the WhatsApp Business catalog, with name, description, price, and photos. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "name": "<VALOR>",
    "url": "https://seu-dominio.com/webhook",
    "description": "<VALOR>",
    "priceAmount1000": 0,
    "currency": "BRL",
    "isHidden": false,
    "retailerId": "<VALOR>",
    "originCountryCode": "BR",
    "images": [
      {
        "url": ""
      }
    ]
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the product.instance_key-2 integration in a Node.js service. Registers a new product in the WhatsApp Business catalog, with name, description, price, and photos."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/product/createProduct/<INSTANCE_KEY>",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "name": "<VALOR>",
          "url": "https://seu-dominio.com/webhook",
          "description": "<VALOR>",
          "priceAmount1000": 0,
          "currency": "BRL",
          "isHidden": false,
          "retailerId": "<VALOR>",
          "originCountryCode": "BR",
          "images": [
            {
              "url": ""
            }
          ]
        }
      }
    }
  ]
}
Cursor
In the current project, implement the product_instance_key-2 client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/product/createProduct/<INSTANCE_KEY>. Registers a new product in the WhatsApp Business catalog, with name, description, price, and photos. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "name": "<VALOR>",
    "url": "https://seu-dominio.com/webhook",
    "description": "<VALOR>",
    "priceAmount1000": 0,
    "currency": "BRL",
    "isHidden": false,
    "retailerId": "<VALOR>",
    "originCountryCode": "BR",
    "images": [
      {
        "url": ""
      }
    ]
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/product/createProduct/<INSTANCE_KEY>. Auth: Bearer <YOUR_TOKEN>. Registers a new product in the WhatsApp Business catalog, with name, description, price, and photos. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "name": "<VALOR>",
    "url": "https://seu-dominio.com/webhook",
    "description": "<VALOR>",
    "priceAmount1000": 0,
    "currency": "BRL",
    "isHidden": false,
    "retailerId": "<VALOR>",
    "originCountryCode": "BR",
    "images": [
      {
        "url": ""
      }
    ]
  }
}
POSTProdutosBusinesstestado na API real

Atualizar produto

Altera os dados de um produto já existente no catálogo. Os valores enviados substituem os que estavam lá.

POSThttps://{seu_host}/rest/product/updateProduct/{instance_key}

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "name": "<VALOR>",
  "url": "https://seu-dominio.com/webhook",
  "description": "<VALOR>",
  "priceAmount1000": 0,
  "currency": "BRL",
  "isHidden": false,
  "productId": "<VALOR>",
  "retailerId": "<VALOR>",
  "images": [
    {
      "url": ""
    }
  ]
}
opcionalValor enviado no corpo: message data.
Informe o identificador do produto e os campos a mudar. `priceAmount1000` é o preço multiplicado por 1000 — R$ 49,90 vira 49900.
AtributosTipoDescrição
namestring
urlstring
descriptionstring
priceAmount1000number
currencystring
isHiddenboolean
productIdstring
retailerIdstring
imagesarray
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/product/updateProduct/<INSTANCE_KEY>" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "name": "<VALOR>",
    "url": "https://seu-dominio.com/webhook",
    "description": "<VALOR>",
    "priceAmount1000": 0,
    "currency": "BRL",
    "isHidden": false,
    "productId": "<VALOR>",
    "retailerId": "<VALOR>",
    "images": [
      {
        "url": ""
      }
    ]
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/product/updateProduct/<INSTANCE_KEY>', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "name": "<VALOR>",
    "url": "https://seu-dominio.com/webhook",
    "description": "<VALOR>",
    "priceAmount1000": 0,
    "currency": "BRL",
    "isHidden": false,
    "productId": "<VALOR>",
    "retailerId": "<VALOR>",
    "images": [
      {
        "url": ""
      }
    ]
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/product/updateProduct/<INSTANCE_KEY>', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "name": "<VALOR>",
    "url": "https://seu-dominio.com/webhook",
    "description": "<VALOR>",
    "priceAmount1000": 0,
    "currency": "BRL",
    "isHidden": false,
    "productId": "<VALOR>",
    "retailerId": "<VALOR>",
    "images": [
      {
        "url": ""
      }
    ]
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to update product. On confirm, the backend must call POST /rest/product/updateProduct/{instance_key} on megaAPI using the configured instance and the securely stored token. Changes the data of a product already in the catalog. The values sent replace the ones that were there. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "name": "<VALOR>",
    "url": "https://seu-dominio.com/webhook",
    "description": "<VALOR>",
    "priceAmount1000": 0,
    "currency": "BRL",
    "isHidden": false,
    "productId": "<VALOR>",
    "retailerId": "<VALOR>",
    "images": [
      {
        "url": ""
      }
    ]
  }
}
Claude Code
Implement a TypeScript function called product_instance_key-3 that calls POST https://apibusiness1.megaapi.com.br/rest/product/updateProduct/<INSTANCE_KEY> with Authorization Bearer <YOUR_TOKEN>. Changes the data of a product already in the catalog. The values sent replace the ones that were there. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "name": "<VALOR>",
    "url": "https://seu-dominio.com/webhook",
    "description": "<VALOR>",
    "priceAmount1000": 0,
    "currency": "BRL",
    "isHidden": false,
    "productId": "<VALOR>",
    "retailerId": "<VALOR>",
    "images": [
      {
        "url": ""
      }
    ]
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the product.instance_key-3 integration in a Node.js service. Changes the data of a product already in the catalog. The values sent replace the ones that were there."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/product/updateProduct/<INSTANCE_KEY>",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "name": "<VALOR>",
          "url": "https://seu-dominio.com/webhook",
          "description": "<VALOR>",
          "priceAmount1000": 0,
          "currency": "BRL",
          "isHidden": false,
          "productId": "<VALOR>",
          "retailerId": "<VALOR>",
          "images": [
            {
              "url": ""
            }
          ]
        }
      }
    }
  ]
}
Cursor
In the current project, implement the product_instance_key-3 client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/product/updateProduct/<INSTANCE_KEY>. Changes the data of a product already in the catalog. The values sent replace the ones that were there. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "name": "<VALOR>",
    "url": "https://seu-dominio.com/webhook",
    "description": "<VALOR>",
    "priceAmount1000": 0,
    "currency": "BRL",
    "isHidden": false,
    "productId": "<VALOR>",
    "retailerId": "<VALOR>",
    "images": [
      {
        "url": ""
      }
    ]
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/product/updateProduct/<INSTANCE_KEY>. Auth: Bearer <YOUR_TOKEN>. Changes the data of a product already in the catalog. The values sent replace the ones that were there. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "name": "<VALOR>",
    "url": "https://seu-dominio.com/webhook",
    "description": "<VALOR>",
    "priceAmount1000": 0,
    "currency": "BRL",
    "isHidden": false,
    "productId": "<VALOR>",
    "retailerId": "<VALOR>",
    "images": [
      {
        "url": ""
      }
    ]
  }
}
POSTProdutosBusinesstestado na API real

Enviar produto

Envia um produto específico do catálogo para um contato, que chega como card de produto do WhatsApp, com foto e preço.

POSThttps://{seu_host}/rest/product/sendProduct/{instance_key}

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "to": "5511999998888",
  "productIds": [
    ""
  ],
  "retailerIds": [
    ""
  ]
}
opcionalValor enviado no corpo: message data.
Informe o número que vai receber, com DDI+DDD e só dígitos, e o identificador do produto no catálogo.
AtributosTipoDescrição
tostring
productIdsarray
retailerIdsarray
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/product/sendProduct/<INSTANCE_KEY>" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "to": "5511999998888",
    "productIds": [
      ""
    ],
    "retailerIds": [
      ""
    ]
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/product/sendProduct/<INSTANCE_KEY>', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "productIds": [
      ""
    ],
    "retailerIds": [
      ""
    ]
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/product/sendProduct/<INSTANCE_KEY>', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "productIds": [
      ""
    ],
    "retailerIds": [
      ""
    ]
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to send product. On confirm, the backend must call POST /rest/product/sendProduct/{instance_key} on megaAPI using the configured instance and the securely stored token. Sends a specific catalog product to a contact, which arrives as a WhatsApp product card, with photo and price. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "to": "5511999998888",
    "productIds": [
      ""
    ],
    "retailerIds": [
      ""
    ]
  }
}
Claude Code
Implement a TypeScript function called product_instance_key-4 that calls POST https://apibusiness1.megaapi.com.br/rest/product/sendProduct/<INSTANCE_KEY> with Authorization Bearer <YOUR_TOKEN>. Sends a specific catalog product to a contact, which arrives as a WhatsApp product card, with photo and price. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "to": "5511999998888",
    "productIds": [
      ""
    ],
    "retailerIds": [
      ""
    ]
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the product.instance_key-4 integration in a Node.js service. Sends a specific catalog product to a contact, which arrives as a WhatsApp product card, with photo and price."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/product/sendProduct/<INSTANCE_KEY>",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "to": "5511999998888",
          "productIds": [
            ""
          ],
          "retailerIds": [
            ""
          ]
        }
      }
    }
  ]
}
Cursor
In the current project, implement the product_instance_key-4 client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/product/sendProduct/<INSTANCE_KEY>. Sends a specific catalog product to a contact, which arrives as a WhatsApp product card, with photo and price. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "to": "5511999998888",
    "productIds": [
      ""
    ],
    "retailerIds": [
      ""
    ]
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/product/sendProduct/<INSTANCE_KEY>. Auth: Bearer <YOUR_TOKEN>. Sends a specific catalog product to a contact, which arrives as a WhatsApp product card, with photo and price. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "to": "5511999998888",
    "productIds": [
      ""
    ],
    "retailerIds": [
      ""
    ]
  }
}
POSTProdutosBusinesstestado na API real

Visualizar informações do produto

Traz as informações completas de um produto do catálogo a partir do seu identificador.

POSThttps://{seu_host}/rest/product/infoProduct/{instance_key}

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "productIds": [
    ""
  ],
  "retailerIds": [
    ""
  ]
}
opcionalValor enviado no corpo: message data.
Use o identificador do produto retornado na listagem do catálogo.
AtributosTipoDescrição
productIdsarray
retailerIdsarray
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/product/infoProduct/<INSTANCE_KEY>" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "productIds": [
      ""
    ],
    "retailerIds": [
      ""
    ]
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/product/infoProduct/<INSTANCE_KEY>', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "productIds": [
      ""
    ],
    "retailerIds": [
      ""
    ]
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/product/infoProduct/<INSTANCE_KEY>', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "productIds": [
      ""
    ],
    "retailerIds": [
      ""
    ]
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to view product info. On confirm, the backend must call POST /rest/product/infoProduct/{instance_key} on megaAPI using the configured instance and the securely stored token. Brings the full information of a catalog product from its identifier. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "productIds": [
      ""
    ],
    "retailerIds": [
      ""
    ]
  }
}
Claude Code
Implement a TypeScript function called product_instance_key-5 that calls POST https://apibusiness1.megaapi.com.br/rest/product/infoProduct/<INSTANCE_KEY> with Authorization Bearer <YOUR_TOKEN>. Brings the full information of a catalog product from its identifier. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "productIds": [
      ""
    ],
    "retailerIds": [
      ""
    ]
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the product.instance_key-5 integration in a Node.js service. Brings the full information of a catalog product from its identifier."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/product/infoProduct/<INSTANCE_KEY>",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "productIds": [
            ""
          ],
          "retailerIds": [
            ""
          ]
        }
      }
    }
  ]
}
Cursor
In the current project, implement the product_instance_key-5 client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/product/infoProduct/<INSTANCE_KEY>. Brings the full information of a catalog product from its identifier. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "productIds": [
      ""
    ],
    "retailerIds": [
      ""
    ]
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/product/infoProduct/<INSTANCE_KEY>. Auth: Bearer <YOUR_TOKEN>. Brings the full information of a catalog product from its identifier. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "productIds": [
      ""
    ],
    "retailerIds": [
      ""
    ]
  }
}
POSTProdutosBusinesstestado na API real

Exibir ou ocultar produto

Torna um produto visível ou oculto no catálogo sem excluí-lo. O caminho certo para um item fora de estoque que vai voltar depois.

POSThttps://{seu_host}/rest/product/setProductVisibility/{instance_key}

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "isHidden": true,
  "productIds": [
    ""
  ]
}
opcionalValor enviado no corpo: message data.
`isHidden: true` esconde os produtos listados em `productIds`; `false` volta a exibi-los.
AtributosTipoDescrição
isHiddenboolean
productIdsarray
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/product/setProductVisibility/<INSTANCE_KEY>" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "isHidden": true,
    "productIds": [
      ""
    ]
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/product/setProductVisibility/<INSTANCE_KEY>', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "isHidden": true,
    "productIds": [
      ""
    ]
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/product/setProductVisibility/<INSTANCE_KEY>', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "isHidden": true,
    "productIds": [
      ""
    ]
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to show or hide product. On confirm, the backend must call POST /rest/product/setProductVisibility/{instance_key} on megaAPI using the configured instance and the securely stored token. Makes a product visible or hidden in the catalog without deleting it. The right path for an out-of-stock item that will come back later. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "isHidden": true,
    "productIds": [
      ""
    ]
  }
}
Claude Code
Implement a TypeScript function called product_instance_key-6 that calls POST https://apibusiness1.megaapi.com.br/rest/product/setProductVisibility/<INSTANCE_KEY> with Authorization Bearer <YOUR_TOKEN>. Makes a product visible or hidden in the catalog without deleting it. The right path for an out-of-stock item that will come back later. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "isHidden": true,
    "productIds": [
      ""
    ]
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the product.instance_key-6 integration in a Node.js service. Makes a product visible or hidden in the catalog without deleting it. The right path for an out-of-stock item that will come back later."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/product/setProductVisibility/<INSTANCE_KEY>",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "isHidden": true,
          "productIds": [
            ""
          ]
        }
      }
    }
  ]
}
Cursor
In the current project, implement the product_instance_key-6 client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/product/setProductVisibility/<INSTANCE_KEY>. Makes a product visible or hidden in the catalog without deleting it. The right path for an out-of-stock item that will come back later. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "isHidden": true,
    "productIds": [
      ""
    ]
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/product/setProductVisibility/<INSTANCE_KEY>. Auth: Bearer <YOUR_TOKEN>. Makes a product visible or hidden in the catalog without deleting it. The right path for an out-of-stock item that will come back later. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "isHidden": true,
    "productIds": [
      ""
    ]
  }
}
GETProdutosBusinesstestado na API real

Listar minhas coleções

Lista as coleções do catálogo do número conectado. Uma coleção é a pasta que agrupa produtos, como "Promoções" ou "Lançamentos".

GEThttps://{seu_host}/rest/product/listMyCollection/{instance_key}?limit=0

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
limitquerynumber0opcionalFiltro ou opção da consulta: limit.
Quantos itens trazer por vez. Comece baixo (ex.: 10) para não puxar o catálogo inteiro de uma vez.
curl
curl -X GET "https://apibusiness1.megaapi.com.br/rest/product/listMyCollection/<INSTANCE_KEY>?limit=0" \
  -H "Authorization: Bearer <SEU_TOKEN>"
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/product/listMyCollection/<INSTANCE_KEY>?limit=0', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' },
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/product/listMyCollection/<INSTANCE_KEY>?limit=0', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' }
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to list my collections. On confirm, the backend must call GET /rest/product/listMyCollection/{instance_key} on megaAPI using the configured instance and the securely stored token. Lists the collections in the connected number's catalog. A collection is the folder that groups products, like "Promotions" or "New releases". Show loading, success, and error states; do not expose the token in the browser. Example data: no JSON body
Claude Code
Implement a TypeScript function called product_instance_key-7 that calls GET https://apibusiness1.megaapi.com.br/rest/product/listMyCollection/<INSTANCE_KEY>?limit=0 with Authorization Bearer <YOUR_TOKEN>. Lists the collections in the connected number's catalog. A collection is the folder that groups products, like "Promotions" or "New releases". Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: no JSON body
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the product.instance_key-7 integration in a Node.js service. Lists the collections in the connected number's catalog. A collection is the folder that groups products, like \"Promotions\" or \"New releases\"."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "GET",
      "url": "GET https://apibusiness1.megaapi.com.br/rest/product/listMyCollection/<INSTANCE_KEY>?limit=0",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": null
    }
  ]
}
Cursor
In the current project, implement the product_instance_key-7 client in TypeScript for GET https://apibusiness1.megaapi.com.br/rest/product/listMyCollection/<INSTANCE_KEY>?limit=0. Lists the collections in the connected number's catalog. A collection is the folder that groups products, like "Promotions" or "New releases". Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: no JSON body
Codex
Create a TypeScript function for GET https://apibusiness1.megaapi.com.br/rest/product/listMyCollection/<INSTANCE_KEY>?limit=0. Auth: Bearer <YOUR_TOKEN>. Lists the collections in the connected number's catalog. A collection is the folder that groups products, like "Promotions" or "New releases". Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: no JSON body
GETProdutosBusinesstestado na API real

Listar coleções de outro número

Mostra as coleções do catálogo de outra empresa no WhatsApp.

GEThttps://{seu_host}/rest/product/listCollection/{instance_key}?to=5511999998888&limit=0

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
toquerystring"5511999998888"opcionalFiltro ou opção da consulta: to.
Número da empresa dona do catálogo, com DDI+DDD e só dígitos. Ex.: 5511999998888.
limitquerynumber0opcionalFiltro ou opção da consulta: limit.
Quantos itens trazer por vez. Comece baixo (ex.: 10) para não puxar o catálogo inteiro de uma vez.
curl
curl -X GET "https://apibusiness1.megaapi.com.br/rest/product/listCollection/<INSTANCE_KEY>?to=5511999998888&limit=0" \
  -H "Authorization: Bearer <SEU_TOKEN>"
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/product/listCollection/<INSTANCE_KEY>?to=5511999998888&limit=0', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' },
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/product/listCollection/<INSTANCE_KEY>?to=5511999998888&limit=0', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' }
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to list another number's collections. On confirm, the backend must call GET /rest/product/listCollection/{instance_key} on megaAPI using the configured instance and the securely stored token. Shows the collections of another company's catalog on WhatsApp. Show loading, success, and error states; do not expose the token in the browser. Example data: no JSON body
Claude Code
Implement a TypeScript function called product_instance_key-8 that calls GET https://apibusiness1.megaapi.com.br/rest/product/listCollection/<INSTANCE_KEY>?to=5511999998888&limit=0 with Authorization Bearer <YOUR_TOKEN>. Shows the collections of another company's catalog on WhatsApp. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: no JSON body
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the product.instance_key-8 integration in a Node.js service. Shows the collections of another company's catalog on WhatsApp."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "GET",
      "url": "GET https://apibusiness1.megaapi.com.br/rest/product/listCollection/<INSTANCE_KEY>?to=5511999998888&limit=0",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": null
    }
  ]
}
Cursor
In the current project, implement the product_instance_key-8 client in TypeScript for GET https://apibusiness1.megaapi.com.br/rest/product/listCollection/<INSTANCE_KEY>?to=5511999998888&limit=0. Shows the collections of another company's catalog on WhatsApp. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: no JSON body
Codex
Create a TypeScript function for GET https://apibusiness1.megaapi.com.br/rest/product/listCollection/<INSTANCE_KEY>?to=5511999998888&limit=0. Auth: Bearer <YOUR_TOKEN>. Shows the collections of another company's catalog on WhatsApp. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: no JSON body
POSTProdutosBusinesstestado na API real

Criar coleção

Cria uma coleção para agrupar produtos do catálogo, como "Promoções" ou "Lançamentos".

POSThttps://{seu_host}/rest/product/createCollection/{instance_key}

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "name": "<VALOR>",
  "productIds": [
    ""
  ],
  "retailerIds": [
    ""
  ]
}
opcionalValor enviado no corpo: message data.
Informe o nome da coleção e os produtos que entram nela, pelos identificadores do catálogo.
AtributosTipoDescrição
namestring
productIdsarray
retailerIdsarray
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/product/createCollection/<INSTANCE_KEY>" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "name": "<VALOR>",
    "productIds": [
      ""
    ],
    "retailerIds": [
      ""
    ]
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/product/createCollection/<INSTANCE_KEY>', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "name": "<VALOR>",
    "productIds": [
      ""
    ],
    "retailerIds": [
      ""
    ]
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/product/createCollection/<INSTANCE_KEY>', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "name": "<VALOR>",
    "productIds": [
      ""
    ],
    "retailerIds": [
      ""
    ]
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to create collection. On confirm, the backend must call POST /rest/product/createCollection/{instance_key} on megaAPI using the configured instance and the securely stored token. Creates a collection to group catalog products, like "Promotions" or "New releases". Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "name": "<VALOR>",
    "productIds": [
      ""
    ],
    "retailerIds": [
      ""
    ]
  }
}
Claude Code
Implement a TypeScript function called product_instance_key-9 that calls POST https://apibusiness1.megaapi.com.br/rest/product/createCollection/<INSTANCE_KEY> with Authorization Bearer <YOUR_TOKEN>. Creates a collection to group catalog products, like "Promotions" or "New releases". Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "name": "<VALOR>",
    "productIds": [
      ""
    ],
    "retailerIds": [
      ""
    ]
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the product.instance_key-9 integration in a Node.js service. Creates a collection to group catalog products, like \"Promotions\" or \"New releases\"."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/product/createCollection/<INSTANCE_KEY>",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "name": "<VALOR>",
          "productIds": [
            ""
          ],
          "retailerIds": [
            ""
          ]
        }
      }
    }
  ]
}
Cursor
In the current project, implement the product_instance_key-9 client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/product/createCollection/<INSTANCE_KEY>. Creates a collection to group catalog products, like "Promotions" or "New releases". Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "name": "<VALOR>",
    "productIds": [
      ""
    ],
    "retailerIds": [
      ""
    ]
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/product/createCollection/<INSTANCE_KEY>. Auth: Bearer <YOUR_TOKEN>. Creates a collection to group catalog products, like "Promotions" or "New releases". Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "name": "<VALOR>",
    "productIds": [
      ""
    ],
    "retailerIds": [
      ""
    ]
  }
}
POSTProdutosBusinesstestado na API real

Enviar catálogo

Envia o catálogo do número conectado para um contato, como mensagem do WhatsApp.

POSThttps://{seu_host}/rest/product/sendCatalog/{instance_key}

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{}
opcionalValor enviado no corpo: message data.
Informe o número que vai receber o catálogo, com DDI+DDD e só dígitos.
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/product/sendCatalog/<INSTANCE_KEY>" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {}
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/product/sendCatalog/<INSTANCE_KEY>', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {}
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/product/sendCatalog/<INSTANCE_KEY>', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {}
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to send catalog. On confirm, the backend must call POST /rest/product/sendCatalog/{instance_key} on megaAPI using the configured instance and the securely stored token. Sends the connected number's catalog to a contact, as a WhatsApp message. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {}
}
Claude Code
Implement a TypeScript function called product_post_instance_key that calls POST https://apibusiness1.megaapi.com.br/rest/product/sendCatalog/<INSTANCE_KEY> with Authorization Bearer <YOUR_TOKEN>. Sends the connected number's catalog to a contact, as a WhatsApp message. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {}
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the product.post.instance_key integration in a Node.js service. Sends the connected number's catalog to a contact, as a WhatsApp message."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/product/sendCatalog/<INSTANCE_KEY>",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {}
      }
    }
  ]
}
Cursor
In the current project, implement the product_post_instance_key client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/product/sendCatalog/<INSTANCE_KEY>. Sends the connected number's catalog to a contact, as a WhatsApp message. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {}
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/product/sendCatalog/<INSTANCE_KEY>. Auth: Bearer <YOUR_TOKEN>. Sends the connected number's catalog to a contact, as a WhatsApp message. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {}
}
POSTMensagensBusinesstestado na API real

Enviar áudio

Envia um arquivo de áudio, que chega como anexo com os controles normais de reprodução. Para que o áudio pareça gravado ao vivo, use o endpoint de mensagem de voz.

POSThttps://{seu_host}/rest/sendMessage/{instance_key}/audio?to=5511999998888&viewOnce=false

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
toquerystring"5511999998888"opcionalFiltro ou opção da consulta: to.
Ex.: 55 (Brasil) + 11 (DDD) + número, tudo junto e só dígitos. Nunca use +, espaço ou traço. Para grupo, use o ID terminado em @g.us.
viewOncequerybooleanfalseopcionalFiltro ou opção da consulta: view once.
true faz a mídia sumir depois de aberta uma única vez — nem o destinatário nem você conseguem reabrir ou baixar depois.
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/audio?to=5511999998888&viewOnce=false" \
  -H "Authorization: Bearer <SEU_TOKEN>"
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/audio?to=5511999998888&viewOnce=false', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' },
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/audio?to=5511999998888&viewOnce=false', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' }
});
console.log(await response.json());
HTTP 400
{
  "name": "BAD_REQUEST",
  "message": "<VALOR>",
  "status": 400,
  "errors": [],
  "stack": "<VALOR>"
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to send audio. On confirm, the backend must call POST /rest/sendMessage/{instance_key}/audio on megaAPI using the configured instance and the securely stored token. Sends an audio file, which arrives as an attachment with the normal play controls. To make the audio sound recorded live, use the voice message endpoint. Show loading, success, and error states; do not expose the token in the browser. Example data: no JSON body
Claude Code
Implement a TypeScript function called sendMessage_audio that calls POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/audio?to=5511999998888&viewOnce=false with Authorization Bearer <YOUR_TOKEN>. Sends an audio file, which arrives as an attachment with the normal play controls. To make the audio sound recorded live, use the voice message endpoint. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: no JSON body
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the sendMessage.audio integration in a Node.js service. Sends an audio file, which arrives as an attachment with the normal play controls. To make the audio sound recorded live, use the voice message endpoint."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/audio?to=5511999998888&viewOnce=false",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": null
    }
  ]
}
Cursor
In the current project, implement the sendMessage_audio client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/audio?to=5511999998888&viewOnce=false. Sends an audio file, which arrives as an attachment with the normal play controls. To make the audio sound recorded live, use the voice message endpoint. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: no JSON body
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/audio?to=5511999998888&viewOnce=false. Auth: Bearer <YOUR_TOKEN>. Sends an audio file, which arrives as an attachment with the normal play controls. To make the audio sound recorded live, use the voice message endpoint. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: no JSON body
POSTMensagensBusinessStarttestado na API real

Enviar mensagem com botões

Envia uma mensagem com botões clicáveis, para que a pessoa responda tocando em vez de digitando. Nem toda versão do WhatsApp exibe os botões, então escreva o texto de modo que ainda faça sentido sem eles.

POSThttps://{seu_host}/rest/sendMessage/{instance_key}/buttonMessage

Disponível em mais de um plano — troque o host conforme a sua instância:

Business: apibusiness1.megaapi.com.brStart: apistart01.megaapi.com.br / apistart02.megaapi.com.br / apistart03.megaapi.com.br
CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "to": "5511999998888",
  "title": "<VALOR>",
  "text": "<VALOR>",
  "footer": "<VALOR>",
  "type": "<VALOR>",
  "mediaUrl": "https://seu-dominio.com/webhook",
  "buttons": []
}
opcionalValor enviado no corpo: message data.
AtributosTipoDescrição
tostring
titlestring
textstring
footerstring
typestring
mediaUrlstring
buttonsarray
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/buttonMessage" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "to": "5511999998888",
    "title": "<VALOR>",
    "text": "<VALOR>",
    "footer": "<VALOR>",
    "type": "<VALOR>",
    "mediaUrl": "https://seu-dominio.com/webhook",
    "buttons": []
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/buttonMessage', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "title": "<VALOR>",
    "text": "<VALOR>",
    "footer": "<VALOR>",
    "type": "<VALOR>",
    "mediaUrl": "https://seu-dominio.com/webhook",
    "buttons": []
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/buttonMessage', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "title": "<VALOR>",
    "text": "<VALOR>",
    "footer": "<VALOR>",
    "type": "<VALOR>",
    "mediaUrl": "https://seu-dominio.com/webhook",
    "buttons": []
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to send message with buttons. On confirm, the backend must call POST /rest/sendMessage/{instance_key}/buttonMessage on megaAPI using the configured instance and the securely stored token. Sends a message with clickable buttons, so the person can reply by tapping instead of typing. Not every WhatsApp version shows the buttons, so write the text so it still makes sense without them. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "to": "5511999998888",
    "title": "<VALOR>",
    "text": "<VALOR>",
    "footer": "<VALOR>",
    "type": "<VALOR>",
    "mediaUrl": "https://seu-dominio.com/webhook",
    "buttons": []
  }
}
Claude Code
Implement a TypeScript function called sendMessage_buttonMessage that calls POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/buttonMessage with Authorization Bearer <YOUR_TOKEN>. Sends a message with clickable buttons, so the person can reply by tapping instead of typing. Not every WhatsApp version shows the buttons, so write the text so it still makes sense without them. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "to": "5511999998888",
    "title": "<VALOR>",
    "text": "<VALOR>",
    "footer": "<VALOR>",
    "type": "<VALOR>",
    "mediaUrl": "https://seu-dominio.com/webhook",
    "buttons": []
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the sendMessage.buttonMessage integration in a Node.js service. Sends a message with clickable buttons, so the person can reply by tapping instead of typing. Not every WhatsApp version shows the buttons, so write the text so it still makes sense without them."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/buttonMessage",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "to": "5511999998888",
          "title": "<VALOR>",
          "text": "<VALOR>",
          "footer": "<VALOR>",
          "type": "<VALOR>",
          "mediaUrl": "https://seu-dominio.com/webhook",
          "buttons": []
        }
      }
    }
  ]
}
Cursor
In the current project, implement the sendMessage_buttonMessage client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/buttonMessage. Sends a message with clickable buttons, so the person can reply by tapping instead of typing. Not every WhatsApp version shows the buttons, so write the text so it still makes sense without them. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "to": "5511999998888",
    "title": "<VALOR>",
    "text": "<VALOR>",
    "footer": "<VALOR>",
    "type": "<VALOR>",
    "mediaUrl": "https://seu-dominio.com/webhook",
    "buttons": []
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/buttonMessage. Auth: Bearer <YOUR_TOKEN>. Sends a message with clickable buttons, so the person can reply by tapping instead of typing. Not every WhatsApp version shows the buttons, so write the text so it still makes sense without them. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "to": "5511999998888",
    "title": "<VALOR>",
    "text": "<VALOR>",
    "footer": "<VALOR>",
    "type": "<VALOR>",
    "mediaUrl": "https://seu-dominio.com/webhook",
    "buttons": []
  }
}
POSTMensagensBusinessStarttestado na API real

Enviar contato

Envia um cartão de contato que a pessoa salva na agenda com um toque, em vez de copiar o número manualmente.

POSThttps://{seu_host}/rest/sendMessage/{instance_key}/contactMessage

Disponível em mais de um plano — troque o host conforme a sua instância:

Business: apibusiness1.megaapi.com.brStart: apistart01.megaapi.com.br / apistart02.megaapi.com.br / apistart03.megaapi.com.br
CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "to": "5511999998888",
  "vcard": {
    "fullName": "<VALOR>",
    "displayName": "<VALOR>",
    "organization": "<VALOR>",
    "phoneNumber": "5511999998888"
  }
}
opcionalValor enviado no corpo: message data.
Dentro de `vcard`, `fullName` é o nome que aparece no cartão e `phoneNumber` o telefone com DDI+DDD e só dígitos.
AtributosTipoDescrição
tostringContato que vai receber a mensagem
fullNamestringNome do contato
displayNamestringNome do contato que irá aparecer no card
organizationstringNome da empresa ou nome do contato
phoneNumberstringTelefone do contato que você quer compartilhar(DDI DDD Número Ex: 551199999999)
vcardobject
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/contactMessage" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "to": "5511999998888",
    "vcard": {
      "fullName": "<VALOR>",
      "displayName": "<VALOR>",
      "organization": "<VALOR>",
      "phoneNumber": "5511999998888"
    }
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/contactMessage', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "vcard": {
      "fullName": "<VALOR>",
      "displayName": "<VALOR>",
      "organization": "<VALOR>",
      "phoneNumber": "5511999998888"
    }
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/contactMessage', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "vcard": {
      "fullName": "<VALOR>",
      "displayName": "<VALOR>",
      "organization": "<VALOR>",
      "phoneNumber": "5511999998888"
    }
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to send contact. On confirm, the backend must call POST /rest/sendMessage/{instance_key}/contactMessage on megaAPI using the configured instance and the securely stored token. Sends a contact card the person saves to their address book with one tap, instead of copying the number by hand. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "to": "5511999998888",
    "vcard": {
      "fullName": "<VALOR>",
      "displayName": "<VALOR>",
      "organization": "<VALOR>",
      "phoneNumber": "5511999998888"
    }
  }
}
Claude Code
Implement a TypeScript function called sendMessage_contactMessage that calls POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/contactMessage with Authorization Bearer <YOUR_TOKEN>. Sends a contact card the person saves to their address book with one tap, instead of copying the number by hand. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "to": "5511999998888",
    "vcard": {
      "fullName": "<VALOR>",
      "displayName": "<VALOR>",
      "organization": "<VALOR>",
      "phoneNumber": "5511999998888"
    }
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the sendMessage.contactMessage integration in a Node.js service. Sends a contact card the person saves to their address book with one tap, instead of copying the number by hand."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/contactMessage",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "to": "5511999998888",
          "vcard": {
            "fullName": "<VALOR>",
            "displayName": "<VALOR>",
            "organization": "<VALOR>",
            "phoneNumber": "5511999998888"
          }
        }
      }
    }
  ]
}
Cursor
In the current project, implement the sendMessage_contactMessage client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/contactMessage. Sends a contact card the person saves to their address book with one tap, instead of copying the number by hand. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "to": "5511999998888",
    "vcard": {
      "fullName": "<VALOR>",
      "displayName": "<VALOR>",
      "organization": "<VALOR>",
      "phoneNumber": "5511999998888"
    }
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/contactMessage. Auth: Bearer <YOUR_TOKEN>. Sends a contact card the person saves to their address book with one tap, instead of copying the number by hand. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "to": "5511999998888",
    "vcard": {
      "fullName": "<VALOR>",
      "displayName": "<VALOR>",
      "organization": "<VALOR>",
      "phoneNumber": "5511999998888"
    }
  }
}
POSTMensagensBusinesstestado na API real

Enviar documento

Envia um arquivo como documento: PDF, planilha, apresentação e similares. Diferente de uma imagem, chega com o nome do arquivo e o destinatário precisa baixá-lo para abrir.

POSThttps://{seu_host}/rest/sendMessage/{instance_key}/document?to=5511999998888&caption=<VALOR>

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
toquerystring"5511999998888"opcionalFiltro ou opção da consulta: to.
Ex.: 55 (Brasil) + 11 (DDD) + número, tudo junto e só dígitos. Nunca use +, espaço ou traço. Para grupo, use o ID terminado em @g.us.
captionquerystring"<VALOR>"opcionalFiltro ou opção da consulta: caption.
Legenda que aparece junto do arquivo. Pode ficar em branco.
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/document?to=5511999998888&caption=<VALOR>" \
  -H "Authorization: Bearer <SEU_TOKEN>"
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/document?to=5511999998888&caption=<VALOR>', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' },
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/document?to=5511999998888&caption=<VALOR>', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' }
});
console.log(await response.json());
HTTP 400
{
  "name": "BAD_REQUEST",
  "message": "<VALOR>",
  "status": 400,
  "errors": [],
  "stack": "<VALOR>"
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to send document. On confirm, the backend must call POST /rest/sendMessage/{instance_key}/document on megaAPI using the configured instance and the securely stored token. Sends a file as a document: PDF, spreadsheet, presentation, and the like. Unlike an image, it arrives with the file name and the recipient has to download it to open. Show loading, success, and error states; do not expose the token in the browser. Example data: no JSON body
Claude Code
Implement a TypeScript function called sendMessage_document that calls POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/document?to=5511999998888&caption=<VALOR> with Authorization Bearer <YOUR_TOKEN>. Sends a file as a document: PDF, spreadsheet, presentation, and the like. Unlike an image, it arrives with the file name and the recipient has to download it to open. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: no JSON body
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the sendMessage.document integration in a Node.js service. Sends a file as a document: PDF, spreadsheet, presentation, and the like. Unlike an image, it arrives with the file name and the recipient has to download it to open."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/document?to=5511999998888&caption=<VALOR>",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": null
    }
  ]
}
Cursor
In the current project, implement the sendMessage_document client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/document?to=5511999998888&caption=<VALOR>. Sends a file as a document: PDF, spreadsheet, presentation, and the like. Unlike an image, it arrives with the file name and the recipient has to download it to open. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: no JSON body
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/document?to=5511999998888&caption=<VALOR>. Auth: Bearer <YOUR_TOKEN>. Sends a file as a document: PDF, spreadsheet, presentation, and the like. Unlike an image, it arrives with the file name and the recipient has to download it to open. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: no JSON body
POSTMensagensBusinesstestado na API real

Editar mensagem enviada

Corrige o texto de uma mensagem que a instance já enviou. O WhatsApp só permite edição por um período curto após o envio, e a conversa passa a exibir o marcador "editada".

POSThttps://{seu_host}/rest/sendMessage/{instance_key}/editMessage

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "to": "5511999998888",
  "key": {},
  "newMessage": "<VALOR>"
}
opcionalValor enviado no corpo: message data.
`newMessage` é o texto corrigido. O campo `key` identifica a mensagem original. Copie exatamente como veio no webhook ou na listagem de mensagens; não dá para montar à mão.
AtributosTipoDescrição
tostring
keyobject
newMessagestring
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/editMessage" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "to": "5511999998888",
    "key": {},
    "newMessage": "<VALOR>"
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/editMessage', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "key": {},
    "newMessage": "<VALOR>"
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/editMessage', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "key": {},
    "newMessage": "<VALOR>"
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to edit sent message. On confirm, the backend must call POST /rest/sendMessage/{instance_key}/editMessage on megaAPI using the configured instance and the securely stored token. Fixes the text of a message the instance already sent. WhatsApp only allows editing for a short period after sending, and the conversation starts showing the "edited" marker. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "to": "5511999998888",
    "key": {},
    "newMessage": "<VALOR>"
  }
}
Claude Code
Implement a TypeScript function called sendMessage_editMessage that calls POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/editMessage with Authorization Bearer <YOUR_TOKEN>. Fixes the text of a message the instance already sent. WhatsApp only allows editing for a short period after sending, and the conversation starts showing the "edited" marker. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "to": "5511999998888",
    "key": {},
    "newMessage": "<VALOR>"
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the sendMessage.editMessage integration in a Node.js service. Fixes the text of a message the instance already sent. WhatsApp only allows editing for a short period after sending, and the conversation starts showing the \"edited\" marker."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/editMessage",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "to": "5511999998888",
          "key": {},
          "newMessage": "<VALOR>"
        }
      }
    }
  ]
}
Cursor
In the current project, implement the sendMessage_editMessage client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/editMessage. Fixes the text of a message the instance already sent. WhatsApp only allows editing for a short period after sending, and the conversation starts showing the "edited" marker. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "to": "5511999998888",
    "key": {},
    "newMessage": "<VALOR>"
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/editMessage. Auth: Bearer <YOUR_TOKEN>. Fixes the text of a message the instance already sent. WhatsApp only allows editing for a short period after sending, and the conversation starts showing the "edited" marker. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "to": "5511999998888",
    "key": {},
    "newMessage": "<VALOR>"
  }
}
POSTMensagensBusinessStartNoCodetestado na API real

Encaminhar mensagem

Encaminha uma mensagem existente para outra conversa, da mesma forma que o botão de encaminhar do aplicativo.

POSThttps://{seu_host}/rest/sendMessage/{instance_key}/forwardMessage

Disponível em mais de um plano — troque o host conforme a sua instância:

Business: apibusiness1.megaapi.com.brStart: apistart01.megaapi.com.br / apistart02.megaapi.com.br / apistart03.megaapi.com.brNoCode: apinocode01.megaapi.com.br / apinocode02.megaapi.com.br
CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "to": "5511999998888",
  "key": {},
  "message": {}
}
opcionalValor enviado no corpo: message data.
O campo `key` identifica a mensagem original. Copie exatamente como veio no webhook ou na listagem de mensagens; não dá para montar à mão.
AtributosTipoDescrição
tostringContato que vai receber a mensagem
keyobjectObjeto que contem as informações necessárias para reencaminhar a mensagem
messageobjectObjeto que contem as informações necessárias para reencaminhar a mensagem
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/forwardMessage" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "to": "5511999998888",
    "key": {},
    "message": {}
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/forwardMessage', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "key": {},
    "message": {}
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/forwardMessage', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "key": {},
    "message": {}
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to forward message. On confirm, the backend must call POST /rest/sendMessage/{instance_key}/forwardMessage on megaAPI using the configured instance and the securely stored token. Forwards an existing message to another conversation, the same way the app's forward button does. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "to": "5511999998888",
    "key": {},
    "message": {}
  }
}
Claude Code
Implement a TypeScript function called sendMessage_forwardMessage that calls POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/forwardMessage with Authorization Bearer <YOUR_TOKEN>. Forwards an existing message to another conversation, the same way the app's forward button does. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "to": "5511999998888",
    "key": {},
    "message": {}
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the sendMessage.forwardMessage integration in a Node.js service. Forwards an existing message to another conversation, the same way the app's forward button does."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/forwardMessage",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "to": "5511999998888",
          "key": {},
          "message": {}
        }
      }
    }
  ]
}
Cursor
In the current project, implement the sendMessage_forwardMessage client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/forwardMessage. Forwards an existing message to another conversation, the same way the app's forward button does. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "to": "5511999998888",
    "key": {},
    "message": {}
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/forwardMessage. Auth: Bearer <YOUR_TOKEN>. Forwards an existing message to another conversation, the same way the app's forward button does. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "to": "5511999998888",
    "key": {},
    "message": {}
  }
}
POSTMensagensBusinesstestado na API real

Enviar imagem

Envia uma foto, com legenda opcional, para um número de WhatsApp.

POSThttps://{seu_host}/rest/sendMessage/{instance_key}/image?to=5511999998888&caption=<VALOR>&viewOnce=false

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
toquerystring"5511999998888"opcionalFiltro ou opção da consulta: to.
Ex.: 55 (Brasil) + 11 (DDD) + número, tudo junto e só dígitos. Nunca use +, espaço ou traço. Para grupo, use o ID terminado em @g.us.
captionquerystring"<VALOR>"opcionalFiltro ou opção da consulta: caption.
Legenda que aparece junto do arquivo. Pode ficar em branco.
viewOncequerybooleanfalseopcionalFiltro ou opção da consulta: view once.
true faz a mídia sumir depois de aberta uma única vez — nem o destinatário nem você conseguem reabrir ou baixar depois.
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/image?to=5511999998888&caption=<VALOR>&viewOnce=false" \
  -H "Authorization: Bearer <SEU_TOKEN>"
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/image?to=5511999998888&caption=<VALOR>&viewOnce=false', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' },
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/image?to=5511999998888&caption=<VALOR>&viewOnce=false', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' }
});
console.log(await response.json());
HTTP 400
{
  "name": "BAD_REQUEST",
  "message": "<VALOR>",
  "status": 400,
  "errors": [],
  "stack": "<VALOR>"
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to send image. On confirm, the backend must call POST /rest/sendMessage/{instance_key}/image on megaAPI using the configured instance and the securely stored token. Sends a photo, with optional caption, to a WhatsApp number. Show loading, success, and error states; do not expose the token in the browser. Example data: no JSON body
Claude Code
Implement a TypeScript function called sendMessage_image that calls POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/image?to=5511999998888&caption=<VALOR>&viewOnce=false with Authorization Bearer <YOUR_TOKEN>. Sends a photo, with optional caption, to a WhatsApp number. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: no JSON body
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the sendMessage.image integration in a Node.js service. Sends a photo, with optional caption, to a WhatsApp number."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/image?to=5511999998888&caption=<VALOR>&viewOnce=false",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": null
    }
  ]
}
Cursor
In the current project, implement the sendMessage_image client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/image?to=5511999998888&caption=<VALOR>&viewOnce=false. Sends a photo, with optional caption, to a WhatsApp number. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: no JSON body
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/image?to=5511999998888&caption=<VALOR>&viewOnce=false. Auth: Bearer <YOUR_TOKEN>. Sends a photo, with optional caption, to a WhatsApp number. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: no JSON body
POSTMensagensBusinessStartNoCodetestado na API real

Enviar menu de opções

Envia um menu: a pessoa toca em um botão e escolhe um item de uma lista. Bom para atendimento, quando você quer respostas previsíveis em vez de texto livre.

POSThttps://{seu_host}/rest/sendMessage/{instance_key}/listMessage

Disponível em mais de um plano — troque o host conforme a sua instância:

Business: apibusiness1.megaapi.com.brStart: apistart01.megaapi.com.br / apistart02.megaapi.com.br / apistart03.megaapi.com.brNoCode: apinocode01.megaapi.com.br / apinocode02.megaapi.com.br
CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "to": "5511999998888",
  "buttonText": "<VALOR>",
  "text": "<VALOR>",
  "title": "<VALOR>",
  "type": "<VALOR>",
  "mediaUrl": "https://seu-dominio.com/webhook",
  "gifPlayback": false,
  "description": "<VALOR>",
  "sections": []
}
opcionalValor enviado no corpo: message data.
AtributosTipoDescrição
tostringContato whatsapp que vai receber a mensagem
buttonTextstringTítulo do botão
textstringMensagem
titlestringTítulo da mensagem
descriptionstringDescrição
sectionsarrayLista de seções
rowsarrayLista de itens
rowIdstringID do item
typestring
mediaUrlstring
gifPlaybackboolean
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/listMessage" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "to": "5511999998888",
    "buttonText": "<VALOR>",
    "text": "<VALOR>",
    "title": "<VALOR>",
    "type": "<VALOR>",
    "mediaUrl": "https://seu-dominio.com/webhook",
    "gifPlayback": false,
    "description": "<VALOR>",
    "sections": []
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/listMessage', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "buttonText": "<VALOR>",
    "text": "<VALOR>",
    "title": "<VALOR>",
    "type": "<VALOR>",
    "mediaUrl": "https://seu-dominio.com/webhook",
    "gifPlayback": false,
    "description": "<VALOR>",
    "sections": []
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/listMessage', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "buttonText": "<VALOR>",
    "text": "<VALOR>",
    "title": "<VALOR>",
    "type": "<VALOR>",
    "mediaUrl": "https://seu-dominio.com/webhook",
    "gifPlayback": false,
    "description": "<VALOR>",
    "sections": []
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to send options menu. On confirm, the backend must call POST /rest/sendMessage/{instance_key}/listMessage on megaAPI using the configured instance and the securely stored token. Sends a menu: the person taps a button and picks an item from a list. Good for support, when you want predictable replies instead of free-form text. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "to": "5511999998888",
    "buttonText": "<VALOR>",
    "text": "<VALOR>",
    "title": "<VALOR>",
    "type": "<VALOR>",
    "mediaUrl": "https://seu-dominio.com/webhook",
    "gifPlayback": false,
    "description": "<VALOR>",
    "sections": []
  }
}
Claude Code
Implement a TypeScript function called sendMessage_listMessage that calls POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/listMessage with Authorization Bearer <YOUR_TOKEN>. Sends a menu: the person taps a button and picks an item from a list. Good for support, when you want predictable replies instead of free-form text. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "to": "5511999998888",
    "buttonText": "<VALOR>",
    "text": "<VALOR>",
    "title": "<VALOR>",
    "type": "<VALOR>",
    "mediaUrl": "https://seu-dominio.com/webhook",
    "gifPlayback": false,
    "description": "<VALOR>",
    "sections": []
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the sendMessage.listMessage integration in a Node.js service. Sends a menu: the person taps a button and picks an item from a list. Good for support, when you want predictable replies instead of free-form text."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/listMessage",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "to": "5511999998888",
          "buttonText": "<VALOR>",
          "text": "<VALOR>",
          "title": "<VALOR>",
          "type": "<VALOR>",
          "mediaUrl": "https://seu-dominio.com/webhook",
          "gifPlayback": false,
          "description": "<VALOR>",
          "sections": []
        }
      }
    }
  ]
}
Cursor
In the current project, implement the sendMessage_listMessage client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/listMessage. Sends a menu: the person taps a button and picks an item from a list. Good for support, when you want predictable replies instead of free-form text. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "to": "5511999998888",
    "buttonText": "<VALOR>",
    "text": "<VALOR>",
    "title": "<VALOR>",
    "type": "<VALOR>",
    "mediaUrl": "https://seu-dominio.com/webhook",
    "gifPlayback": false,
    "description": "<VALOR>",
    "sections": []
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/listMessage. Auth: Bearer <YOUR_TOKEN>. Sends a menu: the person taps a button and picks an item from a list. Good for support, when you want predictable replies instead of free-form text. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "to": "5511999998888",
    "buttonText": "<VALOR>",
    "text": "<VALOR>",
    "title": "<VALOR>",
    "type": "<VALOR>",
    "mediaUrl": "https://seu-dominio.com/webhook",
    "gifPlayback": false,
    "description": "<VALOR>",
    "sections": []
  }
}
POSTMensagensBusinesstestado na API real

Enviar menu de opções para vários

Envia o mesmo menu de opções para uma lista de números em uma única chamada.

POSThttps://{seu_host}/rest/sendMessage/{instance_key}/listMessageToMany

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "to": [
    ""
  ],
  "buttonText": "<VALOR>",
  "text": "<VALOR>",
  "title": "<VALOR>",
  "description": "<VALOR>",
  "sections": []
}
opcionalValor enviado no corpo: message data.
AtributosTipoDescrição
toarrayContatos whatsapp que vão receber a mensagem
buttonTextstringTítulo do botão
textstringMensagem
titlestringTítulo da mensagem
descriptionstringDescrição
sectionsarrayLista de seções
rowsarrayLista de itens
rowIdstringID do item
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/listMessageToMany" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "to": [
      ""
    ],
    "buttonText": "<VALOR>",
    "text": "<VALOR>",
    "title": "<VALOR>",
    "description": "<VALOR>",
    "sections": []
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/listMessageToMany', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": [
      ""
    ],
    "buttonText": "<VALOR>",
    "text": "<VALOR>",
    "title": "<VALOR>",
    "description": "<VALOR>",
    "sections": []
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/listMessageToMany', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": [
      ""
    ],
    "buttonText": "<VALOR>",
    "text": "<VALOR>",
    "title": "<VALOR>",
    "description": "<VALOR>",
    "sections": []
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to send options menu to many. On confirm, the backend must call POST /rest/sendMessage/{instance_key}/listMessageToMany on megaAPI using the configured instance and the securely stored token. Sends the same options menu to a list of numbers in a single call. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "to": [
      ""
    ],
    "buttonText": "<VALOR>",
    "text": "<VALOR>",
    "title": "<VALOR>",
    "description": "<VALOR>",
    "sections": []
  }
}
Claude Code
Implement a TypeScript function called sendMessage_listMessageToMany that calls POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/listMessageToMany with Authorization Bearer <YOUR_TOKEN>. Sends the same options menu to a list of numbers in a single call. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "to": [
      ""
    ],
    "buttonText": "<VALOR>",
    "text": "<VALOR>",
    "title": "<VALOR>",
    "description": "<VALOR>",
    "sections": []
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the sendMessage.listMessageToMany integration in a Node.js service. Sends the same options menu to a list of numbers in a single call."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/listMessageToMany",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "to": [
            ""
          ],
          "buttonText": "<VALOR>",
          "text": "<VALOR>",
          "title": "<VALOR>",
          "description": "<VALOR>",
          "sections": []
        }
      }
    }
  ]
}
Cursor
In the current project, implement the sendMessage_listMessageToMany client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/listMessageToMany. Sends the same options menu to a list of numbers in a single call. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "to": [
      ""
    ],
    "buttonText": "<VALOR>",
    "text": "<VALOR>",
    "title": "<VALOR>",
    "description": "<VALOR>",
    "sections": []
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/listMessageToMany. Auth: Bearer <YOUR_TOKEN>. Sends the same options menu to a list of numbers in a single call. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "to": [
      ""
    ],
    "buttonText": "<VALOR>",
    "text": "<VALOR>",
    "title": "<VALOR>",
    "description": "<VALOR>",
    "sections": []
  }
}
POSTMensagensBusinesstestado na API real

Enviar lista de produtos

Envia uma lista de produtos do catálogo do WhatsApp Business para a pessoa escolher. Os produtos já devem estar cadastrados no catálogo.

POSThttps://{seu_host}/rest/sendMessage/{instance_key}/listProductMessage

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "to": "5511999998888",
  "text": "<VALOR>",
  "title": "<VALOR>",
  "description": "<VALOR>",
  "productSections": [],
  "urlThumbnail": "https://seu-dominio.com/webhook"
}
opcionalValor enviado no corpo: message data.
AtributosTipoDescrição
tostring
textstring
titlestring
descriptionstring
productSectionsarray
urlThumbnailstring
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/listProductMessage" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "to": "5511999998888",
    "text": "<VALOR>",
    "title": "<VALOR>",
    "description": "<VALOR>",
    "productSections": [],
    "urlThumbnail": "https://seu-dominio.com/webhook"
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/listProductMessage', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "text": "<VALOR>",
    "title": "<VALOR>",
    "description": "<VALOR>",
    "productSections": [],
    "urlThumbnail": "https://seu-dominio.com/webhook"
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/listProductMessage', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "text": "<VALOR>",
    "title": "<VALOR>",
    "description": "<VALOR>",
    "productSections": [],
    "urlThumbnail": "https://seu-dominio.com/webhook"
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to send product list. On confirm, the backend must call POST /rest/sendMessage/{instance_key}/listProductMessage on megaAPI using the configured instance and the securely stored token. Sends a list of products from the WhatsApp Business catalog for the person to choose from. The products must already be registered in the catalog. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "to": "5511999998888",
    "text": "<VALOR>",
    "title": "<VALOR>",
    "description": "<VALOR>",
    "productSections": [],
    "urlThumbnail": "https://seu-dominio.com/webhook"
  }
}
Claude Code
Implement a TypeScript function called sendMessage_listProductMessage that calls POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/listProductMessage with Authorization Bearer <YOUR_TOKEN>. Sends a list of products from the WhatsApp Business catalog for the person to choose from. The products must already be registered in the catalog. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "to": "5511999998888",
    "text": "<VALOR>",
    "title": "<VALOR>",
    "description": "<VALOR>",
    "productSections": [],
    "urlThumbnail": "https://seu-dominio.com/webhook"
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the sendMessage.listProductMessage integration in a Node.js service. Sends a list of products from the WhatsApp Business catalog for the person to choose from. The products must already be registered in the catalog."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/listProductMessage",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "to": "5511999998888",
          "text": "<VALOR>",
          "title": "<VALOR>",
          "description": "<VALOR>",
          "productSections": [],
          "urlThumbnail": "https://seu-dominio.com/webhook"
        }
      }
    }
  ]
}
Cursor
In the current project, implement the sendMessage_listProductMessage client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/listProductMessage. Sends a list of products from the WhatsApp Business catalog for the person to choose from. The products must already be registered in the catalog. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "to": "5511999998888",
    "text": "<VALOR>",
    "title": "<VALOR>",
    "description": "<VALOR>",
    "productSections": [],
    "urlThumbnail": "https://seu-dominio.com/webhook"
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/listProductMessage. Auth: Bearer <YOUR_TOKEN>. Sends a list of products from the WhatsApp Business catalog for the person to choose from. The products must already be registered in the catalog. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "to": "5511999998888",
    "text": "<VALOR>",
    "title": "<VALOR>",
    "description": "<VALOR>",
    "productSections": [],
    "urlThumbnail": "https://seu-dominio.com/webhook"
  }
}
POSTMensagensBusinessStartNoCodetestado na API real

Enviar localização

Envia um ponto no mapa, que chega como o cartão de localização do WhatsApp, com endereço e miniatura.

POSThttps://{seu_host}/rest/sendMessage/{instance_key}/location

Disponível em mais de um plano — troque o host conforme a sua instância:

Business: apibusiness1.megaapi.com.brStart: apistart01.megaapi.com.br / apistart02.megaapi.com.br / apistart03.megaapi.com.brNoCode: apinocode01.megaapi.com.br / apinocode02.megaapi.com.br
CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "to": "5511999998888",
  "address": "<VALOR>",
  "caption": "<VALOR>",
  "latitude": 0,
  "longitude": 0,
  "url": "https://seu-dominio.com/webhook"
}
opcionalValor enviado no corpo: message data.
`latitude` e `longitude` são as coordenadas em número decimal (ex.: -23.55052 e -46.63331). `address` é o texto do endereço que aparece no cartão.
AtributosTipoDescrição
tostringContato que vai receber a mensagem
addressstringEndereço (Opcional)
captionstringLegenda (Opcional)
latitudestringLatitude
longitudestringLongitude
urlstring
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/location" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "to": "5511999998888",
    "address": "<VALOR>",
    "caption": "<VALOR>",
    "latitude": 0,
    "longitude": 0,
    "url": "https://seu-dominio.com/webhook"
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/location', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "address": "<VALOR>",
    "caption": "<VALOR>",
    "latitude": 0,
    "longitude": 0,
    "url": "https://seu-dominio.com/webhook"
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/location', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "address": "<VALOR>",
    "caption": "<VALOR>",
    "latitude": 0,
    "longitude": 0,
    "url": "https://seu-dominio.com/webhook"
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to send location. On confirm, the backend must call POST /rest/sendMessage/{instance_key}/location on megaAPI using the configured instance and the securely stored token. Sends a point on the map, which arrives as the WhatsApp location card, with address and thumbnail. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "to": "5511999998888",
    "address": "<VALOR>",
    "caption": "<VALOR>",
    "latitude": 0,
    "longitude": 0,
    "url": "https://seu-dominio.com/webhook"
  }
}
Claude Code
Implement a TypeScript function called sendMessage_location that calls POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/location with Authorization Bearer <YOUR_TOKEN>. Sends a point on the map, which arrives as the WhatsApp location card, with address and thumbnail. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "to": "5511999998888",
    "address": "<VALOR>",
    "caption": "<VALOR>",
    "latitude": 0,
    "longitude": 0,
    "url": "https://seu-dominio.com/webhook"
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the sendMessage.location integration in a Node.js service. Sends a point on the map, which arrives as the WhatsApp location card, with address and thumbnail."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/location",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "to": "5511999998888",
          "address": "<VALOR>",
          "caption": "<VALOR>",
          "latitude": 0,
          "longitude": 0,
          "url": "https://seu-dominio.com/webhook"
        }
      }
    }
  ]
}
Cursor
In the current project, implement the sendMessage_location client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/location. Sends a point on the map, which arrives as the WhatsApp location card, with address and thumbnail. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "to": "5511999998888",
    "address": "<VALOR>",
    "caption": "<VALOR>",
    "latitude": 0,
    "longitude": 0,
    "url": "https://seu-dominio.com/webhook"
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/location. Auth: Bearer <YOUR_TOKEN>. Sends a point on the map, which arrives as the WhatsApp location card, with address and thumbnail. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "to": "5511999998888",
    "address": "<VALOR>",
    "caption": "<VALOR>",
    "latitude": 0,
    "longitude": 0,
    "url": "https://seu-dominio.com/webhook"
  }
}
POSTMensagensBusinessStartNoCodetestado na API real

Enviar arquivo por Base64

Envia um arquivo convertido em texto (Base64), sem hospedá-lo em lugar nenhum. Ótimo para um arquivo gerado em tempo real, como um boleto ou uma fatura; um arquivo grande deixa a requisição pesada e lenta.

POSThttps://{seu_host}/rest/sendMessage/{instance_key}/mediaBase64

Disponível em mais de um plano — troque o host conforme a sua instância:

Business: apibusiness1.megaapi.com.brStart: apistart01.megaapi.com.br / apistart02.megaapi.com.br / apistart03.megaapi.com.brNoCode: apinocode01.megaapi.com.br / apinocode02.megaapi.com.br
CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "to": "5511999998888",
  "base64": "<VALOR>",
  "fileName": "<VALOR>",
  "type": "<VALOR>",
  "caption": "<VALOR>",
  "gifPlayback": false,
  "mimeType": "<VALOR>",
  "viewOnce": false
}
opcionalValor enviado no corpo: message data.
Em `base64` vai só o conteúdo do arquivo convertido, sem o prefixo "data:application/pdf;base64,". `fileName` é o nome que aparece para quem recebe.
AtributosTipoDescrição
tostringContato que vai receber a mensagem
base64stringArquivo no formato base64 que vai ser enviado
fileNamestringNome do arquivo
typestringÉ o tipo de mídia a ser enviada (image - video - audio - document)
captionstringÉ a legenda da mídia a ser enviada (Funciona somente em imagem e vídeo)
mineTypestringMineTypes: imagem = image/jpeg, video = video/mp4, audio = audio/ogg; codecs=opus, pdf = application/pdf, xlsx = application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, word = application/vnd.openxmlformats-officedocument.wordprocessingml.document, php, bin, html = application/octet-stream, sql = application/x-sql
gifPlaybackboolean
mimeTypestring
viewOnceboolean
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/mediaBase64" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "to": "5511999998888",
    "base64": "<VALOR>",
    "fileName": "<VALOR>",
    "type": "<VALOR>",
    "caption": "<VALOR>",
    "gifPlayback": false,
    "mimeType": "<VALOR>",
    "viewOnce": false
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/mediaBase64', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "base64": "<VALOR>",
    "fileName": "<VALOR>",
    "type": "<VALOR>",
    "caption": "<VALOR>",
    "gifPlayback": false,
    "mimeType": "<VALOR>",
    "viewOnce": false
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/mediaBase64', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "base64": "<VALOR>",
    "fileName": "<VALOR>",
    "type": "<VALOR>",
    "caption": "<VALOR>",
    "gifPlayback": false,
    "mimeType": "<VALOR>",
    "viewOnce": false
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to send file by base64. On confirm, the backend must call POST /rest/sendMessage/{instance_key}/mediaBase64 on megaAPI using the configured instance and the securely stored token. Sends a file converted to text (Base64), without hosting it anywhere. Great for a file generated on the fly, like a bank slip or an invoice; a large file makes the request heavy and slow. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "to": "5511999998888",
    "base64": "<VALOR>",
    "fileName": "<VALOR>",
    "type": "<VALOR>",
    "caption": "<VALOR>",
    "gifPlayback": false,
    "mimeType": "<VALOR>",
    "viewOnce": false
  }
}
Claude Code
Implement a TypeScript function called sendMessage_mediaBase64 that calls POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/mediaBase64 with Authorization Bearer <YOUR_TOKEN>. Sends a file converted to text (Base64), without hosting it anywhere. Great for a file generated on the fly, like a bank slip or an invoice; a large file makes the request heavy and slow. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "to": "5511999998888",
    "base64": "<VALOR>",
    "fileName": "<VALOR>",
    "type": "<VALOR>",
    "caption": "<VALOR>",
    "gifPlayback": false,
    "mimeType": "<VALOR>",
    "viewOnce": false
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the sendMessage.mediaBase64 integration in a Node.js service. Sends a file converted to text (Base64), without hosting it anywhere. Great for a file generated on the fly, like a bank slip or an invoice; a large file makes the request heavy and slow."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/mediaBase64",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "to": "5511999998888",
          "base64": "<VALOR>",
          "fileName": "<VALOR>",
          "type": "<VALOR>",
          "caption": "<VALOR>",
          "gifPlayback": false,
          "mimeType": "<VALOR>",
          "viewOnce": false
        }
      }
    }
  ]
}
Cursor
In the current project, implement the sendMessage_mediaBase64 client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/mediaBase64. Sends a file converted to text (Base64), without hosting it anywhere. Great for a file generated on the fly, like a bank slip or an invoice; a large file makes the request heavy and slow. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "to": "5511999998888",
    "base64": "<VALOR>",
    "fileName": "<VALOR>",
    "type": "<VALOR>",
    "caption": "<VALOR>",
    "gifPlayback": false,
    "mimeType": "<VALOR>",
    "viewOnce": false
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/mediaBase64. Auth: Bearer <YOUR_TOKEN>. Sends a file converted to text (Base64), without hosting it anywhere. Great for a file generated on the fly, like a bank slip or an invoice; a large file makes the request heavy and slow. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "to": "5511999998888",
    "base64": "<VALOR>",
    "fileName": "<VALOR>",
    "type": "<VALOR>",
    "caption": "<VALOR>",
    "gifPlayback": false,
    "mimeType": "<VALOR>",
    "viewOnce": false
  }
}
POSTMensagensBusinesstestado na API real

Publicar mídia no status por Base64

Publica uma imagem ou vídeo no status enviando o próprio arquivo convertido em texto (Base64), sem hospedar nada em lugar nenhum.

POSThttps://{seu_host}/rest/sendMessage/{instance_key}/mediaBase64Stories

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "base64": "<VALOR>",
  "fileName": "<VALOR>",
  "type": "<VALOR>",
  "mimeType": "<VALOR>",
  "caption": "<VALOR>",
  "backgroundColor": "<VALOR>",
  "jidList": [
    ""
  ]
}
opcionalValor enviado no corpo: message data.
AtributosTipoDescrição
base64string
fileNamestring
typestring
mimeTypestring
captionstring
backgroundColorstring
jidListarray
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/mediaBase64Stories" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "base64": "<VALOR>",
    "fileName": "<VALOR>",
    "type": "<VALOR>",
    "mimeType": "<VALOR>",
    "caption": "<VALOR>",
    "backgroundColor": "<VALOR>",
    "jidList": [
      ""
    ]
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/mediaBase64Stories', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "base64": "<VALOR>",
    "fileName": "<VALOR>",
    "type": "<VALOR>",
    "mimeType": "<VALOR>",
    "caption": "<VALOR>",
    "backgroundColor": "<VALOR>",
    "jidList": [
      ""
    ]
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/mediaBase64Stories', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "base64": "<VALOR>",
    "fileName": "<VALOR>",
    "type": "<VALOR>",
    "mimeType": "<VALOR>",
    "caption": "<VALOR>",
    "backgroundColor": "<VALOR>",
    "jidList": [
      ""
    ]
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to post media to status by base64. On confirm, the backend must call POST /rest/sendMessage/{instance_key}/mediaBase64Stories on megaAPI using the configured instance and the securely stored token. Publishes an image or video in the status by sending the file itself converted to text (Base64), without hosting anything anywhere. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "base64": "<VALOR>",
    "fileName": "<VALOR>",
    "type": "<VALOR>",
    "mimeType": "<VALOR>",
    "caption": "<VALOR>",
    "backgroundColor": "<VALOR>",
    "jidList": [
      ""
    ]
  }
}
Claude Code
Implement a TypeScript function called sendMessage_mediaBase64Stories that calls POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/mediaBase64Stories with Authorization Bearer <YOUR_TOKEN>. Publishes an image or video in the status by sending the file itself converted to text (Base64), without hosting anything anywhere. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "base64": "<VALOR>",
    "fileName": "<VALOR>",
    "type": "<VALOR>",
    "mimeType": "<VALOR>",
    "caption": "<VALOR>",
    "backgroundColor": "<VALOR>",
    "jidList": [
      ""
    ]
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the sendMessage.mediaBase64Stories integration in a Node.js service. Publishes an image or video in the status by sending the file itself converted to text (Base64), without hosting anything anywhere."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/mediaBase64Stories",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "base64": "<VALOR>",
          "fileName": "<VALOR>",
          "type": "<VALOR>",
          "mimeType": "<VALOR>",
          "caption": "<VALOR>",
          "backgroundColor": "<VALOR>",
          "jidList": [
            ""
          ]
        }
      }
    }
  ]
}
Cursor
In the current project, implement the sendMessage_mediaBase64Stories client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/mediaBase64Stories. Publishes an image or video in the status by sending the file itself converted to text (Base64), without hosting anything anywhere. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "base64": "<VALOR>",
    "fileName": "<VALOR>",
    "type": "<VALOR>",
    "mimeType": "<VALOR>",
    "caption": "<VALOR>",
    "backgroundColor": "<VALOR>",
    "jidList": [
      ""
    ]
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/mediaBase64Stories. Auth: Bearer <YOUR_TOKEN>. Publishes an image or video in the status by sending the file itself converted to text (Base64), without hosting anything anywhere. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "base64": "<VALOR>",
    "fileName": "<VALOR>",
    "type": "<VALOR>",
    "mimeType": "<VALOR>",
    "caption": "<VALOR>",
    "backgroundColor": "<VALOR>",
    "jidList": [
      ""
    ]
  }
}
POSTMensagensBusinesstestado na API real

Enviar arquivo por Base64 para vários

Envia o mesmo arquivo em Base64 para uma lista de números em uma única chamada.

POSThttps://{seu_host}/rest/sendMessage/{instance_key}/mediaBase64ToMany

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "to": [
    ""
  ],
  "base64": "<VALOR>",
  "fileName": "<VALOR>",
  "type": "<VALOR>",
  "caption": "<VALOR>",
  "gifPlayback": false,
  "mimeType": "<VALOR>",
  "viewOnce": false
}
opcionalValor enviado no corpo: message data.
Aqui `to` é uma lista de números com DDI+DDD e só dígitos, e `base64` vai sem o prefixo "data:...;base64,".
AtributosTipoDescrição
toarray
base64string
fileNamestring
typestring
captionstring
gifPlaybackboolean
mimeTypestring
viewOnceboolean
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/mediaBase64ToMany" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "to": [
      ""
    ],
    "base64": "<VALOR>",
    "fileName": "<VALOR>",
    "type": "<VALOR>",
    "caption": "<VALOR>",
    "gifPlayback": false,
    "mimeType": "<VALOR>",
    "viewOnce": false
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/mediaBase64ToMany', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": [
      ""
    ],
    "base64": "<VALOR>",
    "fileName": "<VALOR>",
    "type": "<VALOR>",
    "caption": "<VALOR>",
    "gifPlayback": false,
    "mimeType": "<VALOR>",
    "viewOnce": false
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/mediaBase64ToMany', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": [
      ""
    ],
    "base64": "<VALOR>",
    "fileName": "<VALOR>",
    "type": "<VALOR>",
    "caption": "<VALOR>",
    "gifPlayback": false,
    "mimeType": "<VALOR>",
    "viewOnce": false
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to send file by base64 to many. On confirm, the backend must call POST /rest/sendMessage/{instance_key}/mediaBase64ToMany on megaAPI using the configured instance and the securely stored token. Sends the same Base64 file to a list of numbers in a single call. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "to": [
      ""
    ],
    "base64": "<VALOR>",
    "fileName": "<VALOR>",
    "type": "<VALOR>",
    "caption": "<VALOR>",
    "gifPlayback": false,
    "mimeType": "<VALOR>",
    "viewOnce": false
  }
}
Claude Code
Implement a TypeScript function called sendMessage_mediaBase64ToMany that calls POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/mediaBase64ToMany with Authorization Bearer <YOUR_TOKEN>. Sends the same Base64 file to a list of numbers in a single call. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "to": [
      ""
    ],
    "base64": "<VALOR>",
    "fileName": "<VALOR>",
    "type": "<VALOR>",
    "caption": "<VALOR>",
    "gifPlayback": false,
    "mimeType": "<VALOR>",
    "viewOnce": false
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the sendMessage.mediaBase64ToMany integration in a Node.js service. Sends the same Base64 file to a list of numbers in a single call."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/mediaBase64ToMany",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "to": [
            ""
          ],
          "base64": "<VALOR>",
          "fileName": "<VALOR>",
          "type": "<VALOR>",
          "caption": "<VALOR>",
          "gifPlayback": false,
          "mimeType": "<VALOR>",
          "viewOnce": false
        }
      }
    }
  ]
}
Cursor
In the current project, implement the sendMessage_mediaBase64ToMany client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/mediaBase64ToMany. Sends the same Base64 file to a list of numbers in a single call. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "to": [
      ""
    ],
    "base64": "<VALOR>",
    "fileName": "<VALOR>",
    "type": "<VALOR>",
    "caption": "<VALOR>",
    "gifPlayback": false,
    "mimeType": "<VALOR>",
    "viewOnce": false
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/mediaBase64ToMany. Auth: Bearer <YOUR_TOKEN>. Sends the same Base64 file to a list of numbers in a single call. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "to": [
      ""
    ],
    "base64": "<VALOR>",
    "fileName": "<VALOR>",
    "type": "<VALOR>",
    "caption": "<VALOR>",
    "gifPlayback": false,
    "mimeType": "<VALOR>",
    "viewOnce": false
  }
}
POSTMensagensBusinessStartNoCodetestado na API real

Enviar arquivo por URL

Envia uma imagem, vídeo, áudio ou documento a partir do endereço do arquivo na internet. Quem busca o arquivo é a megaAPI, então o link precisa ser público: links de pastas do Google Drive ou páginas atrás de login geralmente falham.

POSThttps://{seu_host}/rest/sendMessage/{instance_key}/mediaUrl

Disponível em mais de um plano — troque o host conforme a sua instância:

Business: apibusiness1.megaapi.com.brStart: apistart01.megaapi.com.br / apistart02.megaapi.com.br / apistart03.megaapi.com.brNoCode: apinocode01.megaapi.com.br / apinocode02.megaapi.com.br
CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "to": "5511999998888",
  "url": "https://seu-dominio.com/webhook",
  "fileName": "<VALOR>",
  "type": "<VALOR>",
  "caption": "<VALOR>",
  "gifPlayback": false,
  "mimeType": "<VALOR>",
  "viewOnce": false
}
opcionalValor enviado no corpo: message data.
`url` é o link direto do arquivo (deve terminar no arquivo, tipo …/nota.pdf), `type` diz se é image, video, audio ou document, e `fileName` é o nome que o destinatário vê.
AtributosTipoDescrição
tostringGrupo que vai receber a mensagem
urlstringURL da mídia a ser enviada
fileNamestringNome do arquivo
typestringÉ o tipo de mídia a ser enviada (image - video - audio - document)
captionstringÉ a legenda da mídia a ser enviada (Funciona somente em imagem e vídeo)
mineTypestringMineTypes: imagem = image/jpeg, video = video/mp4, audio = audio/ogg; codecs=opus, pdf = application/pdf, xlsx = application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, word = application/vnd.openxmlformats-officedocument.wordprocessingml.document, php, bin, html = application/octet-stream, sql = application/x-sql
gifPlaybackboolean
mimeTypestring
viewOnceboolean
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/mediaUrl" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "to": "5511999998888",
    "url": "https://seu-dominio.com/webhook",
    "fileName": "<VALOR>",
    "type": "<VALOR>",
    "caption": "<VALOR>",
    "gifPlayback": false,
    "mimeType": "<VALOR>",
    "viewOnce": false
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/mediaUrl', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "url": "https://seu-dominio.com/webhook",
    "fileName": "<VALOR>",
    "type": "<VALOR>",
    "caption": "<VALOR>",
    "gifPlayback": false,
    "mimeType": "<VALOR>",
    "viewOnce": false
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/mediaUrl', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "url": "https://seu-dominio.com/webhook",
    "fileName": "<VALOR>",
    "type": "<VALOR>",
    "caption": "<VALOR>",
    "gifPlayback": false,
    "mimeType": "<VALOR>",
    "viewOnce": false
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to send file by url. On confirm, the backend must call POST /rest/sendMessage/{instance_key}/mediaUrl on megaAPI using the configured instance and the securely stored token. Sends an image, video, audio, or document from the file's address on the internet. megaAPI is the one fetching the file, so the link must be public: Google Drive folder links or pages behind a login usually fail. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "to": "5511999998888",
    "url": "https://seu-dominio.com/webhook",
    "fileName": "<VALOR>",
    "type": "<VALOR>",
    "caption": "<VALOR>",
    "gifPlayback": false,
    "mimeType": "<VALOR>",
    "viewOnce": false
  }
}
Claude Code
Implement a TypeScript function called sendMessage_mediaUrl that calls POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/mediaUrl with Authorization Bearer <YOUR_TOKEN>. Sends an image, video, audio, or document from the file's address on the internet. megaAPI is the one fetching the file, so the link must be public: Google Drive folder links or pages behind a login usually fail. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "to": "5511999998888",
    "url": "https://seu-dominio.com/webhook",
    "fileName": "<VALOR>",
    "type": "<VALOR>",
    "caption": "<VALOR>",
    "gifPlayback": false,
    "mimeType": "<VALOR>",
    "viewOnce": false
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the sendMessage.mediaUrl integration in a Node.js service. Sends an image, video, audio, or document from the file's address on the internet. megaAPI is the one fetching the file, so the link must be public: Google Drive folder links or pages behind a login usually fail."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/mediaUrl",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "to": "5511999998888",
          "url": "https://seu-dominio.com/webhook",
          "fileName": "<VALOR>",
          "type": "<VALOR>",
          "caption": "<VALOR>",
          "gifPlayback": false,
          "mimeType": "<VALOR>",
          "viewOnce": false
        }
      }
    }
  ]
}
Cursor
In the current project, implement the sendMessage_mediaUrl client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/mediaUrl. Sends an image, video, audio, or document from the file's address on the internet. megaAPI is the one fetching the file, so the link must be public: Google Drive folder links or pages behind a login usually fail. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "to": "5511999998888",
    "url": "https://seu-dominio.com/webhook",
    "fileName": "<VALOR>",
    "type": "<VALOR>",
    "caption": "<VALOR>",
    "gifPlayback": false,
    "mimeType": "<VALOR>",
    "viewOnce": false
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/mediaUrl. Auth: Bearer <YOUR_TOKEN>. Sends an image, video, audio, or document from the file's address on the internet. megaAPI is the one fetching the file, so the link must be public: Google Drive folder links or pages behind a login usually fail. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "to": "5511999998888",
    "url": "https://seu-dominio.com/webhook",
    "fileName": "<VALOR>",
    "type": "<VALOR>",
    "caption": "<VALOR>",
    "gifPlayback": false,
    "mimeType": "<VALOR>",
    "viewOnce": false
  }
}
POSTMensagensBusinesstestado na API real

Publicar mídia no status por URL

Publica uma imagem ou vídeo no status a partir do endereço do arquivo na internet. O link deve abrir direto no arquivo, sem senha ou página de login.

POSThttps://{seu_host}/rest/sendMessage/{instance_key}/mediaUrlStories

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "type": "<VALOR>",
  "mimeType": "<VALOR>",
  "caption": "<VALOR>",
  "url": "https://seu-dominio.com/webhook",
  "fileName": "<VALOR>",
  "backgroundColor": "<VALOR>",
  "jidList": [
    ""
  ]
}
opcionalValor enviado no corpo: message data.
AtributosTipoDescrição
typestring
mimeTypestring
captionstring
urlstring
fileNamestring
backgroundColorstring
jidListarray
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/mediaUrlStories" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "type": "<VALOR>",
    "mimeType": "<VALOR>",
    "caption": "<VALOR>",
    "url": "https://seu-dominio.com/webhook",
    "fileName": "<VALOR>",
    "backgroundColor": "<VALOR>",
    "jidList": [
      ""
    ]
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/mediaUrlStories', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "type": "<VALOR>",
    "mimeType": "<VALOR>",
    "caption": "<VALOR>",
    "url": "https://seu-dominio.com/webhook",
    "fileName": "<VALOR>",
    "backgroundColor": "<VALOR>",
    "jidList": [
      ""
    ]
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/mediaUrlStories', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "type": "<VALOR>",
    "mimeType": "<VALOR>",
    "caption": "<VALOR>",
    "url": "https://seu-dominio.com/webhook",
    "fileName": "<VALOR>",
    "backgroundColor": "<VALOR>",
    "jidList": [
      ""
    ]
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to post media to status by url. On confirm, the backend must call POST /rest/sendMessage/{instance_key}/mediaUrlStories on megaAPI using the configured instance and the securely stored token. Publishes an image or video in the status from the file's address on the internet. The link must open directly on the file, with no password or login page. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "type": "<VALOR>",
    "mimeType": "<VALOR>",
    "caption": "<VALOR>",
    "url": "https://seu-dominio.com/webhook",
    "fileName": "<VALOR>",
    "backgroundColor": "<VALOR>",
    "jidList": [
      ""
    ]
  }
}
Claude Code
Implement a TypeScript function called sendMessage_mediaUrlStories that calls POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/mediaUrlStories with Authorization Bearer <YOUR_TOKEN>. Publishes an image or video in the status from the file's address on the internet. The link must open directly on the file, with no password or login page. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "type": "<VALOR>",
    "mimeType": "<VALOR>",
    "caption": "<VALOR>",
    "url": "https://seu-dominio.com/webhook",
    "fileName": "<VALOR>",
    "backgroundColor": "<VALOR>",
    "jidList": [
      ""
    ]
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the sendMessage.mediaUrlStories integration in a Node.js service. Publishes an image or video in the status from the file's address on the internet. The link must open directly on the file, with no password or login page."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/mediaUrlStories",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "type": "<VALOR>",
          "mimeType": "<VALOR>",
          "caption": "<VALOR>",
          "url": "https://seu-dominio.com/webhook",
          "fileName": "<VALOR>",
          "backgroundColor": "<VALOR>",
          "jidList": [
            ""
          ]
        }
      }
    }
  ]
}
Cursor
In the current project, implement the sendMessage_mediaUrlStories client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/mediaUrlStories. Publishes an image or video in the status from the file's address on the internet. The link must open directly on the file, with no password or login page. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "type": "<VALOR>",
    "mimeType": "<VALOR>",
    "caption": "<VALOR>",
    "url": "https://seu-dominio.com/webhook",
    "fileName": "<VALOR>",
    "backgroundColor": "<VALOR>",
    "jidList": [
      ""
    ]
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/mediaUrlStories. Auth: Bearer <YOUR_TOKEN>. Publishes an image or video in the status from the file's address on the internet. The link must open directly on the file, with no password or login page. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "type": "<VALOR>",
    "mimeType": "<VALOR>",
    "caption": "<VALOR>",
    "url": "https://seu-dominio.com/webhook",
    "fileName": "<VALOR>",
    "backgroundColor": "<VALOR>",
    "jidList": [
      ""
    ]
  }
}
POSTMensagensBusinesstestado na API real

Enviar arquivo por URL para vários

Envia o mesmo arquivo, buscado por URL, para uma lista de números em uma única chamada.

POSThttps://{seu_host}/rest/sendMessage/{instance_key}/mediaUrlToMany

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "to": [
    ""
  ],
  "url": "https://seu-dominio.com/webhook",
  "fileName": "<VALOR>",
  "type": "<VALOR>",
  "caption": "<VALOR>",
  "gifPlayback": false,
  "mimeType": "<VALOR>",
  "viewOnce": false
}
opcionalValor enviado no corpo: message data.
Aqui `to` é uma lista de números com DDI+DDD e só dígitos; o link em `url` precisa ser público.
AtributosTipoDescrição
toarrayContatos que vão receber a mensagem
urlstringURL da mídia a ser enviada
fileNamestringNome do arquivo
typestringÉ o tipo de mídia a ser enviada (image - video - audio - document)
captionstringÉ a legenda da mídia a ser enviada (Funciona somente em imagem e vídeo)
mineTypestringMineTypes: imagem = image/jpeg, video = video/mp4, audio = audio/ogg; codecs=opus, pdf = application/pdf, xlsx = application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, word = application/vnd.openxmlformats-officedocument.wordprocessingml.document, php, bin, html = application/octet-stream, sql = application/x-sql
gifPlaybackboolean
mimeTypestring
viewOnceboolean
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/mediaUrlToMany" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "to": [
      ""
    ],
    "url": "https://seu-dominio.com/webhook",
    "fileName": "<VALOR>",
    "type": "<VALOR>",
    "caption": "<VALOR>",
    "gifPlayback": false,
    "mimeType": "<VALOR>",
    "viewOnce": false
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/mediaUrlToMany', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": [
      ""
    ],
    "url": "https://seu-dominio.com/webhook",
    "fileName": "<VALOR>",
    "type": "<VALOR>",
    "caption": "<VALOR>",
    "gifPlayback": false,
    "mimeType": "<VALOR>",
    "viewOnce": false
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/mediaUrlToMany', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": [
      ""
    ],
    "url": "https://seu-dominio.com/webhook",
    "fileName": "<VALOR>",
    "type": "<VALOR>",
    "caption": "<VALOR>",
    "gifPlayback": false,
    "mimeType": "<VALOR>",
    "viewOnce": false
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to send file by url to many. On confirm, the backend must call POST /rest/sendMessage/{instance_key}/mediaUrlToMany on megaAPI using the configured instance and the securely stored token. Sends the same file, fetched by URL, to a list of numbers in a single call. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "to": [
      ""
    ],
    "url": "https://seu-dominio.com/webhook",
    "fileName": "<VALOR>",
    "type": "<VALOR>",
    "caption": "<VALOR>",
    "gifPlayback": false,
    "mimeType": "<VALOR>",
    "viewOnce": false
  }
}
Claude Code
Implement a TypeScript function called sendMessage_mediaUrlToMany that calls POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/mediaUrlToMany with Authorization Bearer <YOUR_TOKEN>. Sends the same file, fetched by URL, to a list of numbers in a single call. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "to": [
      ""
    ],
    "url": "https://seu-dominio.com/webhook",
    "fileName": "<VALOR>",
    "type": "<VALOR>",
    "caption": "<VALOR>",
    "gifPlayback": false,
    "mimeType": "<VALOR>",
    "viewOnce": false
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the sendMessage.mediaUrlToMany integration in a Node.js service. Sends the same file, fetched by URL, to a list of numbers in a single call."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/mediaUrlToMany",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "to": [
            ""
          ],
          "url": "https://seu-dominio.com/webhook",
          "fileName": "<VALOR>",
          "type": "<VALOR>",
          "caption": "<VALOR>",
          "gifPlayback": false,
          "mimeType": "<VALOR>",
          "viewOnce": false
        }
      }
    }
  ]
}
Cursor
In the current project, implement the sendMessage_mediaUrlToMany client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/mediaUrlToMany. Sends the same file, fetched by URL, to a list of numbers in a single call. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "to": [
      ""
    ],
    "url": "https://seu-dominio.com/webhook",
    "fileName": "<VALOR>",
    "type": "<VALOR>",
    "caption": "<VALOR>",
    "gifPlayback": false,
    "mimeType": "<VALOR>",
    "viewOnce": false
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/mediaUrlToMany. Auth: Bearer <YOUR_TOKEN>. Sends the same file, fetched by URL, to a list of numbers in a single call. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "to": [
      ""
    ],
    "url": "https://seu-dominio.com/webhook",
    "fileName": "<VALOR>",
    "type": "<VALOR>",
    "caption": "<VALOR>",
    "gifPlayback": false,
    "mimeType": "<VALOR>",
    "viewOnce": false
  }
}
POSTMensagensBusinesstestado na API real

Enviar enquete

Cria uma enquete para as pessoas votarem, em conversa privada ou em grupo.

POSThttps://{seu_host}/rest/sendMessage/{instance_key}/pollMessage

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "to": "5511999998888",
  "title": "<VALOR>",
  "selectableOptionsCount": 1,
  "options": [
    ""
  ]
}
opcionalValor enviado no corpo: message data.
`title` é a pergunta, `options` a lista de respostas e `selectableOptionsCount` quantas opções cada pessoa pode marcar (1 para escolha única).
AtributosTipoDescrição
tostring
titlestring
selectableOptionsCountnumber
optionsarray
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/pollMessage" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "to": "5511999998888",
    "title": "<VALOR>",
    "selectableOptionsCount": 1,
    "options": [
      ""
    ]
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/pollMessage', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "title": "<VALOR>",
    "selectableOptionsCount": 1,
    "options": [
      ""
    ]
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/pollMessage', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "title": "<VALOR>",
    "selectableOptionsCount": 1,
    "options": [
      ""
    ]
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to send poll. On confirm, the backend must call POST /rest/sendMessage/{instance_key}/pollMessage on megaAPI using the configured instance and the securely stored token. Creates a poll for people to vote on, in a private chat or a group. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "to": "5511999998888",
    "title": "<VALOR>",
    "selectableOptionsCount": 1,
    "options": [
      ""
    ]
  }
}
Claude Code
Implement a TypeScript function called sendMessage_pollMessage that calls POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/pollMessage with Authorization Bearer <YOUR_TOKEN>. Creates a poll for people to vote on, in a private chat or a group. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "to": "5511999998888",
    "title": "<VALOR>",
    "selectableOptionsCount": 1,
    "options": [
      ""
    ]
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the sendMessage.pollMessage integration in a Node.js service. Creates a poll for people to vote on, in a private chat or a group."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/pollMessage",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "to": "5511999998888",
          "title": "<VALOR>",
          "selectableOptionsCount": 1,
          "options": [
            ""
          ]
        }
      }
    }
  ]
}
Cursor
In the current project, implement the sendMessage_pollMessage client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/pollMessage. Creates a poll for people to vote on, in a private chat or a group. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "to": "5511999998888",
    "title": "<VALOR>",
    "selectableOptionsCount": 1,
    "options": [
      ""
    ]
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/pollMessage. Auth: Bearer <YOUR_TOKEN>. Creates a poll for people to vote on, in a private chat or a group. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "to": "5511999998888",
    "title": "<VALOR>",
    "selectableOptionsCount": 1,
    "options": [
      ""
    ]
  }
}
POSTMensagensBusinesstestado na API real

Enviar mensagem de voz

Envia áudio no formato de mensagem de voz — o do balão de microfone que toca automaticamente em sequência. É o que dá a aparência de gravação ao vivo.

POSThttps://{seu_host}/rest/sendMessage/{instance_key}/ptt?to=5511999998888&viewOnce=false

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
toquerystring"5511999998888"opcionalFiltro ou opção da consulta: to.
Ex.: 55 (Brasil) + 11 (DDD) + número, tudo junto e só dígitos. Nunca use +, espaço ou traço. Para grupo, use o ID terminado em @g.us.
viewOncequerybooleanfalseopcionalFiltro ou opção da consulta: view once.
true faz a mídia sumir depois de aberta uma única vez — nem o destinatário nem você conseguem reabrir ou baixar depois.
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/ptt?to=5511999998888&viewOnce=false" \
  -H "Authorization: Bearer <SEU_TOKEN>"
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/ptt?to=5511999998888&viewOnce=false', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' },
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/ptt?to=5511999998888&viewOnce=false', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' }
});
console.log(await response.json());
HTTP 400
{
  "name": "BAD_REQUEST",
  "message": "<VALOR>",
  "status": 400,
  "errors": [],
  "stack": "<VALOR>"
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to send voice message. On confirm, the backend must call POST /rest/sendMessage/{instance_key}/ptt on megaAPI using the configured instance and the securely stored token. Sends audio in voice message format - the one with the microphone bubble that plays automatically in sequence. What gives it the look of a live recording. Show loading, success, and error states; do not expose the token in the browser. Example data: no JSON body
Claude Code
Implement a TypeScript function called sendMessage_ptt that calls POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/ptt?to=5511999998888&viewOnce=false with Authorization Bearer <YOUR_TOKEN>. Sends audio in voice message format - the one with the microphone bubble that plays automatically in sequence. What gives it the look of a live recording. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: no JSON body
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the sendMessage.ptt integration in a Node.js service. Sends audio in voice message format - the one with the microphone bubble that plays automatically in sequence. What gives it the look of a live recording."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/ptt?to=5511999998888&viewOnce=false",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": null
    }
  ]
}
Cursor
In the current project, implement the sendMessage_ptt client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/ptt?to=5511999998888&viewOnce=false. Sends audio in voice message format - the one with the microphone bubble that plays automatically in sequence. What gives it the look of a live recording. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: no JSON body
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/ptt?to=5511999998888&viewOnce=false. Auth: Bearer <YOUR_TOKEN>. Sends audio in voice message format - the one with the microphone bubble that plays automatically in sequence. What gives it the look of a live recording. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: no JSON body
POSTMensagensBusinesstestado na API real

Enviar vídeo redondo

Envia um vídeo curto no formato de nota de vídeo, o redondo que o WhatsApp reproduz sozinho na conversa.

POSThttps://{seu_host}/rest/sendMessage/{instance_key}/ptv?to=5511999998888&gifPlayback=false&viewOnce=false

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
toquerystring"5511999998888"opcionalFiltro ou opção da consulta: to.
Ex.: 55 (Brasil) + 11 (DDD) + número, tudo junto e só dígitos. Nunca use +, espaço ou traço. Para grupo, use o ID terminado em @g.us.
gifPlaybackquerybooleanfalseopcionalFiltro ou opção da consulta: gif playback.
true faz o vídeo tocar em repetição e sem som, do jeito que um GIF aparece na conversa.
viewOncequerybooleanfalseopcionalFiltro ou opção da consulta: view once.
true faz a mídia sumir depois de aberta uma única vez — nem o destinatário nem você conseguem reabrir ou baixar depois.
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/ptv?to=5511999998888&gifPlayback=false&viewOnce=false" \
  -H "Authorization: Bearer <SEU_TOKEN>"
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/ptv?to=5511999998888&gifPlayback=false&viewOnce=false', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' },
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/ptv?to=5511999998888&gifPlayback=false&viewOnce=false', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' }
});
console.log(await response.json());
HTTP 400
{
  "name": "BAD_REQUEST",
  "message": "<VALOR>",
  "status": 400,
  "errors": [],
  "stack": "<VALOR>"
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to send round video. On confirm, the backend must call POST /rest/sendMessage/{instance_key}/ptv on megaAPI using the configured instance and the securely stored token. Sends a short video in video note format, the round one WhatsApp plays by itself in the conversation. Show loading, success, and error states; do not expose the token in the browser. Example data: no JSON body
Claude Code
Implement a TypeScript function called sendMessage_ptv that calls POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/ptv?to=5511999998888&gifPlayback=false&viewOnce=false with Authorization Bearer <YOUR_TOKEN>. Sends a short video in video note format, the round one WhatsApp plays by itself in the conversation. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: no JSON body
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the sendMessage.ptv integration in a Node.js service. Sends a short video in video note format, the round one WhatsApp plays by itself in the conversation."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/ptv?to=5511999998888&gifPlayback=false&viewOnce=false",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": null
    }
  ]
}
Cursor
In the current project, implement the sendMessage_ptv client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/ptv?to=5511999998888&gifPlayback=false&viewOnce=false. Sends a short video in video note format, the round one WhatsApp plays by itself in the conversation. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: no JSON body
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/ptv?to=5511999998888&gifPlayback=false&viewOnce=false. Auth: Bearer <YOUR_TOKEN>. Sends a short video in video note format, the round one WhatsApp plays by itself in the conversation. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: no JSON body
POSTMensagensBusinessStartNoCodetestado na API real

Responder citando mensagem

Envia uma mensagem respondendo a outra, com o original citado acima — o responder citando do WhatsApp. Ajuda quando a conversa é longa e a resposta precisa ficar clara.

POSThttps://{seu_host}/rest/sendMessage/{instance_key}/quoteMessage

Disponível em mais de um plano — troque o host conforme a sua instância:

Business: apibusiness1.megaapi.com.brStart: apistart01.megaapi.com.br / apistart02.megaapi.com.br / apistart03.megaapi.com.brNoCode: apinocode01.megaapi.com.br / apinocode02.megaapi.com.br
CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "to": "5511999998888",
  "text": "<VALOR>",
  "key": {},
  "message": {}
}
opcionalValor enviado no corpo: message data.
O campo `key` identifica a mensagem original. Copie exatamente como veio no webhook ou na listagem de mensagens; não dá para montar à mão.
AtributosTipoDescrição
tostringContato que vai receber a mensagem
textstringMensagem
keyobjectObjeto que contem as informações necessárias para responder a mensagem
messageobjectObjeto que contem as informações necessárias para responder a mensagem
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/quoteMessage" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "to": "5511999998888",
    "text": "<VALOR>",
    "key": {},
    "message": {}
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/quoteMessage', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "text": "<VALOR>",
    "key": {},
    "message": {}
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/quoteMessage', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "text": "<VALOR>",
    "key": {},
    "message": {}
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to reply quoting a message. On confirm, the backend must call POST /rest/sendMessage/{instance_key}/quoteMessage on megaAPI using the configured instance and the securely stored token. Sends a message replying to another one, with the original quoted above - WhatsApp's quoted reply. Helps when the conversation is long and the reply needs to stay clear. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "to": "5511999998888",
    "text": "<VALOR>",
    "key": {},
    "message": {}
  }
}
Claude Code
Implement a TypeScript function called sendMessage_quoteMessage that calls POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/quoteMessage with Authorization Bearer <YOUR_TOKEN>. Sends a message replying to another one, with the original quoted above - WhatsApp's quoted reply. Helps when the conversation is long and the reply needs to stay clear. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "to": "5511999998888",
    "text": "<VALOR>",
    "key": {},
    "message": {}
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the sendMessage.quoteMessage integration in a Node.js service. Sends a message replying to another one, with the original quoted above - WhatsApp's quoted reply. Helps when the conversation is long and the reply needs to stay clear."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/quoteMessage",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "to": "5511999998888",
          "text": "<VALOR>",
          "key": {},
          "message": {}
        }
      }
    }
  ]
}
Cursor
In the current project, implement the sendMessage_quoteMessage client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/quoteMessage. Sends a message replying to another one, with the original quoted above - WhatsApp's quoted reply. Helps when the conversation is long and the reply needs to stay clear. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "to": "5511999998888",
    "text": "<VALOR>",
    "key": {},
    "message": {}
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/quoteMessage. Auth: Bearer <YOUR_TOKEN>. Sends a message replying to another one, with the original quoted above - WhatsApp's quoted reply. Helps when the conversation is long and the reply needs to stay clear. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "to": "5511999998888",
    "text": "<VALOR>",
    "key": {},
    "message": {}
  }
}
POSTMensagensBusinesstestado na API real

Reagir a uma mensagem

Adiciona um emoji de reação a uma mensagem existente. A reação permanece vinculada à mensagem original, sem virar uma nova mensagem na conversa.

POSThttps://{seu_host}/rest/sendMessage/{instance_key}/reactMessage

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
reactbodyobject
JSON
{
  "text": "<VALOR>",
  "key": {}
}
opcionalValor enviado no corpo: react.
Em `text` vai o emoji da reação (ex.: "👍") e em `key`, a identificação da mensagem que vai recebê-la, copiada do webhook ou da listagem de mensagens.
AtributosTipoDescrição
textstring
keyobject
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/reactMessage" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "react": {
    "text": "<VALOR>",
    "key": {}
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/reactMessage', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "react": {
    "text": "<VALOR>",
    "key": {}
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/reactMessage', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "react": {
    "text": "<VALOR>",
    "key": {}
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to react to a message. On confirm, the backend must call POST /rest/sendMessage/{instance_key}/reactMessage on megaAPI using the configured instance and the securely stored token. Adds a reaction emoji to an existing message. The reaction stays attached to the original message, without becoming a new message in the conversation. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "react": {
    "text": "<VALOR>",
    "key": {}
  }
}
Claude Code
Implement a TypeScript function called sendMessage_reactMessage that calls POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/reactMessage with Authorization Bearer <YOUR_TOKEN>. Adds a reaction emoji to an existing message. The reaction stays attached to the original message, without becoming a new message in the conversation. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "react": {
    "text": "<VALOR>",
    "key": {}
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the sendMessage.reactMessage integration in a Node.js service. Adds a reaction emoji to an existing message. The reaction stays attached to the original message, without becoming a new message in the conversation."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/reactMessage",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "react": {
          "text": "<VALOR>",
          "key": {}
        }
      }
    }
  ]
}
Cursor
In the current project, implement the sendMessage_reactMessage client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/reactMessage. Adds a reaction emoji to an existing message. The reaction stays attached to the original message, without becoming a new message in the conversation. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "react": {
    "text": "<VALOR>",
    "key": {}
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/reactMessage. Auth: Bearer <YOUR_TOKEN>. Adds a reaction emoji to an existing message. The reaction stays attached to the original message, without becoming a new message in the conversation. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "react": {
    "text": "<VALOR>",
    "key": {}
  }
}
POSTMensagensBusinesstestado na API real

Rejeitar uma chamada

Rejeita uma chamada recebida no número conectado. Útil em instâncias que lidam apenas com texto e nunca devem atender uma chamada.

POSThttps://{seu_host}/rest/sendMessage/{instance_key}/rejectCall

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "to": "5511999998888",
  "id": "<VALOR>"
}
opcionalValor enviado no corpo: message data.
AtributosTipoDescrição
tostring
idstring
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/rejectCall" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "to": "5511999998888",
    "id": "<VALOR>"
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/rejectCall', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "id": "<VALOR>"
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/rejectCall', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "id": "<VALOR>"
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to reject a call. On confirm, the backend must call POST /rest/sendMessage/{instance_key}/rejectCall on megaAPI using the configured instance and the securely stored token. Rejects an incoming call on the connected number. Useful on instances that only handle text and should never answer a call. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "to": "5511999998888",
    "id": "<VALOR>"
  }
}
Claude Code
Implement a TypeScript function called sendMessage_rejectCall that calls POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/rejectCall with Authorization Bearer <YOUR_TOKEN>. Rejects an incoming call on the connected number. Useful on instances that only handle text and should never answer a call. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "to": "5511999998888",
    "id": "<VALOR>"
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the sendMessage.rejectCall integration in a Node.js service. Rejects an incoming call on the connected number. Useful on instances that only handle text and should never answer a call."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/rejectCall",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "to": "5511999998888",
          "id": "<VALOR>"
        }
      }
    }
  ]
}
Cursor
In the current project, implement the sendMessage_rejectCall client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/rejectCall. Rejects an incoming call on the connected number. Useful on instances that only handle text and should never answer a call. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "to": "5511999998888",
    "id": "<VALOR>"
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/rejectCall. Auth: Bearer <YOUR_TOKEN>. Rejects an incoming call on the connected number. Useful on instances that only handle text and should never answer a call. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "to": "5511999998888",
    "id": "<VALOR>"
  }
}
POSTMensagensBusinesstestado na API real

Fazer uma chamada

Inicia uma chamada do WhatsApp para um número a partir da instância.

POSThttps://{seu_host}/rest/sendMessage/{instance_key}/sendCall

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "to": "5511999998888",
  "isVideo": false
}
opcionalValor enviado no corpo: message data.
AtributosTipoDescrição
tostring
isVideoboolean
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/sendCall" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "to": "5511999998888",
    "isVideo": false
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/sendCall', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "isVideo": false
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/sendCall', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "isVideo": false
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to make a call. On confirm, the backend must call POST /rest/sendMessage/{instance_key}/sendCall on megaAPI using the configured instance and the securely stored token. Starts a WhatsApp call to a number from the instance. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "to": "5511999998888",
    "isVideo": false
  }
}
Claude Code
Implement a TypeScript function called sendMessage_sendCall that calls POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/sendCall with Authorization Bearer <YOUR_TOKEN>. Starts a WhatsApp call to a number from the instance. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "to": "5511999998888",
    "isVideo": false
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the sendMessage.sendCall integration in a Node.js service. Starts a WhatsApp call to a number from the instance."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/sendCall",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "to": "5511999998888",
          "isVideo": false
        }
      }
    }
  ]
}
Cursor
In the current project, implement the sendMessage_sendCall client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/sendCall. Starts a WhatsApp call to a number from the instance. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "to": "5511999998888",
    "isVideo": false
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/sendCall. Auth: Bearer <YOUR_TOKEN>. Starts a WhatsApp call to a number from the instance. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "to": "5511999998888",
    "isVideo": false
  }
}
POSTMensagensBusinessStartNoCodetestado na API real

Enviar link com pré-visualização

Envia uma mensagem com um link já acompanhado do cartão de preview — título, descrição e imagem do site — em vez do link puro.

POSThttps://{seu_host}/rest/sendMessage/{instance_key}/sendLinkPreview

Disponível em mais de um plano — troque o host conforme a sua instância:

Business: apibusiness1.megaapi.com.brStart: apistart01.megaapi.com.br / apistart02.megaapi.com.br / apistart03.megaapi.com.brNoCode: apinocode01.megaapi.com.br / apinocode02.megaapi.com.br
CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "to": "5511999998888",
  "textWithLink": "<VALOR>"
}
opcionalValor enviado no corpo: message data.
AtributosTipoDescrição
tostringContato que vai receber a mensagem
textWithLinkstringURL que será enviada
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/sendLinkPreview" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "to": "5511999998888",
    "textWithLink": "<VALOR>"
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/sendLinkPreview', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "textWithLink": "<VALOR>"
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/sendLinkPreview', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "textWithLink": "<VALOR>"
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to send link with preview. On confirm, the backend must call POST /rest/sendMessage/{instance_key}/sendLinkPreview on megaAPI using the configured instance and the securely stored token. Sends a message with a link already accompanied by the preview card - title, description, and site image - instead of the raw link. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "to": "5511999998888",
    "textWithLink": "<VALOR>"
  }
}
Claude Code
Implement a TypeScript function called sendMessage_sendLinkPreview that calls POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/sendLinkPreview with Authorization Bearer <YOUR_TOKEN>. Sends a message with a link already accompanied by the preview card - title, description, and site image - instead of the raw link. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "to": "5511999998888",
    "textWithLink": "<VALOR>"
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the sendMessage.sendLinkPreview integration in a Node.js service. Sends a message with a link already accompanied by the preview card - title, description, and site image - instead of the raw link."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/sendLinkPreview",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "to": "5511999998888",
          "textWithLink": "<VALOR>"
        }
      }
    }
  ]
}
Cursor
In the current project, implement the sendMessage_sendLinkPreview client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/sendLinkPreview. Sends a message with a link already accompanied by the preview card - title, description, and site image - instead of the raw link. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "to": "5511999998888",
    "textWithLink": "<VALOR>"
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/sendLinkPreview. Auth: Bearer <YOUR_TOKEN>. Sends a message with a link already accompanied by the preview card - title, description, and site image - instead of the raw link. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "to": "5511999998888",
    "textWithLink": "<VALOR>"
  }
}
POSTMensagensBusinesstestado na API real

Enviar link com pré-visualização para vários

Envia a mesma mensagem com o cartão de preview para uma lista de números em uma única chamada.

POSThttps://{seu_host}/rest/sendMessage/{instance_key}/sendLinkPreviewToMany

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "to": [
    ""
  ],
  "textWithLink": "<VALOR>"
}
opcionalValor enviado no corpo: message data.
AtributosTipoDescrição
toarray
textWithLinkstring
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/sendLinkPreviewToMany" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "to": [
      ""
    ],
    "textWithLink": "<VALOR>"
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/sendLinkPreviewToMany', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": [
      ""
    ],
    "textWithLink": "<VALOR>"
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/sendLinkPreviewToMany', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": [
      ""
    ],
    "textWithLink": "<VALOR>"
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to send link with preview to many. On confirm, the backend must call POST /rest/sendMessage/{instance_key}/sendLinkPreviewToMany on megaAPI using the configured instance and the securely stored token. Sends the same message with the preview card to a list of numbers in a single call. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "to": [
      ""
    ],
    "textWithLink": "<VALOR>"
  }
}
Claude Code
Implement a TypeScript function called sendMessage_sendLinkPreviewToMany that calls POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/sendLinkPreviewToMany with Authorization Bearer <YOUR_TOKEN>. Sends the same message with the preview card to a list of numbers in a single call. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "to": [
      ""
    ],
    "textWithLink": "<VALOR>"
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the sendMessage.sendLinkPreviewToMany integration in a Node.js service. Sends the same message with the preview card to a list of numbers in a single call."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/sendLinkPreviewToMany",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "to": [
            ""
          ],
          "textWithLink": "<VALOR>"
        }
      }
    }
  ]
}
Cursor
In the current project, implement the sendMessage_sendLinkPreviewToMany client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/sendLinkPreviewToMany. Sends the same message with the preview card to a list of numbers in a single call. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "to": [
      ""
    ],
    "textWithLink": "<VALOR>"
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/sendLinkPreviewToMany. Auth: Bearer <YOUR_TOKEN>. Sends the same message with the preview card to a list of numbers in a single call. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "to": [
      ""
    ],
    "textWithLink": "<VALOR>"
  }
}
POSTMensagensBusinesstestado na API real

Publicar texto no status

Publica uma mensagem de texto no status — as publicações que desaparecem após 24 horas. Quem a vê depende das configurações de privacidade do status do número conectado.

POSThttps://{seu_host}/rest/sendMessage/{instance_key}/sendMessageStories

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "text": "<VALOR>",
  "textFont": 1,
  "textColor": "<VALOR>",
  "backgroundColor": "<VALOR>",
  "jidList": [
    ""
  ]
}
opcionalValor enviado no corpo: message data.
AtributosTipoDescrição
textstring
textFontnumber
textColorstring
backgroundColorstring
jidListarray
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/sendMessageStories" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "text": "<VALOR>",
    "textFont": 1,
    "textColor": "<VALOR>",
    "backgroundColor": "<VALOR>",
    "jidList": [
      ""
    ]
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/sendMessageStories', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "text": "<VALOR>",
    "textFont": 1,
    "textColor": "<VALOR>",
    "backgroundColor": "<VALOR>",
    "jidList": [
      ""
    ]
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/sendMessageStories', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "text": "<VALOR>",
    "textFont": 1,
    "textColor": "<VALOR>",
    "backgroundColor": "<VALOR>",
    "jidList": [
      ""
    ]
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to post text to status. On confirm, the backend must call POST /rest/sendMessage/{instance_key}/sendMessageStories on megaAPI using the configured instance and the securely stored token. Publishes a text message in the status - the posts that disappear after 24 hours. Who sees it depends on the status privacy settings of the connected number. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "text": "<VALOR>",
    "textFont": 1,
    "textColor": "<VALOR>",
    "backgroundColor": "<VALOR>",
    "jidList": [
      ""
    ]
  }
}
Claude Code
Implement a TypeScript function called sendMessage_sendMessageStories that calls POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/sendMessageStories with Authorization Bearer <YOUR_TOKEN>. Publishes a text message in the status - the posts that disappear after 24 hours. Who sees it depends on the status privacy settings of the connected number. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "text": "<VALOR>",
    "textFont": 1,
    "textColor": "<VALOR>",
    "backgroundColor": "<VALOR>",
    "jidList": [
      ""
    ]
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the sendMessage.sendMessageStories integration in a Node.js service. Publishes a text message in the status - the posts that disappear after 24 hours. Who sees it depends on the status privacy settings of the connected number."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/sendMessageStories",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "text": "<VALOR>",
          "textFont": 1,
          "textColor": "<VALOR>",
          "backgroundColor": "<VALOR>",
          "jidList": [
            ""
          ]
        }
      }
    }
  ]
}
Cursor
In the current project, implement the sendMessage_sendMessageStories client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/sendMessageStories. Publishes a text message in the status - the posts that disappear after 24 hours. Who sees it depends on the status privacy settings of the connected number. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "text": "<VALOR>",
    "textFont": 1,
    "textColor": "<VALOR>",
    "backgroundColor": "<VALOR>",
    "jidList": [
      ""
    ]
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/sendMessageStories. Auth: Bearer <YOUR_TOKEN>. Publishes a text message in the status - the posts that disappear after 24 hours. Who sees it depends on the status privacy settings of the connected number. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "text": "<VALOR>",
    "textFont": 1,
    "textColor": "<VALOR>",
    "backgroundColor": "<VALOR>",
    "jidList": [
      ""
    ]
  }
}
POSTMensagensBusinesstestado na API real

Enviar figurinha

Envia uma figurinha para uma conversa. A imagem deve estar no formato que o WhatsApp aceita para figurinhas (WebP); uma foto comum enviada aqui normalmente é rejeitada.

POSThttps://{seu_host}/rest/sendMessage/{instance_key}/sticker?to=5511999998888

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
toquerystring"5511999998888"opcionalFiltro ou opção da consulta: to.
Ex.: 55 (Brasil) + 11 (DDD) + número, tudo junto e só dígitos. Nunca use +, espaço ou traço. Para grupo, use o ID terminado em @g.us.
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/sticker?to=5511999998888" \
  -H "Authorization: Bearer <SEU_TOKEN>"
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/sticker?to=5511999998888', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' },
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/sticker?to=5511999998888', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' }
});
console.log(await response.json());
HTTP 400
{
  "name": "BAD_REQUEST",
  "message": "<VALOR>",
  "status": 400,
  "errors": [],
  "stack": "<VALOR>"
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to send sticker. On confirm, the backend must call POST /rest/sendMessage/{instance_key}/sticker on megaAPI using the configured instance and the securely stored token. Sends a sticker to a conversation. The image must be in the format WhatsApp accepts for stickers (WebP); a regular photo sent here is usually rejected. Show loading, success, and error states; do not expose the token in the browser. Example data: no JSON body
Claude Code
Implement a TypeScript function called sendMessage_sticker that calls POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/sticker?to=5511999998888 with Authorization Bearer <YOUR_TOKEN>. Sends a sticker to a conversation. The image must be in the format WhatsApp accepts for stickers (WebP); a regular photo sent here is usually rejected. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: no JSON body
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the sendMessage.sticker integration in a Node.js service. Sends a sticker to a conversation. The image must be in the format WhatsApp accepts for stickers (WebP); a regular photo sent here is usually rejected."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/sticker?to=5511999998888",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": null
    }
  ]
}
Cursor
In the current project, implement the sendMessage_sticker client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/sticker?to=5511999998888. Sends a sticker to a conversation. The image must be in the format WhatsApp accepts for stickers (WebP); a regular photo sent here is usually rejected. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: no JSON body
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/sticker?to=5511999998888. Auth: Bearer <YOUR_TOKEN>. Sends a sticker to a conversation. The image must be in the format WhatsApp accepts for stickers (WebP); a regular photo sent here is usually rejected. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: no JSON body
POSTMensagensBusinessStarttestado na API real

Enviar botões de modelo

Envia uma mensagem com botões de modelo, que além de responder podem abrir um link ou iniciar uma ligação.

POSThttps://{seu_host}/rest/sendMessage/{instance_key}/templateMessage

Disponível em mais de um plano — troque o host conforme a sua instância:

Business: apibusiness1.megaapi.com.brStart: apistart01.megaapi.com.br / apistart02.megaapi.com.br / apistart03.megaapi.com.br
CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "to": "5511999998888",
  "title": "<VALOR>",
  "text": "<VALOR>",
  "footer": "<VALOR>",
  "type": "<VALOR>",
  "mediaUrl": "https://seu-dominio.com/webhook",
  "buttons": []
}
opcionalValor enviado no corpo: message data.
AtributosTipoDescrição
tostring
titlestring
textstring
footerstring
typestring
mediaUrlstring
buttonsarray
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/templateMessage" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "to": "5511999998888",
    "title": "<VALOR>",
    "text": "<VALOR>",
    "footer": "<VALOR>",
    "type": "<VALOR>",
    "mediaUrl": "https://seu-dominio.com/webhook",
    "buttons": []
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/templateMessage', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "title": "<VALOR>",
    "text": "<VALOR>",
    "footer": "<VALOR>",
    "type": "<VALOR>",
    "mediaUrl": "https://seu-dominio.com/webhook",
    "buttons": []
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/templateMessage', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "title": "<VALOR>",
    "text": "<VALOR>",
    "footer": "<VALOR>",
    "type": "<VALOR>",
    "mediaUrl": "https://seu-dominio.com/webhook",
    "buttons": []
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to send model buttons. On confirm, the backend must call POST /rest/sendMessage/{instance_key}/templateMessage on megaAPI using the configured instance and the securely stored token. Sends a message with model buttons, which besides replying can open a link or start a call. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "to": "5511999998888",
    "title": "<VALOR>",
    "text": "<VALOR>",
    "footer": "<VALOR>",
    "type": "<VALOR>",
    "mediaUrl": "https://seu-dominio.com/webhook",
    "buttons": []
  }
}
Claude Code
Implement a TypeScript function called sendMessage_templateMessage that calls POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/templateMessage with Authorization Bearer <YOUR_TOKEN>. Sends a message with model buttons, which besides replying can open a link or start a call. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "to": "5511999998888",
    "title": "<VALOR>",
    "text": "<VALOR>",
    "footer": "<VALOR>",
    "type": "<VALOR>",
    "mediaUrl": "https://seu-dominio.com/webhook",
    "buttons": []
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the sendMessage.templateMessage integration in a Node.js service. Sends a message with model buttons, which besides replying can open a link or start a call."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/templateMessage",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "to": "5511999998888",
          "title": "<VALOR>",
          "text": "<VALOR>",
          "footer": "<VALOR>",
          "type": "<VALOR>",
          "mediaUrl": "https://seu-dominio.com/webhook",
          "buttons": []
        }
      }
    }
  ]
}
Cursor
In the current project, implement the sendMessage_templateMessage client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/templateMessage. Sends a message with model buttons, which besides replying can open a link or start a call. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "to": "5511999998888",
    "title": "<VALOR>",
    "text": "<VALOR>",
    "footer": "<VALOR>",
    "type": "<VALOR>",
    "mediaUrl": "https://seu-dominio.com/webhook",
    "buttons": []
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/templateMessage. Auth: Bearer <YOUR_TOKEN>. Sends a message with model buttons, which besides replying can open a link or start a call. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "to": "5511999998888",
    "title": "<VALOR>",
    "text": "<VALOR>",
    "footer": "<VALOR>",
    "type": "<VALOR>",
    "mediaUrl": "https://seu-dominio.com/webhook",
    "buttons": []
  }
}
POSTMensagensBusinessStartNoCodetestado na API real

Enviar mensagem de texto

Envia uma mensagem de texto simples para um número de WhatsApp. O endpoint mais usado da API — funciona com qualquer número que tenha o WhatsApp instalado, mesmo sem ser um contato salvo.

POSThttps://{seu_host}/rest/sendMessage/{instance_key}/text

Disponível em mais de um plano — troque o host conforme a sua instância:

Business: apibusiness1.megaapi.com.brStart: apistart01.megaapi.com.br / apistart02.megaapi.com.br / apistart03.megaapi.com.brNoCode: apinocode01.megaapi.com.br / apinocode02.megaapi.com.br
CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "to": "5511999998888",
  "text": "<VALOR>",
  "linkPreview": false
}
opcionalValor enviado no corpo: message data.
Em `to` vai o número com DDI+DDD e só dígitos (ex.: 5511999998888); em `text`, a mensagem. `linkPreview: true` mostra a pré-visualização quando o texto tem um link.
AtributosTipoDescrição
tostringGrupo que vai receber a mensagem
textstringMensagem que será enviada
linkPreviewboolean
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/text" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "to": "5511999998888",
    "text": "<VALOR>",
    "linkPreview": false
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/text', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "text": "<VALOR>",
    "linkPreview": false
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/text', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "text": "<VALOR>",
    "linkPreview": false
  }
})
});
console.log(await response.json());
HTTP 200
{
  "error": false,
  "message": "Message sent",
  "messageData": {
    "key": {
      "remoteJid": "<DESTINO>@s.whatsapp.net",
      "fromMe": true,
      "id": "<MESSAGE_ID>"
    },
    "messageTimestamp": "<TIMESTAMP>",
    "status": "SERVER_ACK"
  }
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to send text message. On confirm, the backend must call POST /rest/sendMessage/{instance_key}/text on megaAPI using the configured instance and the securely stored token. Sends a simple text message to a WhatsApp number. The most used endpoint in the API - works with any number that has WhatsApp installed, even without being a saved contact. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "to": "5511999998888",
    "text": "<VALOR>",
    "linkPreview": false
  }
}
Claude Code
Implement a TypeScript function called sendMessage_text that calls POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/text with Authorization Bearer <YOUR_TOKEN>. Sends a simple text message to a WhatsApp number. The most used endpoint in the API - works with any number that has WhatsApp installed, even without being a saved contact. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "to": "5511999998888",
    "text": "<VALOR>",
    "linkPreview": false
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the sendMessage.text integration in a Node.js service. Sends a simple text message to a WhatsApp number. The most used endpoint in the API - works with any number that has WhatsApp installed, even without being a saved contact."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/text",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "to": "5511999998888",
          "text": "<VALOR>",
          "linkPreview": false
        }
      }
    }
  ]
}
Cursor
In the current project, implement the sendMessage_text client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/text. Sends a simple text message to a WhatsApp number. The most used endpoint in the API - works with any number that has WhatsApp installed, even without being a saved contact. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "to": "5511999998888",
    "text": "<VALOR>",
    "linkPreview": false
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/text. Auth: Bearer <YOUR_TOKEN>. Sends a simple text message to a WhatsApp number. The most used endpoint in the API - works with any number that has WhatsApp installed, even without being a saved contact. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "to": "5511999998888",
    "text": "<VALOR>",
    "linkPreview": false
  }
}
POSTMensagensBusinesstestado na API real

Enviar texto com menção

Envia texto marcando pessoas específicas, como um @ dentro de um grupo. Quem é mencionado recebe uma notificação mesmo quando o grupo está silenciado.

POSThttps://{seu_host}/rest/sendMessage/{instance_key}/textMentioned

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "to": "5511999998888",
  "text": "<VALOR>",
  "mentions": [
    ""
  ]
}
opcionalValor enviado no corpo: message data.
Envie a conversa de destino, o texto e a lista de números a mencionar, cada um com DDI+DDD e só dígitos.
AtributosTipoDescrição
tostringContato que vai receber a mensagem
textstringMensagem que será enviada
mentionsarrayContato que será mencionado na mensagem (EX: [email protected] em caso de grupo [email protected])
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/textMentioned" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "to": "5511999998888",
    "text": "<VALOR>",
    "mentions": [
      ""
    ]
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/textMentioned', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "text": "<VALOR>",
    "mentions": [
      ""
    ]
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/textMentioned', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": "5511999998888",
    "text": "<VALOR>",
    "mentions": [
      ""
    ]
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to send text with mention. On confirm, the backend must call POST /rest/sendMessage/{instance_key}/textMentioned on megaAPI using the configured instance and the securely stored token. Sends text tagging specific people, like @ inside a group. Those mentioned get a notification even when the group is muted. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "to": "5511999998888",
    "text": "<VALOR>",
    "mentions": [
      ""
    ]
  }
}
Claude Code
Implement a TypeScript function called sendMessage_textMentioned that calls POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/textMentioned with Authorization Bearer <YOUR_TOKEN>. Sends text tagging specific people, like @ inside a group. Those mentioned get a notification even when the group is muted. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "to": "5511999998888",
    "text": "<VALOR>",
    "mentions": [
      ""
    ]
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the sendMessage.textMentioned integration in a Node.js service. Sends text tagging specific people, like @ inside a group. Those mentioned get a notification even when the group is muted."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/textMentioned",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "to": "5511999998888",
          "text": "<VALOR>",
          "mentions": [
            ""
          ]
        }
      }
    }
  ]
}
Cursor
In the current project, implement the sendMessage_textMentioned client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/textMentioned. Sends text tagging specific people, like @ inside a group. Those mentioned get a notification even when the group is muted. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "to": "5511999998888",
    "text": "<VALOR>",
    "mentions": [
      ""
    ]
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/textMentioned. Auth: Bearer <YOUR_TOKEN>. Sends text tagging specific people, like @ inside a group. Those mentioned get a notification even when the group is muted. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "to": "5511999998888",
    "text": "<VALOR>",
    "mentions": [
      ""
    ]
  }
}
POSTMensagensBusinesstestado na API real

Enviar texto para muitos

Envia a mesma mensagem de texto para uma lista de números em uma única chamada. Cuidado com o envio em massa: enviar demais, rápido demais e para pessoas que não esperam contato é o caminho mais rápido para o WhatsApp bloquear o número.

POSThttps://{seu_host}/rest/sendMessage/{instance_key}/textToMany

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "to": [
    ""
  ],
  "text": "<VALOR>",
  "linkPreview": false
}
opcionalValor enviado no corpo: message data.
Aqui `to` é uma lista de números, cada um com DDI+DDD e só dígitos. Ex.: ["5511999998888", "5521988887777"].
AtributosTipoDescrição
toarrayLista de contatos que vão receber a mensagem
textstringMensagem que será enviada
linkPreviewboolean
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/textToMany" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "to": [
      ""
    ],
    "text": "<VALOR>",
    "linkPreview": false
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/textToMany', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": [
      ""
    ],
    "text": "<VALOR>",
    "linkPreview": false
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/textToMany', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "to": [
      ""
    ],
    "text": "<VALOR>",
    "linkPreview": false
  }
})
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to send text to many. On confirm, the backend must call POST /rest/sendMessage/{instance_key}/textToMany on megaAPI using the configured instance and the securely stored token. Sends the same text message to a list of numbers in a single call. Watch out for mass sending: sending too much, too fast, and to people who do not expect contact is the fastest way for WhatsApp to block the number. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "to": [
      ""
    ],
    "text": "<VALOR>",
    "linkPreview": false
  }
}
Claude Code
Implement a TypeScript function called sendMessage_textToMany that calls POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/textToMany with Authorization Bearer <YOUR_TOKEN>. Sends the same text message to a list of numbers in a single call. Watch out for mass sending: sending too much, too fast, and to people who do not expect contact is the fastest way for WhatsApp to block the number. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "to": [
      ""
    ],
    "text": "<VALOR>",
    "linkPreview": false
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the sendMessage.textToMany integration in a Node.js service. Sends the same text message to a list of numbers in a single call. Watch out for mass sending: sending too much, too fast, and to people who do not expect contact is the fastest way for WhatsApp to block the number."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/textToMany",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "to": [
            ""
          ],
          "text": "<VALOR>",
          "linkPreview": false
        }
      }
    }
  ]
}
Cursor
In the current project, implement the sendMessage_textToMany client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/textToMany. Sends the same text message to a list of numbers in a single call. Watch out for mass sending: sending too much, too fast, and to people who do not expect contact is the fastest way for WhatsApp to block the number. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "to": [
      ""
    ],
    "text": "<VALOR>",
    "linkPreview": false
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/textToMany. Auth: Bearer <YOUR_TOKEN>. Sends the same text message to a list of numbers in a single call. Watch out for mass sending: sending too much, too fast, and to people who do not expect contact is the fastest way for WhatsApp to block the number. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "to": [
      ""
    ],
    "text": "<VALOR>",
    "linkPreview": false
  }
}
POSTMensagensBusinesstestado na API real

Enviar vídeo

Envia um vídeo com legenda opcional. Você pode fazer o vídeo se comportar como um GIF, em loop e sem som.

POSThttps://{seu_host}/rest/sendMessage/{instance_key}/video?to=5511999998888&caption=<VALOR>&gifPlayback=false&viewOnce=false

Host do plano Business: apibusiness1.megaapi.com.br.

CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
toquerystring"5511999998888"opcionalFiltro ou opção da consulta: to.
Ex.: 55 (Brasil) + 11 (DDD) + número, tudo junto e só dígitos. Nunca use +, espaço ou traço. Para grupo, use o ID terminado em @g.us.
captionquerystring"<VALOR>"opcionalFiltro ou opção da consulta: caption.
Legenda que aparece junto do arquivo. Pode ficar em branco.
gifPlaybackquerybooleanfalseopcionalFiltro ou opção da consulta: gif playback.
true faz o vídeo tocar em repetição e sem som, do jeito que um GIF aparece na conversa.
viewOncequerybooleanfalseopcionalFiltro ou opção da consulta: view once.
true faz a mídia sumir depois de aberta uma única vez — nem o destinatário nem você conseguem reabrir ou baixar depois.
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/video?to=5511999998888&caption=<VALOR>&gifPlayback=false&viewOnce=false" \
  -H "Authorization: Bearer <SEU_TOKEN>"
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/video?to=5511999998888&caption=<VALOR>&gifPlayback=false&viewOnce=false', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' },
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/video?to=5511999998888&caption=<VALOR>&gifPlayback=false&viewOnce=false', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' }
});
console.log(await response.json());
HTTP 400
{
  "name": "BAD_REQUEST",
  "message": "<VALOR>",
  "status": 400,
  "errors": [],
  "stack": "<VALOR>"
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to send video. On confirm, the backend must call POST /rest/sendMessage/{instance_key}/video on megaAPI using the configured instance and the securely stored token. Sends a video with optional caption. You can make the video behave like a GIF, looping and silent. Show loading, success, and error states; do not expose the token in the browser. Example data: no JSON body
Claude Code
Implement a TypeScript function called sendMessage_video that calls POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/video?to=5511999998888&caption=<VALOR>&gifPlayback=false&viewOnce=false with Authorization Bearer <YOUR_TOKEN>. Sends a video with optional caption. You can make the video behave like a GIF, looping and silent. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: no JSON body
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the sendMessage.video integration in a Node.js service. Sends a video with optional caption. You can make the video behave like a GIF, looping and silent."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/video?to=5511999998888&caption=<VALOR>&gifPlayback=false&viewOnce=false",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": null
    }
  ]
}
Cursor
In the current project, implement the sendMessage_video client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/video?to=5511999998888&caption=<VALOR>&gifPlayback=false&viewOnce=false. Sends a video with optional caption. You can make the video behave like a GIF, looping and silent. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: no JSON body
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/sendMessage/<INSTANCE_KEY>/video?to=5511999998888&caption=<VALOR>&gifPlayback=false&viewOnce=false. Auth: Bearer <YOUR_TOKEN>. Sends a video with optional caption. You can make the video behave like a GIF, looping and silent. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: no JSON body
POSTWebhooksBusinessStartNoCodetestado na API real

Configurar webhook

Define o endereço do seu sistema que receberá os eventos do WhatsApp conforme eles acontecem: mensagem recebida, confirmação de entrega e mudanças de status. Sem um webhook configurado, a única forma de saber o que chegou é consultar a API de tempos em tempos.

POSThttps://{seu_host}/rest/webhook/{instance_key}/configWebhook

Disponível em mais de um plano — troque o host conforme a sua instância:

Business: apibusiness1.megaapi.com.brStart: apistart01.megaapi.com.br / apistart02.megaapi.com.br / apistart03.megaapi.com.brNoCode: apinocode01.megaapi.com.br / apinocode02.megaapi.com.br
CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
messageDatabodyobject
JSON
{
  "webhookUrl": "https://seu-dominio.com/webhook",
  "webhookEnabled": true
}
opcionalValor enviado no corpo: message data.
`webhookUrl` precisa ser um endereço público em https, acessível pela internet (endereço local como localhost não funciona). `webhookEnabled: true` liga o envio.
AtributosTipoDescrição
webhookUrlstringURL do seu webhook
webhookEnabledbooleantrue - Ativado para receber os eventos false - Desativado para receber os eventos
curl
curl -X POST "https://apibusiness1.megaapi.com.br/rest/webhook/<INSTANCE_KEY>/configWebhook" \
  -H "Authorization: Bearer <SEU_TOKEN>"
  -H "Content-Type: application/json" \
  -d '{
  "messageData": {
    "webhookUrl": "https://seu-dominio.com/webhook",
    "webhookEnabled": true
  }
}'
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/webhook/<INSTANCE_KEY>/configWebhook', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "webhookUrl": "https://seu-dominio.com/webhook",
    "webhookEnabled": true
  }
}),
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/webhook/<INSTANCE_KEY>/configWebhook', {
  method: 'POST',
  headers: { Authorization: 'Bearer <SEU_TOKEN>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "messageData": {
    "webhookUrl": "https://seu-dominio.com/webhook",
    "webhookEnabled": true
  }
})
});
console.log(await response.json());
HTTP 200
{
  "error": false,
  "message": "Webhooks configured",
  "dataMessage": {
    "webhookUrl": "https://<SEU_DOMINIO>/webhook",
    "webhookEnabled": true
  }
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to configure webhook. On confirm, the backend must call POST /rest/webhook/{instance_key}/configWebhook on megaAPI using the configured instance and the securely stored token. Sets the address of your system that will receive WhatsApp events as they happen: received message, delivery confirmation, and status changes. Without a configured webhook, the only way to know what arrived is to poll the API from time to time. Show loading, success, and error states; do not expose the token in the browser. Example data: {
  "messageData": {
    "webhookUrl": "https://seu-dominio.com/webhook",
    "webhookEnabled": true
  }
}
Claude Code
Implement a TypeScript function called webhook_configWebhook that calls POST https://apibusiness1.megaapi.com.br/rest/webhook/<INSTANCE_KEY>/configWebhook with Authorization Bearer <YOUR_TOKEN>. Sets the address of your system that will receive WhatsApp events as they happen: received message, delivery confirmation, and status changes. Without a configured webhook, the only way to know what arrived is to poll the API from time to time. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: {
  "messageData": {
    "webhookUrl": "https://seu-dominio.com/webhook",
    "webhookEnabled": true
  }
}
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the webhook.configWebhook integration in a Node.js service. Sets the address of your system that will receive WhatsApp events as they happen: received message, delivery confirmation, and status changes. Without a configured webhook, the only way to know what arrived is to poll the API from time to time."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "POST",
      "url": "POST https://apibusiness1.megaapi.com.br/rest/webhook/<INSTANCE_KEY>/configWebhook",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": {
        "messageData": {
          "webhookUrl": "https://seu-dominio.com/webhook",
          "webhookEnabled": true
        }
      }
    }
  ]
}
Cursor
In the current project, implement the webhook_configWebhook client in TypeScript for POST https://apibusiness1.megaapi.com.br/rest/webhook/<INSTANCE_KEY>/configWebhook. Sets the address of your system that will receive WhatsApp events as they happen: received message, delivery confirmation, and status changes. Without a configured webhook, the only way to know what arrived is to poll the API from time to time. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: {
  "messageData": {
    "webhookUrl": "https://seu-dominio.com/webhook",
    "webhookEnabled": true
  }
}
Codex
Create a TypeScript function for POST https://apibusiness1.megaapi.com.br/rest/webhook/<INSTANCE_KEY>/configWebhook. Auth: Bearer <YOUR_TOKEN>. Sets the address of your system that will receive WhatsApp events as they happen: received message, delivery confirmation, and status changes. Without a configured webhook, the only way to know what arrived is to poll the API from time to time. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: {
  "messageData": {
    "webhookUrl": "https://seu-dominio.com/webhook",
    "webhookEnabled": true
  }
}
GETWebhooksBusinessStartNoCodetestado na API real

Ver configuração do webhook

Mostra para qual endereço a megaAPI envia as notificações do WhatsApp e se esse envio está ativo. O primeiro lugar para verificar quando seu sistema parou de receber mensagens.

GEThttps://{seu_host}/rest/webhook/{instance_key}

Disponível em mais de um plano — troque o host conforme a sua instância:

Business: apibusiness1.megaapi.com.brStart: apistart01.megaapi.com.br / apistart02.megaapi.com.br / apistart03.megaapi.com.brNoCode: apinocode01.megaapi.com.br / apinocode02.megaapi.com.br
CampoOndeTipoExemploObrigatórioO que colocar
instance_keypathstring"megabusiness-<CODIGO>"simChave da instância que fará a operação.
curl
curl -X GET "https://apibusiness1.megaapi.com.br/rest/webhook/<INSTANCE_KEY>" \
  -H "Authorization: Bearer <SEU_TOKEN>"
node
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/webhook/<INSTANCE_KEY>', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' },
});
const data = await response.json();
console.log(data);
fetch
const response = await fetch('https://apibusiness1.megaapi.com.br/rest/webhook/<INSTANCE_KEY>', {
  method: 'GET',
  headers: { Authorization: 'Bearer <SEU_TOKEN>' }
});
console.log(await response.json());
HTTP 200
{
  "success": true,
  "message": "Resposta retornada pela megaAPI."
}

Leve este endpoint para o seu agente

5 moldes
Lovable
Add to the product a user action to view webhook configuration. On confirm, the backend must call GET /rest/webhook/{instance_key} on megaAPI using the configured instance and the securely stored token. Shows which address megaAPI sends WhatsApp notifications to and whether that delivery is on. The first place to look when your system stopped receiving messages. Show loading, success, and error states; do not expose the token in the browser. Example data: no JSON body
Claude Code
Implement a TypeScript function called webhook_instance_key that calls GET https://apibusiness1.megaapi.com.br/rest/webhook/<INSTANCE_KEY> with Authorization Bearer <YOUR_TOKEN>. Shows which address megaAPI sends WhatsApp notifications to and whether that delivery is on. The first place to look when your system stopped receiving messages. Use the documented parameters and handle non-2xx HTTP responses without exposing the token. Example body: no JSON body
Grok
{
  "model": "grok-4",
  "input": [
    {
      "role": "user",
      "content": "Implement the webhook.instance_key integration in a Node.js service. Shows which address megaAPI sends WhatsApp notifications to and whether that delivery is on. The first place to look when your system stopped receiving messages."
    }
  ],
  "tools": [
    {
      "type": "http",
      "method": "GET",
      "url": "GET https://apibusiness1.megaapi.com.br/rest/webhook/<INSTANCE_KEY>",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      },
      "json_body": null
    }
  ]
}
Cursor
In the current project, implement the webhook_instance_key client in TypeScript for GET https://apibusiness1.megaapi.com.br/rest/webhook/<INSTANCE_KEY>. Shows which address megaAPI sends WhatsApp notifications to and whether that delivery is on. The first place to look when your system stopped receiving messages. Keep the call isolated, typed, and testable; read instance_key and the remaining parameters from configuration, never hardcode credentials. Payload: no JSON body
Codex
Create a TypeScript function for GET https://apibusiness1.megaapi.com.br/rest/webhook/<INSTANCE_KEY>. Auth: Bearer <YOUR_TOKEN>. Shows which address megaAPI sends WhatsApp notifications to and whether that delivery is on. The first place to look when your system stopped receiving messages. Validate the HTTP status, serialize the payload below, and return typed JSON. Payload: no JSON body