API Reference
This section contains the API documentation for integrating with AnyBiz.
Overview
Section titled “Overview”AnyBiz provides a RESTful API built with oRPC (OpenAPI-compatible RPC). The API supports:
- Authentication - Organization API keys for integrations, Better Auth sessions for the apps
- Organization Context - All API calls operate within an organization context
- Type-Safe Contracts - Full TypeScript support with Valibot validation
API Categories
Section titled “API Categories”Authentication
Section titled “Authentication”- Login/Logout
- Registration
- Session management
Organization
Section titled “Organization”- Organization management
- Member management
- Subscription management
Features
Section titled “Features”- Point of Sale (POS)
- Invoices (list, get, create, finalize, send to eFaktura)
- Business Partners
- Settings (organization, eFaktura, fiscalization)
- Events SDK (
/api/events/sdk/*) for external map embedding and checkout flow — see the TicketMap SDK integration guide - Internal:
POST /api/internal/sef-subscribe(cron; requiresX-Cron-SecretorAuthorization: BearerwithSEF_CRON_SECRET)
Getting Started
Section titled “Getting Started”To use the AnyBiz API:
- Get a credential - Create an API key under Settings → API keys, or sign in for a session
- Organization context - An API key is bound to its organization; a session sets an active organization
- Make API Calls - Use the documented endpoints
A worked example of issuing an invoice from your own backend is in External integrations.
OpenAPI Specification
Section titled “OpenAPI Specification”The full OpenAPI specification can be generated from the oRPC contracts. Run pnpm docs:generate-api from the repository to regenerate it.
Base URL
Section titled “Base URL”https://api.anybiz.com/apiFor local development:
http://localhost:3000/apiAuthentication
Section titled “Authentication”Every API request needs one of two credentials.
API key (integrations)
Section titled “API key (integrations)”For server-to-server access, an organization owner creates a key under Settings → API keys in the app. The key is shown once; only its hash is stored. Send it with every request, either as a bearer token or in the X-API-Key header:
curl -X GET "https://api.anybiz.com/api/organization/current" \ -H "Authorization: Bearer ak_your_key"curl -X GET "https://api.anybiz.com/api/organization/current" \ -H "X-API-Key: ak_your_key"A key acts as the owner who created it, inside the organization it was created for: requests get full owner access, and the key stops working as soon as that owner leaves the organization, when it is revoked, or when its expiry passes. Only owners can create or revoke keys, keys cannot manage keys, and they do not work on the /api/auth/* endpoints.
Session (apps)
Section titled “Session (apps)”The web and desktop apps sign in through /api/auth/* and send the session cookie, or the set-auth-token response header as Authorization: Bearer <token>. A session can switch its active organization; an API key is bound to one.
Rate Limiting
Section titled “Rate Limiting”API calls are subject to rate limiting. Please ensure your integration handles rate limit responses appropriately.
Error Handling
Section titled “Error Handling”All API errors follow a consistent format:
{ "error": { "code": "ERROR_CODE", "message": "Human-readable error message" }}Common error codes:
UNAUTHORIZED- Authentication requiredFORBIDDEN- Insufficient permissionsNOT_FOUND- Resource not foundVALIDATION_ERROR- Invalid request data