Tudásbázis / Knowledge base

API tokenek: számlázás programból API tokens: invoicing from code

Utolsó frissítés: Last updated:

A BillingHUNter publikus REST API-jával a saját rendszeredből állíthatsz ki számlát és díjbekérőt, kérdezheted le a partnereket és az MNB-árfolyamokat. Ez a cikk a személyes API-tokenek (PAT) létrehozását, a jogosultsági szinteket és a biztonsági szabályokat járja végig. With BillingHUNter's public REST API you can issue invoices and proformas, list partners and fetch MNB exchange rates from your own system. This guide covers creating personal access tokens (PATs), permission levels and security rules.

Vissza a tudásbázisra Back to knowledge base

Mi az API-token? What is an API token?

A személyes API-token (bhu_... előtagú kulcs) egy hosszú életű hitelesítő adat, amellyel a saját alkalmazásod — webshop, rendeléskezelő, ügyviteli rendszer — felhasználói bejelentkezés nélkül hívhatja a BillingHUNter REST API-ját. Minden token egy szervezethez tartozik, és a tokennel végzett műveletekre ugyanazok a szabályok vonatkoznak, mintha a felületen dolgoznál. A personal access token (a bhu_...-prefixed key) is a long-lived credential that lets your own application — webshop, order system, ERP — call the BillingHUNter REST API without an interactive login. Every token belongs to one organisation, and operations performed with it follow the same rules as actions on the UI.

  • Előfeltétel: aktív fizetős csomag (CUB próba, SOLO vagy HUNTER). A díjmentes BASIC csomaggal az API nem érhető el. Requirement: an active paid plan (CUB trial, SOLO or HUNTER). The API is not available on the free BASIC plan.
  • Szervezeti hatókör: a token egy szervezethez kötődik — azzal a tokennel más szervezet adatai nem érhetők el, még akkor sem, ha a felhasználó több szervezet tagja. Organisation scope: a token is bound to one organisation — it cannot reach another organisation's data, even if the user is a member of several.

Token létrehozása Creating a token

  1. Jelentkezz be, és nyisd meg az API tokenek oldalt az alkalmazás menüjéből. Log in and open the API tokens page from the application menu.
  2. Válaszd ki a szervezetet, adj nevet a tokennek (pl. „webshop"), állíts be lejárati dátumot, és válaszd ki a jogosultsági szintet. Pick the organisation, name the token (e.g. “webshop”), set an expiry date and choose the permission level.
  3. Másold ki a tokent azonnal — a bhu_... kulcs csak egyszer, létrehozáskor jelenik meg. Mi csak a hashelt lenyomatát tároljuk, így később nem tudjuk megmutatni. Copy the token immediately — the bhu_... key is shown exactly once, at creation. We only store its hashed fingerprint, so we cannot show it again.

Jogosultsági szintek Permission levels

  • VIEWER — csak olvasás: számlák, díjbekérők és partnerek lekérdezése, PDF letöltés, MNB-árfolyamok. Író műveletet (számlakiállítás, küldés, sztornó) a VIEWER token nem végezhet — a kérés elutasításra kerül. VIEWER — read only: fetch invoices, proformas and partners, download PDFs, query MNB exchange rates. A VIEWER token cannot perform write operations (issuing, sending, cancelling) — such requests are rejected.
  • CONTRIBUTOR — írás-olvasás: a VIEWER jogok mellett számla- és díjbekérő-kiállítás, küldés, sztornó, díjbekérő számlává konvertálása. CONTRIBUTOR — read-write: everything VIEWER can do, plus issuing invoices and proformas, sending them, cancelling, and converting a proforma into an invoice.

A tokennel végzett műveletek ugyanabba a számlakeretbe számítanak bele, mint a felületen kiállítottak — az API nem jelent plusz keretet. Invoices issued with a token count towards the same invoice quota as the UI — the API grants no extra allowance.

Végpontok Endpoints

Az API alapcíme: https://api.codehunters.hu/invoices/v1/api-billinghunter. Minden kérésnél a tokent a szokásos Bearer fejlécben küldd: Authorization: Bearer bhu_... API base URL: https://api.codehunters.hu/invoices/v1/api-billinghunter. Send the token on every request in the usual Bearer header: Authorization: Bearer bhu_...

A teljes, naprakész végpontlista és a sémák az interaktív API-dokumentációban olvashatók: api.codehunters.hu/swagger-ui — válaszd a „BillingHUNter Public API” csoportot. The complete, up-to-date endpoint list and schemas live in the interactive API documentation: api.codehunters.hu/swagger-ui — pick the “BillingHUNter Public API” group.

  • Számlák: POST /invoices kiállítás, GET /invoices/{id} lekérdezés, GET /invoices/{id}/pdf PDF, POST /invoices/{id}/send e-mail küldés, POST /invoices/{id}/cancel sztornó. Invoices: POST /invoices issue, GET /invoices/{id} fetch, GET /invoices/{id}/pdf PDF, POST /invoices/{id}/send e-mail it, POST /invoices/{id}/cancel storno.
  • Díjbekérők: POST /proforma-invoices, GET /proforma-invoices/{id}, GET /proforma-invoices/{id}/pdf, POST /proforma-invoices/{id}/send, POST /proforma-invoices/{id}/convert — a kifizetett díjbekérőből valódi számla. Proformas: POST /proforma-invoices, GET /proforma-invoices/{id}, GET /proforma-invoices/{id}/pdf, POST /proforma-invoices/{id}/send, POST /proforma-invoices/{id}/convert — turns a paid proforma into a real invoice.
  • Partnerek: GET /partners, GET /partners/{id}. Partners: GET /partners, GET /partners/{id}.
  • Szervezet és árfolyamok: GET /organisations/{taxNumber} (adószám alapján cégadat-lekérdezés), GET /exchange-rates (MNB-árfolyamok). Organisation and rates: GET /organisations/{taxNumber} (company lookup by tax number), GET /exchange-rates (MNB exchange rates).

A részletes kérés-válasz sémákat a Swagger felületen találod: BillingHUNter Public API néven szerepel a rendszer OpenAPI dokumentációjában. The full request/response schemas are on the Swagger UI as the BillingHUNter Public API entry in the system's OpenAPI documentation.

Biztonság Security

  • A nyers token csak egyszer látható — a rendszerben kizárólag hashelve tároljuk (SHA-256), a naplókba sem kerül be. The raw token is shown only once — we store it exclusively as a hash (SHA-256), and it never reaches the logs.
  • A token bármikor visszavonható az API tokenek oldalon — a visszavonás azonnal érvényes. A lejárt vagy visszavont token automatikusan elutasításra kerül. A token can be revoked any time on the API tokens page — revocation takes effect immediately. Expired or revoked tokens are automatically rejected.
  • Ha a token kiszivároghatott, azonnal vond vissza, és hozz létre újat — a tokennel végzett műveletek a fiókodat terhelik. If a token may have leaked, revoke it at once and create a new one — operations performed with a token are attributable to your account.
  • Az API-hívásokra is érvényes az IP-alapú kéréskorlátozás (rate limiting), és minden API-művelet a szokásos hibanaplóba kerül. IP-based rate limiting applies to API calls as well, and every API operation is logged in the usual error log.