Menu
Getting started
Cookbooks
API reference
- Overview
- Companies
- Capabilities
- Measures
- Packages
- Unexplained
- Liquidity forecast
- Portfolio
- Customers
- Invoices
- Collections
- Articles
- Set-offs
- Suppliers
- Supplier invoices
- Supplier payment files
- Bank payments
- Expense claims
- Transactions
- Reconciliation
- Bank accounts
- POS sales
- Webshop orders
- Journal entries
- Voucher gap explanations
- Fiscal periods
- Accounts
- Accrual schedules
- Agreements and commitments
- Tax loss carry-forwards
- Fixed assets
- Documents
- Signing requests
- Company registers
- Capital events
- Owner tax
- Inbox items
- Dimensions
- Employees
- Salary runs
- Reports
- Budgets
- Imports
- Compliance check
- Deadlines
- Skatteverket
- Peppol
- Webhooks
- Operations
- Pending operations
- Health
- API key
- Service accounts
accounted API
Swedish double-entry bookkeeping as a public REST API for agents and integrations. API version
2026-05-12.
The accounted API covers the financial workflows an integration needs: create invoices, ingest bank transactions, file VAT declarations, run payroll, and subscribe to webhooks for state changes. Every endpoint is designed for autonomous agents first: machine-readable schemas, dry-run previews, idempotent retries, and the posted verifikat named in the response. (Steps that need a person, such as BankID signing, are called out in each cookbook.)
If you've used Stripe's API, the shape will feel familiar: bearer-token auth, dated API versions, webhook signature verification, idempotency keys. The accounting concepts are Swedish (BAS chart, BFL retention, K2/K3, momsdeklaration) but the surface is built for the same kind of integrator.
Authentication
All requests authenticate with a bearer token in the Authorization header:
curl https://app.accounted.se/api/v1/companies \
-H "Authorization: Bearer gnubok_sk_..."
Create keys in the accounted dashboard at /settings/api. Two kinds of key are available:
gnubok_sk_<random>(live, no infix aftergnubok_sk_): hits real customer data. Use in production.gnubok_sk_test_*: reads real company data, but every write is forced into dry-run and nothing persists (responses carryX-Gnubok-Mode: test); a write to an endpoint without dry-run support, such as a document upload, is refused with403 TEST_KEY_WRITE_BLOCKED. Safe for evals, demos, and agent learning. Same surface, different blast radius.
Each key carries one or more scopes (invoices:read, invoices:write, payroll:write, webhooks:manage, ...) that gate which endpoints it can call. Scopes are listed on every endpoint reference page.
To check a key before relying on it, call GET /api/v1/api-key: any valid key may, whatever its scopes. It returns the key's mode, scopes, and every company it reaches with the role and whether writes are let through there.
Rate limit: 100 requests per minute per key.
Base URL
https://app.accounted.se/api/v1
Integrations set up against the earlier host app.gnubok.se keep working there; new integrations use app.accounted.se.
URLs include the company id explicitly:
GET /api/v1/companies/{companyId}/invoices
POST /api/v1/companies/{companyId}/invoices
A multi-company key can act on any company the underlying user is a member of: the URL is the source of truth, not a default. List the companies a key can access with:
curl https://app.accounted.se/api/v1/companies \
-H "Authorization: Bearer gnubok_sk_..."
For the cross-company view (unbooked items, inbox, next deadline and last booked entry per company) call GET /api/v1/portfolio/overview: one response covering every company the key's user belongs to.
Core principles
These four invariants hold across the entire surface: once you've internalised them you can predict the shape of any endpoint without reading the reference.
Dry-run on most writes. Append ?dry_run=true (or send X-Dry-Run: true) to a write whose reference page says dry-run is supported (x-dry-run-supported: true in the OpenAPI spec) to preview the effect: the response shows the would-be record, the verifikat lines it would post, and any validation errors that would surface, but commits nothing. A write that cannot be simulated refuses the flag with 400 VALIDATION_ERROR (field dry_run) and runs nothing: period lock, close and year-end, bank and SIE imports, match-invoice, generate-agi, document upload, the approval of a pending operation and the webhook test, verify and rotate-secret verbs are among them. Use dry-run in agent test-loops to validate inputs before paying the side-effect cost.
Idempotency-Key on every write. Pass a UUID in the Idempotency-Key header. Replays of the same key+body return the original response with Idempotent-Replayed: true (24h cache). Replays with a different body return 409 IDEMPOTENCY_KEY_REUSE.
Strict-mode write semantics. A v1 write is validated in full before anything is posted; a refusal returns a structured error code and writes nothing. Where a later step can fail after a verifikat is posted, the endpoint says what stands: POST /invoices/{id}/send answers 502 INVOICE_SEND_ISSUED_NOT_DELIVERED with the invoice issued and booked (deliver it another way, do not call /send again), and a POST /salary-runs/{id}/book that stops partway keeps the vouchers already posted and adopts them on retry.
Posting reference on the response. A write that posts a verifikat returns its reference in data (journal_entry_id, and voucher_number where the endpoint has it), so no second round-trip is needed to confirm what happened. POST /salary-runs/{id}/book and /correct also carry an audit block in meta (voucher_number, voucher_url, immutable_at).
Response envelope
Every response has the same shape:
{
"data": { ... },
"meta": {
"request_id": "req_...",
"api_version": "2026-05-12",
"next_cursor": "...",
"audit": { "voucher_number": "A-2026-042", "voucher_url": "..." }
}
}
Errors return an error object instead of data (and carry no meta block - the request_id moves inside error):
{
"error": {
"code": "PERIOD_LOCKED",
"message": "Den valda perioden är låst.",
"message_en": "The selected period is locked.",
"details": { "fiscal_period_id": "..." },
"recovery_hint": "Unlock via /fiscal-periods/{id}/unlock or pick an open period.",
"docs_url": "https://docs.accounted.se/errors#period_locked",
"request_id": "req_..."
}
}
Every error code is documented in the error reference.
Ids and typed handles
Resource ids are UUIDs, and the resources a response returns also carry a typed handle next to their id: the same id spelled with its type, <prefix>_<the UUID as 32 lowercase hex, no dashes>. A journal entry 0e9c41d2-a1b0-4c6f-9a3e-5b7d8c9f0a1b is je_0e9c41d2a1b04c6f9a3e5b7d8c9f0a1b, so a stored handle always says what it names:
{ "data": { "id": "0e9c41d2-a1b0-4c6f-9a3e-5b7d8c9f0a1b", "handle": "je_0e9c41d2a1b04c6f9a3e5b7d8c9f0a1b", "voucher_number": 142 } }
- Send either form. Every path id and every body or query field named for a resource (
journal_entry_id,credited_invoice_id,invoice_ids,period_id, ...) accepts the handle or the plain UUID. Plain UUIDs keep working everywhere; nothing about an existing request changes. - A wrong type is refused at the door. An
inv_invoice handle where a journal entry id belongs answers400 HANDLE_TYPE_MISMATCHbefore anything is read.error.details.issues[]names thefield, theexpected_prefixit takes (null when it takes a plain UUID only) and thereceived_prefix. - Additive output. Id fields keep their names and values (
journal_entry_idstill holds the UUID); onlyhandleis added, on the resource objects whose type is known. The OpenAPI spec shows it, with its pattern, on each endpoint that returns it. - Permanent prefixes. A prefix is never renamed or reused:
cmpcompany,jejournal entry,invcustomer invoice (quotes and credit notes too),sinvsupplier invoice,cuscustomer,supsupplier,txnbank transaction,docdocument,poppending operation,fpfiscal period,acsaccrual schedule,empemployee,srunsalary run,artarticle,astfixed asset,dimdimension,dimvdimension value,inbxinbox item,expexpense claim,cashcash account,pmtpayment order,spbsupplier payment batch,whwebhook,whdwebhook delivery,opasync operation,svcservice account,keyAPI key,audaudit log entry,rsoreconciliation sign-off,vgapvoucher gap explanation,teamteam (byrå or personal),bevbusiness event andsieSIE import (both reserved: no endpoint returns or takes one yet). Sub-resources without a prefix (salary lines, benefits) take the plain UUID only. - MCP. The MCP tools accept handles in their id arguments too, and their input schemas say so (a typed id field's pattern admits its handle or a UUID); their answers still carry plain UUIDs.
Where to go next
- Quickstart cookbook: send your first invoice in five minutes.
- API reference: every endpoint, grouped by resource.
- Webhooks: subscribe to events with HMAC-signed delivery.
- Errors: every stable error code with remediation.
- Versioning: how API versions are pinned and upgraded.
- Changelog: what shipped when.
For LLM-based agents:
- Agent skill for integrators:
npx skills add erp-mafia/accounted --skill accounted-apiteaches your coding agent (Claude Code, Cursor, Codex, ...) this entire API: auth, conventions, and every endpoint with request/response schemas. Generated from the same registry that serves this spec, so it cannot drift. /llms.txt: concise agent-discovery index./llms-full.txt: full docs concatenated for ingestion./api/v1/openapi.json: machine-readable OpenAPI 3.1 spec./.well-known/skills/index.json: accounted-specific skill catalogue.
Cookbooks
End-to-end recipes for the most common integrations. Copy-paste ready, tested against the sandbox.
API reference
Every endpoint, grouped by resource. Auto-generated from the same Zod registry that powers the OpenAPI spec, MCP tools, and runtime validators.