# Računi AI API — complete documentation for AI agents > Invoicing, payment slips, email delivery, card payment links and webhooks for Slovenian and Croatian issuers. REST API at https://app.racuni-ai.si/v1, MCP at https://app.racuni-ai.si/mcp, OpenAPI at https://app.racuni-ai.si/openapi.json. ## Quickstart {#quickstart} Računi AI is an API that issues **Slovenian (SI) and Croatian (HR) invoices** for your app: a legally formatted PDF, a payment slip (UPN QR in SI, HUB-3 PDF417 barcode in HR), email delivery with delivered/opened tracking, an optional card payment link (Stripe, money goes to the issuer), and webhooks. Base URL: `https://app.racuni-ai.si/v1`. 1. **Get a test key** (no browser needed): ```bash curl -X POST https://app.racuni-ai.si/v1/accounts -H "Content-Type: application/json" \ -d '{"email":"you@example.com","name":"My Club App"}' # → { "test_secret_key": "rk_test_…", ... } (shown once — store it server side) ``` 2. **Create the issuer** (the company or club that issues invoices) once: ```bash curl https://app.racuni-ai.si/v1/issuers -H "Authorization: Bearer $RACUNI_API_KEY" -H "Content-Type: application/json" -d '{ "country": "SI", "name": "ŠD Primer", "tax_id": "15012557", "address_line": "Športna ulica 5", "postal_code": "2000", "city": "Maribor", "iban": "SI56 1910 0000 0123 438", "email": "info@sdprimer.si", "vat_registered": false, "subject_to_fiscalization": false }' ``` 3. **Create and send an invoice** in one call: ```bash curl https://app.racuni-ai.si/v1/invoices -H "Authorization: Bearer $RACUNI_API_KEY" -H "Content-Type: application/json" \ -H "Idempotency-Key: member-42-2026-12" -d '{ "customer": { "name": "Janez Novak", "email": "janez@example.com", "address_line": "Slovenska cesta 1", "postal_code": "1000", "city": "Ljubljana" }, "items": [ { "description": "Članarina december 2026", "unit_price": 45 } ], "service_period": { "start": "2026-12-01", "end": "2026-12-31" }, "metadata": { "member_id": "42" }, "payment_link": true, "send": true }' ``` The response is the invoice: `number` ("TEST-2026-0001" in test mode), `total`, `pdf_url`, `hosted_url` (public page with PDF + pay button you can show in your app), `payment.pay_url`, `delivery_status`. 4. **Listen for webhooks** (`invoice.delivered`, `invoice.opened`, `invoice.paid`, …) — see Webhooks. Rules of thumb for AI agents writing an integration: - Call the API **only from server-side code**; keep the key in an environment variable (`RACUNI_API_KEY`). - Always send an `Idempotency-Key` on POST (e.g. `-`) so retries never double-invoice. - Send the recipient **inline** as `customer` on every invoice — Računi keeps no customer directory; your app owns its members. Put your own ids in `metadata` (e.g. `member_id`, `tenant_id`): opaque ids only, no personal data. - Building one app for many clubs? Create **one issuer per club** — see Building an app. - Money is **decimal EUR** in requests (`45.5`), never cents. Responses have both `total` and `total_cents`. - In test mode (`rk_test_`) nothing reaches real people and nothing is charged. Switch to `rk_live_` only when the user says so. ## Authentication and modes {#authentication} Send `Authorization: Bearer ` on every request. Keys: - `rk_test_…` — **test mode**: free, separate data, emails simulated (see Test mode). - `rk_live_…` — **live mode**: real invoices, real emails, uses prepaid credit. Test and live data are fully separate: an invoice created with a test key does not exist for a live key. Issuers are shared configuration and visible to both. Live keys are created in the dashboard (https://app.racuni-ai.si/dashboard) after the owner confirmed their email and at least one issuer exists. Never expose keys in browsers or mobile apps; proxy through your backend. `GET /v1/account` returns the account, the key's mode and the credit balance. ## Test mode {#test-mode} Everything works in test mode, including webhooks, but **no email reaches a real recipient** and nothing is charged: - Invoice numbers start with `TEST-`; PDFs carry a "test — not valid" watermark. - Emails are simulated. The delivery goes `queued → sent → delivered → opened` within a few seconds and fires the same webhooks as live. - Special recipients force outcomes: `bounce@example.com` → `bounced`, `fail@example.com` → `failed`, `noopen@example.com` → delivered, never opened. - The only real email test mode sends is to the account owner's **confirmed** email address (max 50/day) — so you can see the real email and PDF. - Payment links: the hosted page offers **Simulate payment** (or Stripe test mode if the issuer connected a Stripe test account). - `POST /v1/test_helpers/invoices/{id}/simulate` with `{"event": "delivered" | "opened" | "bounced" | "paid"}` drives any event on demand. ## Issuers {#issuers} An issuer is the legal entity on the invoice (company, sole trader, sports club). An account can have many (e.g. one per club). `POST /v1/issuers` fields: | Field | Required | Notes | |---|---|---| | `country` | yes | `SI` or `HR`. Decides language (sl/hr), VAT rates, slip type. Cannot change later. | | `name` | yes | Legal name. | | `tax_id` | yes | SI: 8-digit davčna številka. HR: 11-digit OIB. Check digit is validated. | | `address_line`, `postal_code`, `city` | yes | | | `iban` | yes | Receives payments; validated (mod 97). | | `vat_registered` | yes | `false`: no VAT, an exemption note is printed (SI: "DDV ni obračunan na podlagi 1. odstavka 94. člena ZDDV-1", HR: "…čl. 90. st. 2. Zakona o PDV-u"). Override with `vat_exemption_note`. | | `subject_to_fiscalization` | yes | See Fiscalisation. Ask the user; a non-profit club collecting membership fees is usually `false`. | | `email` | no | Reply-To of invoice emails — recommended. | | `registration_number`, `phone`, `website`, `bic`, `invoice_footer` | no | Printed on the PDF. | | `default_due_days` | no | Default 15. | | `number_format` | no | Default `{YYYY}-{SEQ:4}` → `2026-0001`. Tokens `{YYYY}` `{YY}` `{SEQ}` `{SEQ:n}`. Sequential per issuer and year, no gaps. | Each issuer object has `capabilities` (`can_issue_invoices`, `can_use_payment_links`, `reason`). `PATCH /v1/issuers/{id}` updates fields (not `country`). Finalised invoices keep the data they were issued with. `PUT /v1/issuers/{id}/logo` with `{"content_type":"image/png","data_base64":"…"}` (max 1 MB). `POST /v1/issuers/{id}/stripe_onboarding` returns a Stripe onboarding `url` for card payments (see Payments). ## Recipients and your data {#recipients} Računi AI does **not** store customers. Your app owns its members, athletes or clients; each invoice carries its recipient inline in `customer`: | Field | Notes | |---|---| | `name` | Required. Printed on the invoice and as payer on the payment slip. | | `type` | `person` (default) or `company`. | | `address_line`, `postal_code`, `city`, `country` | Printed. Recommended: the payer address is used on UPN QR / HUB-3. `country` is ISO, default SI. | | `tax_id`, `vat_id` | Printed. For companies. | | `email` | Where the invoice is emailed. Not printed. | | `phone` | For SMS/WhatsApp (planned). Not printed. | | `language` | `sl`, `hr` or `en` for the email and hosted page; default the issuer country's language. | There is no `cus_…` id and no `external_id`: put your own ids in the invoice `metadata` (e.g. `{"member_id": "42"}`) and find invoices again by `id`, `number` or your stored invoice id. **What we keep, and for how long** (Računi AI is the processor, your app/the club the controller): - The invoice content including the printed recipient fields and the PDF — the legal archive, kept for the statutory period (11 years after the issue year). It never changes after finalisation. - `customer.email` / `customer.phone` and the delivery recipient — masked (`j***@example.com`, `***22`) **30 days after the invoice is paid or voided**, or 365 days after creation if it never settles. `customer.contact_redacted` is then `true`; to resend, pass `to`. - Webhook events and `GET /v1/events` never contain the recipient's email or phone; delivery events show a masked recipient. ## Building an app on Računi AI {#building-an-app} Two common shapes. In both, only your **backend** calls the API; your users never see a key. **An app for one club (or company):** create the issuer once (`POST /v1/issuers`), store its `iss_…` id in config, and create invoices with the recipient inline. `issuer` may be omitted while the account has exactly one issuer. **An app used by many clubs (multi-tenant SaaS):** 1. One Računi account (your company) and **one issuer per club**. Build your own onboarding screen that collects the club's legal data and calls `POST /v1/issuers` with `"metadata": {"tenant_id": ""}`. Store the returned `iss_…` on your club record. 2. Ask the club's admin the questions the issuer needs — VAT status and `subject_to_fiscalization` (see Fiscalisation) — in your own words; do not guess them. 3. For card payments, show a "Connect Stripe" button that calls `POST /v1/issuers/{id}/stripe_onboarding` and opens the `url`. 4. Always pass `issuer` on invoices, plus `metadata` such as `member_id`. Check `capabilities` on the issuer to decide which options your UI offers (e.g. hide "pay by card" when `can_use_payment_links` is false). 5. One webhook endpoint for your whole app: map `data.object.issuer` → club and `data.object.metadata.member_id` → member. 6. Build and test everything with a `rk_test_` key (simulated delivery and payment), then switch to `rk_live_`. Credits are charged to your account; `GET /v1/usage` shows the total. You decide how to bill your clubs. ## Invoices {#invoices} `POST /v1/invoices` creates **and finalises** an invoice by default (assigns the number, renders the PDF). | Field | Notes | |---|---| | `issuer` | `iss_…`. Optional when the account has exactly one issuer. | | `customer` | The recipient object, inline: `name` (required), `email`, address, `tax_id`, `language`… — see Recipients. | | `items[]` | `description`, `unit_price` (EUR, ≤2 decimals), `quantity` (default 1), `unit`, `discount_percent`, `vat_rate`. | | `issue_date` | `YYYY-MM-DD`, default today (Europe/Ljubljana). | | `due_date` or `due_days` | Default: issuer `default_due_days`. | | `service_date` or `service_period: {start, end}` | Date of supply; default issue date. Use a period for monthly fees. | | `prices_include_vat` | VAT issuers only; default false (prices are net). | | `note` | Printed text. | | `payment_slip` | Default **true**: UPN QR (SI) / HUB-3 barcode (HR) slip on the PDF. | | `payment_link` | Default false: card payment link via the issuer's Stripe. | | `payment_reference` | Reference body, e.g. `2026-0042` (digits, ≤2 hyphens). Default from the number. Model SI00/HR00 is added. | | `payment_purpose` | Slip purpose, default "Račun " (cut to 42 SI / 35 HR chars). | | `finalize` | `false` keeps a **draft** (no number) you can `PATCH` and later `POST /v1/invoices/{id}/finalize`. | | `send` | `true` or `{"to": "other@example.com"}` — email right after finalising. | | `metadata` | Up to 20 string pairs for your ids (e.g. `member_id`). No personal data. | VAT rates: SI `22`, `9.5`, `5`, `0` (default 22); HR `25`, `13`, `5`, `0` (default 25). VAT is computed per rate on the sum of line bases. Non-VAT issuers must omit `vat_rate` (or send 0). **Statuses:** `draft` → `open` (finalised, unpaid) → `paid`; or `void`. `delivery_status`: `none`, `queued`, `sent`, `delivered`, `opened`, `bounced`, `failed`. Other endpoints: - `GET /v1/invoices?status=open&issuer=iss_…&limit=50&starting_after=inv_…` (also `number`, `batch`), `GET /v1/invoices/{id}` - `GET /v1/invoices/{id}/pdf` (application/pdf), `GET /v1/invoices/{id}/payment_code` (PNG of the QR/barcode) - `POST /v1/invoices/{id}/send` `{"to"?: "…"}` — (re)send; each send is a delivery - `POST /v1/invoices/{id}/mark_paid` `{"paid_at"?, "method"?: "bank_transfer"|"cash"|"card"|"other"}` - `POST /v1/invoices/{id}/void` — only before delivery; delivered invoices need a credit note (planned) - `PATCH|DELETE /v1/invoices/{id}` — drafts only Finalised invoices are legal documents: their content (issuer data, printed customer fields, items, number) never changes. `hosted_url` is a public, unguessable page with the PDF and pay button — safe to show to the invoice recipient. Example response (abridged): ```json { "id": "inv_8Kq2…", "object": "invoice", "livemode": false, "status": "open", "number": "TEST-2026-0001", "issue_date": "2026-12-01", "due_date": "2026-12-16", "issuer": "iss_…", "customer": { "type": "person", "name": "Janez Novak", "address_line": "Slovenska cesta 1", "postal_code": "1000", "city": "Ljubljana", "country": "SI", "tax_id": null, "vat_id": null, "email": "janez@example.com", "phone": null, "contact_redacted": false }, "items": [{ "description": "Članarina december 2026", "quantity": 1, "unit_price": 45, "vat_rate": 0, "amount": 45 }], "subtotal": 45, "vat": 0, "total": 45, "total_cents": 4500, "payment": { "reference": "SI00 2026-0001", "purpose": "Račun TEST-2026-0001", "slip": true, "slip_type": "upn_qr", "link": true, "pay_url": "https://app.racuni-ai.si/i/Zm9v…/pay" }, "hosted_url": "https://app.racuni-ai.si/i/Zm9v…", "pdf_url": "https://app.racuni-ai.si/v1/invoices/inv_8Kq2…/pdf", "delivery_status": "queued", "paid_at": null, "metadata": { "member_id": "42" } } ``` ## Bulk: "send December invoices to everyone" {#batches} `POST /v1/invoices/batch` with up to 500 invoices (same fields as POST /v1/invoices, without `send`/`finalize`) and a top-level `"send": true`. Returns `202` with a batch (`bat_…`). Invoices are created asynchronously; poll `GET /v1/batches/{id}` or wait for the `batch.completed` webhook. `results[i]` = `{ index, status: "succeeded" | "failed", invoice, number, error }` in input order. In live mode the batch is rejected up front (402) if the credit cannot cover it. Items are processed exactly once. ```json { "send": true, "invoices": [ { "customer": { "name": "Janez Novak", "email": "janez@example.com" }, "metadata": { "member_id": "42" }, "items": [{ "description": "Članarina december 2026", "unit_price": 45 }] }, { "customer": { "name": "Ana Kovač", "email": "ana@example.com" }, "metadata": { "member_id": "43" }, "items": [{ "description": "Članarina december 2026", "unit_price": 45 }] } ] } ``` ## Delivery {#sending} Email is the v1 channel (SMS/WhatsApp will be added behind the same `send` call; your code will not change). The email is sent as " prek Računi AI" with Reply-To = issuer email, in the issuer's language (sl/hr, or `customer.language`), with the PDF attached, the amount/IBAN/reference, a **Pay by card** button (if `payment_link`) and a link to `hosted_url`. Every send creates a **delivery** (`dlv_…`): `GET /v1/deliveries?invoice=inv_…`. Statuses come from the email provider: `queued → sent → delivered → opened`, or `bounced` / `failed`. Failed sends are retried automatically; if they finally fail the email credit is refunded. ## Payments {#payments} **Bank transfer (default):** the PDF has a payment slip: **UPN QR** (Slovenia; scan with any Slovenian mobile bank) or **HUB-3 PDF417** (Croatia). When the money arrives, call `POST /v1/invoices/{id}/mark_paid` (bank reconciliation is not automatic in v1). **Card payment link:** `payment_link: true` adds `payment.pay_url` — a durable link (never expires) that opens Stripe Checkout for the open amount. The money goes **directly to the issuer's own Stripe account**; Stripe charges its fee to that account. When paid, the invoice becomes `paid` (`paid_via: "stripe"`) and `invoice.paid` fires. Live payment links require the issuer to connect Stripe once: `POST /v1/issuers/{id}/stripe_onboarding` → open the returned `url` (or use the dashboard). Without it, live invoices with `payment_link: true` fail with `payment_link_unavailable`. ## Webhooks {#webhooks} Register: `POST /v1/webhook_endpoints` `{"url": "https://yourapp.example/api/racuni-webhook", "events": ["*"]}` → returns `secret` (`whsec_…`, shown once). Test-mode endpoints may use http://localhost. Live endpoints must be public HTTPS. Events: `invoice.created`, `invoice.finalized`, `invoice.sent`, `invoice.delivered`, `invoice.opened`, `invoice.delivery_failed`, `invoice.paid`, `invoice.voided`, `batch.completed`. Body: ```json { "id": "evt_…", "object": "event", "type": "invoice.paid", "livemode": false, "created": 1764590000, "data": { "object": { "id": "inv_…", "object": "invoice", "status": "paid", "metadata": {} } } } ``` Delivery events include `data.object.delivery` (`id`, `recipient` masked, `status`, `error`). Event payloads never contain the recipient's email or phone — `GET /v1/invoices/{id}` returns them until they are masked (see Recipients). Respond 2xx within 10 s; non-2xx is retried with backoff for ~3 days. Events can arrive more than once and out of order: dedupe by `id`, and trust `data.object.status`. **Verify the signature** (header `Racuni-Signature: t=,v1=`, HMAC-SHA256 of `"."` with the secret): ```ts import { createHmac, timingSafeEqual } from "node:crypto"; export function verifyRacuniSignature(rawBody: string, header: string, secret: string): boolean { const parts = Object.fromEntries(header.split(",").map((p) => p.split("="))); const t = Number(parts.t); if (!t || !parts.v1 || Math.abs(Date.now() / 1000 - t) > 300) return false; const expected = createHmac("sha256", secret).update(`${t}.${rawBody}`).digest("hex"); return expected.length === parts.v1.length && timingSafeEqual(Buffer.from(expected), Buffer.from(parts.v1)); } // Next.js route: const raw = await req.text(); if (!verifyRacuniSignature(raw, req.headers.get("racuni-signature") ?? "", process.env.RACUNI_WEBHOOK_SECRET!)) return new Response("bad signature", { status: 400 }); ``` ```python import hmac, hashlib, time def verify_racuni_signature(raw_body: bytes, header: str, secret: str) -> bool: parts = dict(p.split("=", 1) for p in header.split(",")) t = int(parts.get("t", "0")) if not t or abs(time.time() - t) > 300: return False expected = hmac.new(secret.encode(), f"{t}.".encode() + raw_body, hashlib.sha256).hexdigest() return hmac.compare_digest(expected, parts.get("v1", "")) ``` `GET /v1/events` lists recent events (useful for catching up). ## Idempotency, pagination, limits {#idempotency} - `Idempotency-Key: ` on any POST/PATCH/PUT/DELETE: retrying with the same key and body returns the original response (header `Idempotent-Replayed: true`) for 24 h. Same key with a different body → 409 `idempotency_key_reused`. - Lists: `limit` (1–100, default 20) and `starting_after=`; response `{ "object": "list", "data": [...], "has_more": true }`. Newest first. - Rate limit: 100 requests/min per live key, 60 per test key → 429 with `Retry-After`. Use the batch endpoint for bulk work. ## Errors {#errors} Errors use HTTP status codes and a JSON body; `message` tells you how to fix it: ```json { "error": { "type": "invalid_request_error", "code": "invalid_iban", "message": "iban 'SI56…' is not a valid IBAN.", "param": "iban", "doc_url": "https://app.racuni-ai.si/docs#error-invalid_iban" } } ``` Types: `invalid_request_error` (400), `authentication_error` (401), `insufficient_credits` (402), `permission_error` (403), `not_found` (404), `conflict` / `idempotency_error` (409), `rate_limit_error` (429), `api_error` (500 — safe to retry with the same Idempotency-Key). Codes: - `missing_api_key` {#error-missing_api_key} — no Authorization header. Get a key via POST /v1/accounts. - `invalid_api_key` {#error-invalid_api_key} — wrong or revoked key. - `signups_closed` {#error-signups_closed}, `access_restricted` {#error-access_restricted} — the service is in private beta; only invited accounts can sign up and use it. - `invalid_authorization_header` {#error-invalid_authorization_header} — use `Authorization: Bearer `. - `route_not_found` {#error-route_not_found} — no such endpoint; check the path and method against the list above. - `invalid_cursor` {#error-invalid_cursor} — `starting_after` must be the id of an object from the same list. - `parameter_invalid` {#error-parameter_invalid} — a field is missing, has the wrong type or is unknown (see `param`). Field names are exact. `customer.external_id` and `cus_…` ids no longer exist: send the recipient inline and your id in `metadata`. - `invalid_json` {#error-invalid_json} — body is not JSON. - `body_too_large` {#error-body_too_large} — body over 2 MB; split the batch. - `resource_missing` {#error-resource_missing} — id not found in this mode (test vs live data are separate). - `duplicate` {#error-duplicate} — unique constraint hit. - `account_exists` {#error-account_exists} — email already registered; log in to the dashboard. - `invalid_tax_id` {#error-invalid_tax_id} — davčna številka / OIB check digit failed. - `invalid_iban` {#error-invalid_iban} — IBAN invalid. - `invalid_number_format` {#error-invalid_number_format} — number_format needs {SEQ}. - `invalid_logo` {#error-invalid_logo}, `logo_too_large` {#error-logo_too_large} — PNG/JPEG up to 1 MB. - `issuer_required` {#error-issuer_required} — create an issuer, or pass `issuer` when there are several. - `fiscalization_required` {#error-fiscalization_required} — the issuer is a fiscalisation obligor; see Fiscalisation. - `payment_link_unavailable` {#error-payment_link_unavailable} — connect the issuer's Stripe first, or omit payment_link. - `stripe_not_configured` {#error-stripe_not_configured} — Stripe is not enabled on this deployment/mode. - `invalid_item` {#error-invalid_item} — item price decimals or VAT rate not allowed. - `invalid_due_date` {#error-invalid_due_date}, `invalid_service_period` {#error-invalid_service_period} — dates out of order. - `invalid_payment_reference` {#error-invalid_payment_reference} — digits with ≤2 hyphens, ≤20 digits, no model. - `invalid_total` {#error-invalid_total} — total must be > 0. - `cannot_send_draft` {#error-cannot_send_draft} — send needs finalize. - `invoice_not_draft` {#error-invoice_not_draft} — only drafts can be changed or deleted. - `invoice_is_draft` {#error-invoice_is_draft} — drafts have no PDF/payment code. - `invoice_void` {#error-invoice_void}, `invoice_not_open` {#error-invoice_not_open}, `invoice_paid` {#error-invoice_paid} — action not allowed in this status. - `invoice_already_sent` {#error-invoice_already_sent} — delivered invoices cannot be voided (credit notes are planned). - `missing_recipient` {#error-missing_recipient} — no `customer.email` (or it was masked after the retention period); pass `to`. - `insufficient_credits` {#error-insufficient_credits} — top up in the dashboard; test mode is free. - `idempotency_key_reused` {#error-idempotency_key_reused}, `idempotency_in_progress` {#error-idempotency_in_progress}, `invalid_idempotency_key` {#error-invalid_idempotency_key}. - `rate_limited` {#error-rate_limited} — wait `Retry-After` seconds. - `test_mode_only` {#error-test_mode_only}, `no_delivery` {#error-no_delivery} — test helper preconditions. - `invalid_url` {#error-invalid_url}, `insecure_url` {#error-insecure_url}, `private_url` {#error-private_url}, `invalid_event_type` {#error-invalid_event_type}, `too_many_endpoints` {#error-too_many_endpoints} — webhook endpoint problems. - `email_not_verified` {#error-email_not_verified} — confirm the owner email before live keys. - `invalid_limit` {#error-invalid_limit}, `not_allowed` {#error-not_allowed}, `invalid_pack` {#error-invalid_pack}, `billing_not_configured` {#error-billing_not_configured}. - `internal_error` {#error-internal_error} — our fault; retry with the same Idempotency-Key. ## Country rules {#countries} | | Slovenia (SI) | Croatia (HR) | |---|---|---| | Language | Slovenian | Croatian | | Tax id | davčna številka, 8 digits | OIB, 11 digits | | VAT rates | 22, 9.5, 5, 0 | 25, 13, 5, 0 | | Non-VAT note | 94. člen ZDDV-1 | čl. 90. Zakona o PDV-u | | Payment slip | UPN QR (ZBS standard, ISO-8859-2, QR v15) | HUB-3 2D barcode (PDF417) | | Reference model | SI00 | HR00 | | Extra on invoice | — | time of issue | Every PDF contains: issuer name, address, tax id (and VAT id for VAT payers), registration number if given, sequential invoice number, issue date, date or period of supply, due date, place of issue, payment method, customer name/address/tax id, line items (description, quantity, unit, unit price, discount, VAT rate, amount), VAT breakdown per rate or exemption note, total due, IBAN, reference and purpose. Retention: invoices must be kept 10 years (SI) / 11 years (HR). We archive finalised invoices and PDFs for that period; you can always download them again. Recipient contact data is kept much shorter — see Recipients. ## Fiscalisation {#fiscalisation} v1 does **not** fiscalise (no FURS / Porezna uprava connection). Every issuer declares `subject_to_fiscalization`: - **Slovenia:** only invoices paid in *cash* must be fiscally confirmed (davčno potrjevanje, ZDavPR). Cash includes **cards**, also online. A bank transfer to the IBAN needs nothing. → SI issuers with `subject_to_fiscalization: true` can issue invoices paid by bank transfer (UPN QR) but **cannot use payment links**. - **Croatia (Fiskalizacija 2.0, from 1 Jan 2026):** obligors must fiscalise every invoice to consumers regardless of payment method, and VAT payers must exchange structured eRačun with businesses. → HR issuers with `subject_to_fiscalization: true` **cannot issue invoices** in v1. - Who is **not** subject: typically associations / sports clubs outside VAT and profit tax that collect membership fees without counter-performance, donations and grants. Clubs selling camps, equipment, tickets etc. usually are subject. If unsure, the AI should ask the user (and suggest their accountant) rather than guess. Mandatory B2B e-invoicing in Slovenia starts 1 Jan 2028; structured e-invoices are on our roadmap. ## Pricing {#pricing} Live mode is pay-per-use from prepaid credit; test mode is free. Prices exclude VAT. | Unit | Price | |---|---| | Invoice (number, PDF, archive) | 0,05 € | | Payment slip (UPN QR / HUB-3) | 0,02 € | | Email delivery | 0,03 € | | Payment link | 0,05 € | A fully featured invoice costs 0,15 €. Top-ups: 20,00 €, 100,00 € (+5 % bonus), 500,00 € (+10 % bonus). 2,00 € welcome credit after email confirmation. Stripe's card fees for payment links are charged by Stripe to the issuer's own Stripe account. ## MCP server {#mcp} Endpoint: `https://app.racuni-ai.si/mcp` (Streamable HTTP, stateless). Authenticate with `Authorization: Bearer rk_…`. ```bash claude mcp add --transport http racuni https://app.racuni-ai.si/mcp --header "Authorization: Bearer rk_test_…" ``` Clients that cannot set headers may use `https://app.racuni-ai.si/mcp?key=rk_test_…` (the URL then contains a secret). Without a key, `get_started`, `create_account` and `get_docs` work. Tools: get_account, list_issuers, create_issuer, update_issuer, get_issuer, create_invoice, create_invoices_batch, get_batch, get_invoice, list_invoices, send_invoice, mark_invoice_paid, void_invoice, list_deliveries, create_webhook_endpoint, list_webhook_endpoints, simulate_test_event, get_usage. The MCP server is mainly for the AI tool that builds your integration: read the docs, try calls in test mode, simulate events. Typical chat: "send December invoices to everyone" → the host app supplies the member list → create_invoices_batch (send: true) → get_batch. ## Example: TypeScript client {#example-typescript} ```ts // lib/racuni.ts — server-side only const BASE = "https://app.racuni-ai.si/v1"; export async function racuni(path: string, init: { method?: string; body?: unknown; idempotencyKey?: string } = {}): Promise { const res = await fetch(`${BASE}${path}`, { method: init.method ?? (init.body ? "POST" : "GET"), headers: { Authorization: `Bearer ${process.env.RACUNI_API_KEY}`, "Content-Type": "application/json", ...(init.idempotencyKey ? { "Idempotency-Key": init.idempotencyKey } : {}), }, body: init.body ? JSON.stringify(init.body) : undefined, }); const json = await res.json(); if (!res.ok) throw new Error(`Računi AI ${res.status} ${json.error?.code}: ${json.error?.message}`); return json as T; } // Invoice a member for a month and email it. export function invoiceMembershipFee(issuerId: string, member: { id: string; name: string; email: string }, month: string, amountEur: number) { return racuni<{ id: string; number: string; hosted_url: string }>("/invoices", { idempotencyKey: `membership-${member.id}-${month}`, body: { issuer: issuerId, customer: { name: member.name, email: member.email }, metadata: { member_id: member.id }, items: [{ description: `Članarina ${month}`, unit_price: amountEur }], payment_link: true, send: true, }, }); } ```