curl --request POST \
--url https://api.whatsapp.json.pe/send/media \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"number": "51999999997",
"file": "https://cpe.sunat.gob.pe/sites/default/files/inline-files/Manual-de-Consulta-Integrada-de-Comprobante-de-Pago-por-ServicioWEB_v2_0.pdf",
"filetype": "document",
"filename": "documento.pdf",
"caption": "pruebaa"
}
'import requests
url = "https://api.whatsapp.json.pe/send/media"
payload = {
"number": "51999999997",
"file": "https://cpe.sunat.gob.pe/sites/default/files/inline-files/Manual-de-Consulta-Integrada-de-Comprobante-de-Pago-por-ServicioWEB_v2_0.pdf",
"filetype": "document",
"filename": "documento.pdf",
"caption": "pruebaa"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
number: '51999999997',
file: 'https://cpe.sunat.gob.pe/sites/default/files/inline-files/Manual-de-Consulta-Integrada-de-Comprobante-de-Pago-por-ServicioWEB_v2_0.pdf',
filetype: 'document',
filename: 'documento.pdf',
caption: 'pruebaa'
})
};
fetch('https://api.whatsapp.json.pe/send/media', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.whatsapp.json.pe/send/media",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'number' => '51999999997',
'file' => 'https://cpe.sunat.gob.pe/sites/default/files/inline-files/Manual-de-Consulta-Integrada-de-Comprobante-de-Pago-por-ServicioWEB_v2_0.pdf',
'filetype' => 'document',
'filename' => 'documento.pdf',
'caption' => 'pruebaa'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.whatsapp.json.pe/send/media"
payload := strings.NewReader("{\n \"number\": \"51999999997\",\n \"file\": \"https://cpe.sunat.gob.pe/sites/default/files/inline-files/Manual-de-Consulta-Integrada-de-Comprobante-de-Pago-por-ServicioWEB_v2_0.pdf\",\n \"filetype\": \"document\",\n \"filename\": \"documento.pdf\",\n \"caption\": \"pruebaa\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.whatsapp.json.pe/send/media")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"number\": \"51999999997\",\n \"file\": \"https://cpe.sunat.gob.pe/sites/default/files/inline-files/Manual-de-Consulta-Integrada-de-Comprobante-de-Pago-por-ServicioWEB_v2_0.pdf\",\n \"filetype\": \"document\",\n \"filename\": \"documento.pdf\",\n \"caption\": \"pruebaa\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.whatsapp.json.pe/send/media")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"number\": \"51999999997\",\n \"file\": \"https://cpe.sunat.gob.pe/sites/default/files/inline-files/Manual-de-Consulta-Integrada-de-Comprobante-de-Pago-por-ServicioWEB_v2_0.pdf\",\n \"filetype\": \"document\",\n \"filename\": \"documento.pdf\",\n \"caption\": \"pruebaa\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "exito",
"data": {}
}{
"success": false,
"message": "Bad Request"
}{
"success": false,
"message": "Bad Request"
}Enviar archivo
POST /send/media API WhatsApp json.pe: envía imagen, documento, video o audio por URL o Base64; obligatorios number, file y filetype; filename y caption opcionales.
curl --request POST \
--url https://api.whatsapp.json.pe/send/media \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"number": "51999999997",
"file": "https://cpe.sunat.gob.pe/sites/default/files/inline-files/Manual-de-Consulta-Integrada-de-Comprobante-de-Pago-por-ServicioWEB_v2_0.pdf",
"filetype": "document",
"filename": "documento.pdf",
"caption": "pruebaa"
}
'import requests
url = "https://api.whatsapp.json.pe/send/media"
payload = {
"number": "51999999997",
"file": "https://cpe.sunat.gob.pe/sites/default/files/inline-files/Manual-de-Consulta-Integrada-de-Comprobante-de-Pago-por-ServicioWEB_v2_0.pdf",
"filetype": "document",
"filename": "documento.pdf",
"caption": "pruebaa"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
number: '51999999997',
file: 'https://cpe.sunat.gob.pe/sites/default/files/inline-files/Manual-de-Consulta-Integrada-de-Comprobante-de-Pago-por-ServicioWEB_v2_0.pdf',
filetype: 'document',
filename: 'documento.pdf',
caption: 'pruebaa'
})
};
fetch('https://api.whatsapp.json.pe/send/media', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.whatsapp.json.pe/send/media",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'number' => '51999999997',
'file' => 'https://cpe.sunat.gob.pe/sites/default/files/inline-files/Manual-de-Consulta-Integrada-de-Comprobante-de-Pago-por-ServicioWEB_v2_0.pdf',
'filetype' => 'document',
'filename' => 'documento.pdf',
'caption' => 'pruebaa'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.whatsapp.json.pe/send/media"
payload := strings.NewReader("{\n \"number\": \"51999999997\",\n \"file\": \"https://cpe.sunat.gob.pe/sites/default/files/inline-files/Manual-de-Consulta-Integrada-de-Comprobante-de-Pago-por-ServicioWEB_v2_0.pdf\",\n \"filetype\": \"document\",\n \"filename\": \"documento.pdf\",\n \"caption\": \"pruebaa\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.whatsapp.json.pe/send/media")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"number\": \"51999999997\",\n \"file\": \"https://cpe.sunat.gob.pe/sites/default/files/inline-files/Manual-de-Consulta-Integrada-de-Comprobante-de-Pago-por-ServicioWEB_v2_0.pdf\",\n \"filetype\": \"document\",\n \"filename\": \"documento.pdf\",\n \"caption\": \"pruebaa\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.whatsapp.json.pe/send/media")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"number\": \"51999999997\",\n \"file\": \"https://cpe.sunat.gob.pe/sites/default/files/inline-files/Manual-de-Consulta-Integrada-de-Comprobante-de-Pago-por-ServicioWEB_v2_0.pdf\",\n \"filetype\": \"document\",\n \"filename\": \"documento.pdf\",\n \"caption\": \"pruebaa\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "exito",
"data": {}
}{
"success": false,
"message": "Bad Request"
}{
"success": false,
"message": "Bad Request"
}Authorizations
Token Bearer del panel json.pe (no compartas tokens en repositorios públicos).
Body
Destino del mensaje. Persona (chat individual): número con código de país, sin el símbolo + (ej. Perú: 51999999997). Grupo: el JID del grupo, p. ej. 120363423133649225@g.us (como en el campo JID al listar grupos).
"51999999997"
Si el archivo es local (solo en tu equipo o sin URL pública), envíalo en Base64. Si no es local y está publicado en internet, envía la URL (https://..., accesible por el servidor que envía a WhatsApp).
"https://cpe.sunat.gob.pe/sites/default/files/inline-files/Manual-de-Consulta-Integrada-de-Comprobante-de-Pago-por-ServicioWEB_v2_0.pdf"
Tipo de medio. Ejemplos: document, image, video, audio
"document"
Nombre de archivo que verá el destinatario con su extensión
"documento.pdf"
Texto opcional que acompaña al medio.
"pruebaa"
