Obter o access token da Meta descriptografado
curl --request GET \
--url https://api.d-api.cloud/api/v1/connections/cloud-api/{id}/access-token \
--header 'Authorization: <api-key>'import requests
url = "https://api.d-api.cloud/api/v1/connections/cloud-api/{id}/access-token"
headers = {"Authorization": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://api.d-api.cloud/api/v1/connections/cloud-api/{id}/access-token', 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.d-api.cloud/api/v1/connections/cloud-api/{id}/access-token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.d-api.cloud/api/v1/connections/cloud-api/{id}/access-token"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.d-api.cloud/api/v1/connections/cloud-api/{id}/access-token")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.d-api.cloud/api/v1/connections/cloud-api/{id}/access-token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"success": true,
"data": "<unknown>",
"error": "<string>",
"code": "<string>"
}API Oficial (Cloud API)
Obter access token da Meta
Recupere, já descriptografado, o access token da Meta guardado numa conexão da API Oficial — e descubra de que tipo ele é.
GET
/
api
/
v1
/
connections
/
cloud-api
/
{id}
/
access-token
Obter o access token da Meta descriptografado
curl --request GET \
--url https://api.d-api.cloud/api/v1/connections/cloud-api/{id}/access-token \
--header 'Authorization: <api-key>'import requests
url = "https://api.d-api.cloud/api/v1/connections/cloud-api/{id}/access-token"
headers = {"Authorization": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://api.d-api.cloud/api/v1/connections/cloud-api/{id}/access-token', 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.d-api.cloud/api/v1/connections/cloud-api/{id}/access-token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.d-api.cloud/api/v1/connections/cloud-api/{id}/access-token"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.d-api.cloud/api/v1/connections/cloud-api/{id}/access-token")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.d-api.cloud/api/v1/connections/cloud-api/{id}/access-token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"success": true,
"data": "<unknown>",
"error": "<string>",
"code": "<string>"
}Devolve o access token da Meta que a D-API guarda para a conexão, já
descriptografado, junto com a classificação do token. O Tipos de token (
Além de
id aceita o id da
conexão ou o id da sessão (cloud-<uuid>).
Tipos de token (kind)
kind | O que é | expiresAt |
|---|---|---|
permanent | Não expira — token de System User / integração de negócio. É o que o Embedded Signup emite. | null |
long_lived | Token de ~60 dias (troca de token de longa duração). | data ISO-8601 |
short_lived | Token de ~1h, vindo direto da troca do code. | data ISO-8601 |
unknown | O /debug_token da Meta não respondeu — o token vai mesmo assim, sem classificação. | null |
kind, data traz label (resumo em português, pronto para exibir),
expiresInDays, isValid, scopes, type (o rótulo da própria Meta: USER,
SYSTEM_USER…), wabaId, phoneNumberId e businessId.
Exemplo
curl https://api.d-api.cloud/api/v1/connections/cloud-api/<CONNECTION_ID>/access-token \
-H "Authorization: <SUA_API_KEY_SECRETA>"
{
"success": true,
"data": {
"accessToken": "EAAG…",
"wabaId": "102290129340398",
"phoneNumberId": "106540352242922",
"businessId": "1049837394389",
"kind": "permanent",
"label": "Permanente (System User) — não expira",
"expiresAt": null,
"expiresInDays": null,
"isValid": true,
"type": "SYSTEM_USER",
"scopes": ["whatsapp_business_management", "whatsapp_business_messaging"]
}
}
O
accessToken é segredo: com ele é possível enviar mensagens e administrar a
WABA. Chame esta rota só do seu backend, com a API key secreta, e não registre o
token em logs. Cada leitura é auditada.Para trocar o token guardado (rotação), use
Atualizar conexão com o campo
accessToken.