/v1/account
account
Account: saldo, consumo, abbonamento a crediti e chiavi API tramite l’API.
Con gli endpoint account il tuo programma legge saldo, consumo e abbonamento a crediti e gestisce le chiavi API. Così costruisci report propri e avvisi per un saldo basso.
Costi e limiti
| Cosa | Crediti |
|---|---|
| Leggere account, saldo, consumo e abbonamento a crediti | gratis |
Limite: 30 richieste al minuto. Creare, modificare ed eliminare: 10 al minuto.
Tutti gli endpoint account sono gratuiti. Ogni risposta mostra il tuo saldo attuale in meta.credits_remaining.
Qui invia sempre la chiave API nell’header x-api-key. Come parametro api_key nell’URL l’API la rifiuta con 400. Un bearer token richiede l’abilitazione account:read.
Endpoint
| Metodo | Percorso | Scopo | Accesso |
|---|---|---|---|
| GET |
/v1/account |
Il tuo account. | Chiave API |
| GET |
/v1/account/credits |
Saldo e date di scadenza. | Chiave API |
| GET |
/v1/account/usage |
Consumo in un periodo, sommato. | Chiave API |
| GET |
/v1/account/usage/transactions |
Singole richieste con i costi. | Chiave API |
| GET |
/v1/account/subscription |
Il tuo abbonamento a crediti. | Chiave API |
| GET |
/v1/account/api-keys |
Le tue chiavi API. | Chiave API |
| POST |
/v1/account/api-keys |
Nuova chiave API. | Admin token |
| DELETE |
/v1/account/api-keys/{id} |
Eliminare una chiave API. | Admin token |
| POST |
/v1/auth/tokens/create |
Creare un bearer token. | Chiave API |
| GET · DELETE |
/v1/auth/tokens |
Elencare e revocare bearer token. | Chiave API |
Account
GET /v1/account restituisce nome, indirizzo email, lingua e, in plan, il tuo abbonamento a crediti, come pro o max. Senza abbonamento a crediti, plan è null.
curl -G "https://handelsregister.ai/api/v1/account" \ -H "x-api-key: LA_TUA_CHIAVE_API"
import requests response = requests.get( "https://handelsregister.ai/api/v1/account", headers={"x-api-key": "LA_TUA_CHIAVE_API"}, ) data = response.json()
const url = new URL("https://handelsregister.ai/api/v1/account"); const response = await fetch(url, { headers: { "x-api-key": "LA_TUA_CHIAVE_API" }, }); const data = await response.json();
1{2 "account": {3 "id": 2,4 "name": "Max Mustermann",5 "email": "[email protected]",6 "email_verified": true,7 "language": "de",8 "plan": "max",9 "member_since": "2026-09-02T17:07:10+00:00"10 },11 "meta": {12 "request_credit_cost": 0,13 "credits_remaining": 14514 }15}
Saldo
GET /v1/account/credits mostra il tuo saldo e quando scadono i crediti.
curl -G "https://handelsregister.ai/api/v1/account/credits" \ -H "x-api-key: LA_TUA_CHIAVE_API"
import requests response = requests.get( "https://handelsregister.ai/api/v1/account/credits", headers={"x-api-key": "LA_TUA_CHIAVE_API"}, ) data = response.json()
const url = new URL("https://handelsregister.ai/api/v1/account/credits"); const response = await fetch(url, { headers: { "x-api-key": "LA_TUA_CHIAVE_API" }, }); const data = await response.json();
| Campo | Significato |
|---|---|
| balance.total | Il tuo saldo totale. |
| balance.subscription |
Crediti dall’abbonamento a crediti, compresi quelli riportati in un cambio di piano (rollover).
|
| balance.purchased | Crediti di ricarica e crediti iniziali. |
| next_expiry |
I prossimi crediti in scadenza, con amount e expires_at. null se non scade nulla.
|
| breakdown |
Ogni accredito con il suo importo residuo amount, origine source e data di scadenza valid_until. source è subscription, rollover, purchase o registration.
|
1{2 "balance": {3 "total": 145,4 "subscription": 0,5 "purchased": 1456 },7 "next_expiry": null,8 "meta": {9 "request_credit_cost": 0,10 "credits_remaining": 14511 }12}
balance.total. Non costa nulla.
Consumo
GET /v1/account/usage somma richieste e crediti consumati in un periodo, per endpoint e per giorno o mese. Contano anche le richieste dalla web app e da Monitoring.
curl -G "https://handelsregister.ai/api/v1/account/usage" \ -H "x-api-key: LA_TUA_CHIAVE_API" \ --data-urlencode 'from=2026-11-01' \ --data-urlencode 'group_by=day'
import requests response = requests.get( "https://handelsregister.ai/api/v1/account/usage", headers={"x-api-key": "LA_TUA_CHIAVE_API"}, params={ "from": "2026-11-01", "group_by": "day", }, ) data = response.json()
const url = new URL("https://handelsregister.ai/api/v1/account/usage"); url.searchParams.append("from", "2026-11-01"); url.searchParams.append("group_by", "day"); const response = await fetch(url, { headers: { "x-api-key": "LA_TUA_CHIAVE_API" }, }); const data = await response.json();
| Nome | Tipo | Descrizione | Esempio |
|---|---|---|---|
| fromQuery | stringafacoltativo |
Inizio come YYYY-MM-DD o ISO 8601. Se omesso: inizio del mese. |
2026-11-01 |
| toQuery | stringafacoltativo | Fine, inclusa. Una data semplice vale fino alla fine del giorno. Se omesso: adesso. | – |
| group_byQuery | stringafacoltativo |
Se omesso, l’API raggruppa i periodi fino a 92 giorni per giorno, quelli più lunghi per mese.Valori: day, month |
day |
Un periodo copre al massimo 366 giorni.
totals contiene le somme, by_endpoint la suddivisione, ordinata per crediti. series.buckets contiene ogni giorno o mese, anche quelli senza consumo.
1{2 "period": {3 "from": "2026-11-01T00:00:00+00:00",4 "to": "2026-11-01T07:54:44+00:00"5 },6 "totals": {7 "requests": 80,8 "credits_used": 3209 },10 "by_endpoint": [11 {12 "endpoint": "/api/v1/signals",13 "requests": 7,14 "credits_used": 14015 },16 {17 "endpoint": "/api/v1/fetch-organization",18 "requests": 25,19 "credits_used": 12020 },21 {22 "endpoint": "/api/v1/search-companies",23 "requests": 47,24 "credits_used": 4025 },26 {27 "endpoint": "/api/v1/signals/e23c12835d697c00512944ebdfb8260f",28 "requests": 1,29 "credits_used": 2030 }31 ],32 "series": {33 "group_by": "day",34 "buckets": [35 {36 "date": "2026-11-01",37 "requests": 80,38 "credits_used": 32039 }40 ]41 },42 "meta": {43 "request_credit_cost": 0,44 "credits_remaining": 14545 }46}
Singole richieste
GET /v1/account/usage/transactions elenca ogni richiesta addebitata con endpoint, crediti, parametri della richiesta e orario, la più recente per prima.
curl -G "https://handelsregister.ai/api/v1/account/usage/transactions" \ -H "x-api-key: LA_TUA_CHIAVE_API" \ --data-urlencode 'per_page=3'
import requests response = requests.get( "https://handelsregister.ai/api/v1/account/usage/transactions", headers={"x-api-key": "LA_TUA_CHIAVE_API"}, params={ "per_page": "3", }, ) data = response.json()
const url = new URL("https://handelsregister.ai/api/v1/account/usage/transactions"); url.searchParams.append("per_page", "3"); const response = await fetch(url, { headers: { "x-api-key": "LA_TUA_CHIAVE_API" }, }); const data = await response.json();
| Nome | Tipo | Descrizione | Esempio |
|---|---|---|---|
| fromQuery | stringafacoltativo |
Inizio come YYYY-MM-DD o ISO 8601. Se omesso: inizio del mese. |
– |
| toQuery | stringafacoltativo | Fine, inclusa. Una data semplice vale fino alla fine del giorno. Se omesso: adesso. | – |
| endpointQuery | stringafacoltativo |
Solo richieste con esattamente questa etichetta, come compare in endpoint. |
– |
| per_pageQuery | interofacoltativo |
Voci per pagina. L’API riduce i valori più grandi a 100.Predefinito: 25Limiti: almeno 1 |
3 |
| cursorQuery | stringafacoltativo |
Il valore pagination.next_cursor della pagina precedente, per la pagina successiva. |
– |
api_key_id indica la chiave API con cui è stata eseguita la richiesta. Così assegni i costi alle singole integrazioni. Per le richieste dalla web app è null.
Se next_cursor è null, sei arrivato alla fine.
1{2 "transactions": [3 {4 "id": 1116,5 "endpoint": "/api/v1/search-companies",6 "credits": 1,7 "parameters": {8 "q": "",9 "ai_search": false,10 "filters": {11 "postal_code": "91710",12 "active": true13 },14 "sort": null,15 "order": null,16 "status": 200,17 "search_type": "standard"18 },19 "created_at": "2026-11-01T07:55:02+00:00",20 "api_key_id": 1021 },22 {23 "id": 1115,24 "endpoint": "/api/v1/search-companies",25 "credits": 1,26 "parameters": {27 "q": "",28 "ai_search": false,29 "filters": {30 "postal_code": "91710",31 "active": true32 },33 "sort": null,34 "order": null,35 "status": 200,36 "search_type": "standard"37 },38 "created_at": "2026-11-01T07:55:01+00:00",39 "api_key_id": 1040 },41 {42 "id": 1114,43 "endpoint": "/api/v1/search-companies",44 "credits": 1,45 "parameters": {46 "q": "",47 "ai_search": false,48 "filters": {49 "industry_code": "62.1"50 },51 "sort": null,52 "order": null,53 "status": 200,54 "search_type": "standard"55 },56 "created_at": "2026-11-01T07:55:00+00:00",57 "api_key_id": 1058 }59 ],60 "pagination": {61 "per_page": 3,62 "next_cursor": "eyJjcmVhdGVkX2F0IjoiMjAyNi0xMS0wMSAwNzo1NTowMCIsImlkIjoxMTE0LCJfcG9pbnRzVG9OZXh0SXRlbXMiOnRydWV9"63 },64 "period": {65 "from": "2026-11-01T00:00:00+00:00",66 "to": "2026-11-01T07:55:02+00:00"67 },68 "meta": {69 "request_credit_cost": 0,70 "credits_remaining": 14571 }72}
Abbonamento a crediti
GET /v1/account/subscription mostra il tuo abbonamento a crediti con piano, stato, periodo di fatturazione e funzioni. Senza abbonamento a crediti, subscription è null.
cancel_at_period_end è true se l’abbonamento a crediti termina alla fine del periodo. features contiene i crediti al mese e il bonus sui crediti di ricarica in percentuale.
curl -G "https://handelsregister.ai/api/v1/account/subscription" \ -H "x-api-key: LA_TUA_CHIAVE_API"
import requests response = requests.get( "https://handelsregister.ai/api/v1/account/subscription", headers={"x-api-key": "LA_TUA_CHIAVE_API"}, ) data = response.json()
const url = new URL("https://handelsregister.ai/api/v1/account/subscription"); const response = await fetch(url, { headers: { "x-api-key": "LA_TUA_CHIAVE_API" }, }); const data = await response.json();
1{2 "subscription": {3 "plan": "max",4 "status": "active",5 "billing_interval": "month",6 "cancel_at_period_end": false,7 "current_period_start": "2026-10-26T21:51:51+00:00",8 "current_period_end": "2026-11-26T21:51:51+00:00",9 "trial_ends_at": null,10 "canceled_at": null,11 "features": {12 "credits_per_month": 75000,13 "bonus_percentage": 15,14 "non_expiring_credits": true,15 "support_level": "priority"16 }17 },18 "meta": {19 "request_credit_cost": 0,20 "credits_remaining": 14521 }22}
Gestire le chiavi API
GET /v1/account/api-keys elenca le tue chiavi API, la più recente per prima. La lista non mostra mai chiavi intere, solo gli ultimi otto caratteri.
is_current contrassegna la chiave con cui stai facendo questa richiesta. usage_last_30d mostra il suo consumo negli ultimi 30 giorni.
curl -G "https://handelsregister.ai/api/v1/account/api-keys" \ -H "x-api-key: LA_TUA_CHIAVE_API"
import requests response = requests.get( "https://handelsregister.ai/api/v1/account/api-keys", headers={"x-api-key": "LA_TUA_CHIAVE_API"}, ) data = response.json()
const url = new URL("https://handelsregister.ai/api/v1/account/api-keys"); const response = await fetch(url, { headers: { "x-api-key": "LA_TUA_CHIAVE_API" }, }); const data = await response.json();
1{2 "api_keys": [3 {4 "id": 10,5 "key_last_8": "Ab12Cd34",6 "is_current": true,7 "created_at": "2026-11-01T04:17:31+00:00",8 "last_used_at": "2026-11-01T07:55:12+00:00",9 "usage_last_30d": {10 "requests": 97,11 "credits_used": 41112 }13 }14 ],15 "total": 1,16 "meta": {17 "request_credit_cost": 0,18 "credits_remaining": 14519 }20}
Creare ed eliminare funziona solo con l’admin token, non con una chiave API. Lo crei in Account › Chiavi API nella sezione “Per sviluppatori: gestire le chiavi tramite API”. Vale un anno e uno nuovo sostituisce quello vecchio.
POST /v1/account/api-keys crea una chiave. La risposta la contiene per intero, solo questa volta. Possono essere attive contemporaneamente fino a 25 chiavi.
curl -X POST "https://handelsregister.ai/api/v1/account/api-keys" \ -H "Authorization: Bearer IL_TUO_ADMIN_TOKEN"
import requests response = requests.post( "https://handelsregister.ai/api/v1/account/api-keys", headers={"Authorization": "Bearer IL_TUO_ADMIN_TOKEN"}, ) data = response.json()
const response = await fetch("https://handelsregister.ai/api/v1/account/api-keys", { method: "POST", headers: { "Authorization": "Bearer IL_TUO_ADMIN_TOKEN", }, }); const data = await response.json();
1{2 "api_key": {3 "id": 13,4 "key": "…",5 "created_at": "2026-11-01T08:32:00+00:00"6 },7 "meta": {8 "message": "Store this key securely. It grants full data access to this account.",9 "request_credit_cost": 0,10 "credits_remaining": 14511 }12}
DELETE /v1/account/api-keys/{id} elimina subito una chiave. Da quel momento l’API rifiuta le richieste con essa.
Bearer token
Invece della chiave API, un programma può autenticarsi anche con un bearer token. I token li gestisci sotto /v1/auth/tokens, con la tua chiave API nell’header x-api-key.
POST /v1/auth/tokens/create crea un token. È nella risposta in token, solo questa volta.
curl -X POST "https://handelsregister.ai/api/v1/auth/tokens/create" \ -H "x-api-key: LA_TUA_CHIAVE_API" \ -H "Content-Type: application/json" \ -d '{ "token_name": "CRM-Sync", "abilities": [ "api:data", "account:read" ] }'
import requests response = requests.post( "https://handelsregister.ai/api/v1/auth/tokens/create", headers={"x-api-key": "LA_TUA_CHIAVE_API"}, json={ "token_name": "CRM-Sync", "abilities": [ "api:data", "account:read" ] }, ) data = response.json()
const response = await fetch("https://handelsregister.ai/api/v1/auth/tokens/create", { method: "POST", headers: { "x-api-key": "LA_TUA_CHIAVE_API", "Content-Type": "application/json", }, body: JSON.stringify({ "token_name": "CRM-Sync", "abilities": [ "api:data", "account:read" ] }), }); const data = await response.json();
| Nome | Tipo | Descrizione | Esempio |
|---|---|---|---|
| token_nameBody | stringaobbligatorio | Un nome con cui riconosci il token, come il nome della tua applicazione.Limiti: al massimo 255 caratteri |
CRM-Sync |
| abilitiesBody | lista di stringfacoltativo |
Le abilitazioni come lista. Se omesso, il token riceve api:data per gli endpoint dati e account:read per gli endpoint account. monitoring:manage consente modifiche ai monitor.Predefinito: ["*"] |
["api:data","account:read"] |
| expires_atBody | stringa (date-time)facoltativo | Data di scadenza nel futuro. Se omessa, il token vale finché non lo revochi. | – |
1{2 "token": "…",3 "name": "CRM-Sync",4 "abilities": [5 "api:data",6 "account:read"7 ],8 "expires_at": null,9 "created_at": "2026-11-01T08:31:26.000000Z",10 "meta": {11 "message": "Token created successfully. Store this token securely as it will not be shown again.",12 "credits_remaining": 14513 }14}
Solo l’admin token ha l’abilitazione account:keys per chiavi API e secret di firma. Non può essere concessa tramite l’API.
GET /v1/auth/tokens elenca tutti i token del tuo account con nome, abilitazioni e ultimo utilizzo, admin token compreso.
DELETE /v1/auth/tokens/{id} revoca un token.
DELETE /v1/auth/tokens revoca tutti i token in una volta, admin token compreso. Dopo ti serve un nuovo admin token per gestire le chiavi.
Errori
Gli errori hanno la struttura {"error": "…", "meta": {"message": "…"}}. Gli errori non costano nulla.
| Stato | Causa | Cosa puoi fare |
|---|---|---|
| 400 |
api_key è nell’URL. |
Invia la chiave nell’header x-api-key. |
| 400 |
Un parametro non è valido, come una data, group_by o un periodo troppo lungo. |
Correggi il valore come descrive meta.message. |
| 401 | Nessuna chiave API o token, o uno non valido. |
Invia la chiave nell’header x-api-key. |
| 401 |
Nessuna chiave API, o una non valida. Un bearer token non funziona sotto /v1/auth. |
Invia la chiave API nell’header x-api-key. |
| 403 |
Al bearer token manca l’abilitazione account:read. |
Usa la chiave API o un token con account:read. |
| 403 | L’indirizzo email del tuo account non è ancora confermato, oppure l’account è bloccato. | Apri il link dall’email di conferma. Se l’account è bloccato, il supporto può aiutarti. |
| 403 | Questa chiamata richiede l’admin token. Una chiave API non basta, e nemmeno un altro token. |
Invialo con Authorization: Bearer e l’admin token. |
| 404 | Nessuna chiave o token con questo ID. | Prendi l’ID dalla lista. |
| 422 |
È stato raggiunto il numero massimo di chiavi API (too_many_keys). |
Elimina una chiave vecchia. |
| 429 | Troppe richieste. |
Riprova dopo Retry-After. |
| 500 |
Un valore non è valido: token_name manca o è troppo lungo, abilities non è una lista oppure expires_at non è nel futuro. |
Correggi i valori. Con Accept: application/json l’errore arriva come JSON. |
1{2 "error": "invalid_request",3 "meta": {4 "message": "'group_by' must be one of: day, month.",5 "request_credit_cost": 0,6 "credits_remaining": 1457 }8}