List credit transactions
curl --request GET \
--url https://needalert.app/api/v1/tenants/{tenant}/credit-transactions \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://needalert.app/api/v1/tenants/{tenant}/credit-transactions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://needalert.app/api/v1/tenants/{tenant}/credit-transactions"
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/tenants/{tenant}/credit-transactions",
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,
"type": "consumption",
"amount": 123,
"balance_after": 123,
"description": "<string>",
"event_id": 123,
"reference_type": "<string>",
"reference_id": 123,
"created_by": {
"id": 123,
"name": "<string>"
},
"created_by_api_client": {
"id": 123,
"name": "<string>"
},
"created_at": "<string>"
}
],
"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": "forbidden",
"errors": {}
}{
"message": "<string>",
"code": "not_found",
"errors": {}
}{
"message": "<string>",
"code": "validation_failed",
"errors": {}
}{
"message": "<string>",
"code": "too_many_requests",
"errors": {}
}Credits
List credit transactions
The chain’s statement, newest first, paginated: purchases, bonuses, adjustments, refunds and the consumption of each dispatch. Filter by type and by from/to (ISO 8601 datetimes, inclusive). Needs manage_billing.
GET
/
tenants
/
{tenant}
/
credit-transactions
List credit transactions
curl --request GET \
--url https://needalert.app/api/v1/tenants/{tenant}/credit-transactions \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://needalert.app/api/v1/tenants/{tenant}/credit-transactions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://needalert.app/api/v1/tenants/{tenant}/credit-transactions"
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/tenants/{tenant}/credit-transactions",
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,
"type": "consumption",
"amount": 123,
"balance_after": 123,
"description": "<string>",
"event_id": 123,
"reference_type": "<string>",
"reference_id": 123,
"created_by": {
"id": 123,
"name": "<string>"
},
"created_by_api_client": {
"id": 123,
"name": "<string>"
},
"created_at": "<string>"
}
],
"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": "forbidden",
"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 tenant ID
Parâmetros de consulta
consumption Debit of a sent alert. |
refund Credits returned after a refunded purchase. |
manual_adjustment Adjustment made by the platform. |
bonus Welcome or promotional credits. |
purchase Credits bought. |
refund_reversal A refund that was reversed. |
Opções disponíveis:
consumption, refund, manual_adjustment, bonus, purchase, refund_reversal Intervalo obrigatório:
1 <= x <= 100Page number.