Consultar comando assíncrono
curl --request GET \
--url https://api.d-api.cloud/api/v1/commands/{commandId} \
--header 'Authorization: <api-key>'import requests
url = "https://api.d-api.cloud/api/v1/commands/{commandId}"
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/commands/{commandId}', 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/commands/{commandId}",
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/commands/{commandId}"
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/commands/{commandId}")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.d-api.cloud/api/v1/commands/{commandId}")
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_bodyGuias
Consultar comando assíncrono
Acompanhe o resultado de um comando enviado com async.
GET
/
api
/
v1
/
commands
/
{commandId}
Consultar comando assíncrono
curl --request GET \
--url https://api.d-api.cloud/api/v1/commands/{commandId} \
--header 'Authorization: <api-key>'import requests
url = "https://api.d-api.cloud/api/v1/commands/{commandId}"
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/commands/{commandId}', 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/commands/{commandId}",
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/commands/{commandId}"
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/commands/{commandId}")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.d-api.cloud/api/v1/commands/{commandId}")
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_bodyQuando você envia um comando com
O campo
async: true, a API responde na hora com um
commandId e executa o comando em segundo plano. Este endpoint diz o que
aconteceu com ele.
{
"success": true,
"commandId": "9f1c8f2e-4b7a-4f10-9c3d-2e1a8b5d7c40",
"sessionId": "minha-sessao",
"commandType": "send_text",
"status": "completed",
"result": {
"commandId": "9f1c8f2e-4b7a-4f10-9c3d-2e1a8b5d7c40",
"sessionId": "minha-sessao",
"commandType": "send_text",
"success": true,
"data": { "messageId": "3EB0C767D26B8CA3F7A1" },
"error": null,
"timestamp": "2026-09-03T04:15:22.318Z"
},
"error": null,
"queuedAt": "2026-09-03T04:15:21.902Z",
"startedAt": "2026-09-03T04:15:22.104Z",
"finishedAt": "2026-09-03T04:15:22.318Z"
}
Status
status | Significado |
|---|---|
queued | Na fila, ainda não começou |
processing | Executando agora |
completed | Executou — veja result.success |
failed | O worker falhou antes de concluir; o motivo vem em error |
status não é o sucesso do comando. Um comando que rodou e falhou (número
inválido, sessão desconectada) fica completed com result.success: false e
o motivo em result.error. O status: "failed" cobre só a falha do worker.result traz o mesmo payload do webhook command.result e só é
preenchido quando o comando termina. Antes disso ele vem null.
Escopo e retenção
Você só enxerga comandos das suas próprias sessões. Uma API Key restrita a uma sessão consulta apenas os comandos daquela sessão. Comando de terceiros responde404, igual a um commandId inexistente.
O resultado fica disponível por uma janela limitada — cerca de 1 hora após a
execução (24 horas em caso de falha do worker). Passado esse prazo a resposta
é
404. Para entrega garantida, use o webhook command.result em vez de
polling.