Skip to main content

Authentication and permissions

The Public API uses OAuth 2.0 client credentials with opaque bearer tokens. The client_secret is shown once; Klik Račun stores its scrypt hash. Access tokens are stored as SHA-256 digests.

Credential exchange​

Authenticate the client with HTTP Basic. Credentials in JSON or form fields are not accepted.

POST /oauth2/token HTTP/1.1
Authorization: Basic base64(client_id:client_secret)
Content-Type: application/x-www-form-urlencoded

grant_type=client_credentials&scope=invoices%3Aread%20invoices%3Adraft

/public/v1/oauth2/token is an equivalent, versioned alias.

Permissions​

PermissionAllows
invoices:readRead outgoing invoices, UBL, status, and operations
invoices:draftCreate and update drafts
invoices:issueValidate and issue drafts
invoices:reverseFully reverse issued invoices
invoices:correctPreview and confirm guarded corrections
advances:writeReserve and release advances
payments:readRead payment evidence
payments:writeRecord and void payment evidence
incoming:readRead the organization's incoming invoices
incoming:respondApprove or reject incoming invoices
events:readOpen the client- and OIB-bound operation event stream

Requested permissions must be a subset of those assigned to the client. Prefer several narrowly privileged production clients over one credential with every permission.

Organization binding and revocation​

Klik Račun verifies the credential-bound OIB for raw UBL ownership, outgoing resources, incoming customer ownership, correction plans, operations, and events. An OIB mismatch returns 403; a resource owned by another organization appears as 404 to avoid disclosing its existence.

Rate-limit headers are returned on protected calls. Secret rotation or client deactivation immediately revokes active tokens.