List dispatches
curl --request GET \
--url https://needalert.app/api/v1/establishments/{establishment}/events \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://needalert.app/api/v1/establishments/{establishment}/events', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://needalert.app/api/v1/establishments/{establishment}/events"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://needalert.app/api/v1/establishments/{establishment}/events",
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: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"data": [
{
"id": 123,
"item": {
"id": 123,
"public_code": "<string>",
"name": "<string>"
},
"title": "<string>",
"message": "<string>",
"status": "pending",
"scheduled_at": "<string>",
"dispatched_at": "<string>",
"recipients_count": 123,
"credits_cost": 123,
"sent_count": 123,
"failed_count": 123,
"failure_reason": "processing_error",
"estimated_credits_cost": 123,
"warning_sent_at": "<string>",
"cancelled_at": "<string>",
"cancelled_by": {
"id": 123,
"name": "<string>"
},
"cancelled_by_api_client": {
"id": 123,
"name": "<string>"
},
"created_by": {
"id": 123,
"name": "<string>"
},
"created_by_api_client": {
"id": 123,
"name": "<string>"
},
"created_at": "<string>",
"notifications": {}
}
],
"links": {
"first": "<string>",
"last": "<string>",
"prev": "<string>",
"next": "<string>"
},
"meta": {
"current_page": 2,
"from": 2,
"last_page": 2,
"links": [
{
"url": "<string>",
"label": "<string>",
"active": true
}
],
"path": "<string>",
"per_page": 1,
"to": 2,
"total": 1
}
}{
"message": "<string>",
"code": "unauthenticated",
"errors": {}
}{
"message": "<string>",
"code": "establishment_unavailable",
"errors": {}
}{
"message": "<string>",
"code": "not_found",
"errors": {}
}{
"message": "<string>",
"code": "validation_failed",
"errors": {}
}{
"message": "<string>",
"code": "too_many_requests",
"errors": {}
}Dispatches
List dispatches
The unit’s alerts, newest first, paginated. Filter by item_id and status.
GET
/
establishments
/
{establishment}
/
events
List dispatches
curl --request GET \
--url https://needalert.app/api/v1/establishments/{establishment}/events \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://needalert.app/api/v1/establishments/{establishment}/events', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://needalert.app/api/v1/establishments/{establishment}/events"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://needalert.app/api/v1/establishments/{establishment}/events",
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: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"data": [
{
"id": 123,
"item": {
"id": 123,
"public_code": "<string>",
"name": "<string>"
},
"title": "<string>",
"message": "<string>",
"status": "pending",
"scheduled_at": "<string>",
"dispatched_at": "<string>",
"recipients_count": 123,
"credits_cost": 123,
"sent_count": 123,
"failed_count": 123,
"failure_reason": "processing_error",
"estimated_credits_cost": 123,
"warning_sent_at": "<string>",
"cancelled_at": "<string>",
"cancelled_by": {
"id": 123,
"name": "<string>"
},
"cancelled_by_api_client": {
"id": 123,
"name": "<string>"
},
"created_by": {
"id": 123,
"name": "<string>"
},
"created_by_api_client": {
"id": 123,
"name": "<string>"
},
"created_at": "<string>",
"notifications": {}
}
],
"links": {
"first": "<string>",
"last": "<string>",
"prev": "<string>",
"next": "<string>"
},
"meta": {
"current_page": 2,
"from": 2,
"last_page": 2,
"links": [
{
"url": "<string>",
"label": "<string>",
"active": true
}
],
"path": "<string>",
"per_page": 1,
"to": 2,
"total": 1
}
}{
"message": "<string>",
"code": "unauthenticated",
"errors": {}
}{
"message": "<string>",
"code": "establishment_unavailable",
"errors": {}
}{
"message": "<string>",
"code": "not_found",
"errors": {}
}{
"message": "<string>",
"code": "validation_failed",
"errors": {}
}{
"message": "<string>",
"code": "too_many_requests",
"errors": {}
}Autorizações
An API key created by the chain owner in the panel (Integrações → Nova chave), sent as Authorization: Bearer <key>. The key (<id>|na_…) is shown once, at creation; rotate or revoke it on the same screen. It is a server secret: never ship it in browser or mobile code.
Cabeçalhos
Language of message and of translated content such as item names (pt-BR or en). Without it, the chain's default language.
Opções disponíveis:
pt-BR, en Your own correlation id (1–64 characters of A-Za-z0-9._-), echoed back; generated when absent. Quote it to support.
Required string length:
1 - 64Pattern:
^[A-Za-z0-9._-]{1,64}$Parâmetros de caminho
The establishment ID
Parâmetros de consulta
pending Queued to be sent now. |
processing Being sent. |
dispatched Sent; see sent_count and failed_count. |
failed Not sent; see failure_reason. |
cancelled Cancelled while scheduled. |
scheduled Waiting for scheduled_at. |
Opções disponíveis:
pending, processing, dispatched, failed, cancelled, scheduled Intervalo obrigatório:
1 <= x <= 100Page number.