Every API here is available over the APIs.io API and to AI agents over MCP.
openapi: 3.2.0
info:
title: Anytax v1 Public API
description: "## Machine-readable resources\n\n| Resource | URL | Use for |\n|---|---|---|\n| OpenAPI JSON | `/v1-json` | Import into Cursor / Copilot / Claude Projects as a spec file |\n| OpenAPI YAML | `/v1-yaml` | Same spec in YAML for tools that prefer `.yaml` |\n| LLM guide | `/llms.txt` | AI agents that fetch `llms.txt` for narrative docs |\n\n---\n\n# AnyTax Partner Integration Guide\n\nThis guide is written for **integration teams** embedding AnyTax into an existing product. It explains how to authenticate your end users, call our public REST APIs from your backend, and follow security expectations for a production SaaS integration. You will find authentication flows, endpoint reference, sequence diagrams, and reference implementations in **TypeScript**, **Java**, and **Python**.\n\n---\n\n### Table of contents\n\n1. [Overview](#description/overview)\n2. [Prerequisites](#description/prerequisites)\n3. [Authentication Endpoints](#description/authentication-endpoints)\n - [Register\
\ a User](#description/1-register-a-user)\n - [Login a User](#description/2-login-a-user)\n4. [Protected API Endpoints](#description/protected-api-endpoints)\n - [Get User Profile](#description/3-get-user-profile)\n - [List Scenarios](#description/4-list-scenarios)\n - [List Filings](#description/5-list-filings)\n - [Create a Filing](#description/6-create-a-filing)\n - [Prefill a Filing](#description/7-prefill-a-filing)\n - [Refresh Token](#description/8-refresh-token)\n5. [Partner-Initiated SSO (Silent Login)](#description/partner-initiated-sso-white-label-silent-login)\n - [SSO quickstart (step by step)](#description/sso-quickstart-step-by-step)\n - [Mint an SSO code](#description/9-mint-an-sso-code)\n - [Exchange the code](#description/10-exchange-the-code-browser-redirect)\n6. [Return to partner (white-label)](#description/return-to-partner-white-label)\n7. [Supporting documents](#description/supporting-documents)\n8. [Integration Architecture](#description/integration-architecture)\n\
\ - [Option A — Server Proxy](#description/option-a-server-proxy)\n - [Option B — Client Direct](#description/option-b-client-direct-browser-to-antx-be)\n9. [Sequence Diagrams](#description/sequence-diagrams)\n10. [Complete Code Examples](#description/complete-code-examples)\n - [TypeScript / Node.js](#description/typescript-nodejs)\n - [Java](#description/java)\n - [Python](#description/python)\n11. [Error Handling](#description/error-handling)\n12. [Security Best Practices](#description/security-best-practices)\n13. [Import from ELSTER](#description/import-from-elster)\n\n---\n\n## Overview\n\nAnyTax is a multi-tenant platform. As a **partner**, you integrate your application so your customers can complete German tax filings without leaving your product experience. At a high level you will:\n\n- **Provision** end-user accounts under your partner tenant using server-to-server calls (no OTP in this flow).\n- **Authenticate** returning users and obtain JWT access tokens for\
\ API access.\n- **Orchestrate** tax scenarios, filings, answers, and related flows through the same public APIs your users would use in our first-party experience.\n\nEnd users are scoped by **`(email + partner)`**: the same email may exist for different partners without collision.\n\n### How the integration works\n\n1. During onboarding, AnyTax issues a **partner slug** and **client secret** for your environment.\n2. Your **backend** calls register or login with those credentials plus the end user’s email.\n3. AnyTax returns a **JWT access token** (RS256, short-lived; see [Refresh Token](#description/8-refresh-token)).\n4. Your services use that token in the `Authorization` header for all subsequent calls on behalf of that user.\n\n---\n\n## Prerequisites\n\n| Item | Description |\n| ----------------- | ------------------------------------------------------------------------------------ |\n| **Partner\
\ slug** | Stable identifier for your partner tenant (for example `my-partner`). |\n| **Client secret** | Rotatable credential issued with your slug. **Use only on trusted servers.** |\n| **Base URL** | Environment-specific API origin (for example `https://api.anytax.io` in production). |\n\n> **Security:** Treat the client secret like any other production API key. Register and login requests must originate from **your backend**—never from a browser bundle, mobile app, or public repository.\n\n---\n\n## Authentication Endpoints\n\n### 1. Register a User\n\nCreates a new user under your partner and returns a JWT token.\n\n| | |\n| -------------- | -------------------------------------------------------------------- |\n| **URL** | `POST /api/v1/partner/users/register` |\n| **Auth** | None (public endpoint, authenticated by partner\
\ credentials in body) |\n| **Rate Limit** | 10 requests per minute |\n\n**Request Body:**\n\n```json\n{\n \"slug\": \"my-partner\",\n \"clientSecret\": \"your-secret-here\",\n \"email\": \"user@example.com\",\n \"name\": \"Max\",\n \"surname\": \"Mustermann\"\n}\n```\n\n| Field | Type | Required | Constraints |\n| -------------- | ------ | -------- | ------------------- |\n| `slug` | string | Yes | 1–64 characters |\n| `clientSecret` | string | Yes | 1–512 characters |\n| `email` | string | Yes | Valid email address |\n| `name` | string | Yes | Min 2 characters |\n| `surname` | string | Yes | Min 2 characters |\n\n**Success Response (201):**\n\n```json\n{\n \"success\": true,\n \"data\": {\n \"accessToken\": \"eyJhbGciOiJSUzI1NiIs...\",\n \"expiresIn\": 3600,\n \"user\": {\n \"id\": 42,\n \"email\": \"user@example.com\",\n \
\ \"name\": \"Max\",\n \"surname\": \"Mustermann\"\n }\n },\n \"meta\": {\n \"timestamp\": \"2026-04-15T12:00:00.000Z\",\n \"responseTime\": 245\n }\n}\n```\n\n**Error Responses:**\n\n| Status | Condition |\n| -------------------------- | ---------------------------------------------------- |\n| `401 Unauthorized` | Invalid slug or client secret |\n| `409 Conflict` | User with this email already exists for your partner |\n| `422 Unprocessable Entity` | Validation failed (missing/invalid fields) |\n\n---\n\n### 2. Login a User\n\nAuthenticates an existing partner user and returns a fresh JWT token.\n\n| | |\n| -------------- | -------------------------------------------------------------------- |\n| **URL** | `POST /api/v1/partner/users/login` \
\ |\n| **Auth** | None (public endpoint, authenticated by partner credentials in body) |\n| **Rate Limit** | 30 requests per minute |\n\n**Request Body:**\n\n```json\n{\n \"slug\": \"my-partner\",\n \"clientSecret\": \"your-secret-here\",\n \"email\": \"user@example.com\"\n}\n```\n\n| Field | Type | Required | Constraints |\n| -------------- | ------ | -------- | ------------------- |\n| `slug` | string | Yes | 1–64 characters |\n| `clientSecret` | string | Yes | 1–512 characters |\n| `email` | string | Yes | Valid email address |\n\n**Success Response (200):**\n\n```json\n{\n \"success\": true,\n \"data\": {\n \"accessToken\": \"eyJhbGciOiJSUzI1NiIs...\",\n \"expiresIn\": 3600,\n \"user\": {\n \"id\": 42,\n \"email\": \"user@example.com\",\n \"name\": \"Max\",\n \"surname\": \"Mustermann\"\n }\n },\n \"meta\": {\n \"timestamp\"\
: \"2026-04-15T12:00:00.000Z\",\n \"responseTime\": 120\n }\n}\n```\n\n**Error Responses:**\n\n| Status | Condition |\n| ------------------ | ----------------------------------------------- |\n| `401 Unauthorized` | Invalid slug or client secret |\n| `404 Not Found` | No user with this email exists for your partner |\n\n---\n\n## Protected API Endpoints\n\nAll protected endpoints require a valid JWT token in the `Authorization` header:\n\n```\nAuthorization: Bearer <accessToken>\n```\n\n### 3. Get User Profile\n\n| | |\n| -------- | --------------------- |\n| **URL** | `GET /api/v1/auth/me` |\n| **Auth** | Bearer token |\n\n**Response (200):**\n\n```json\n{\n \"success\": true,\n \"data\": {\n \"id\": 42,\n \"login\": \"maxmustermann_my-partner_ab12cd34\",\n \"email\": \"user@example.com\",\n \"name\": \"Max\",\n \"surname\": \"Mustermann\",\n \"role\"\
: \"user\",\n \"verified\": true\n }\n}\n```\n\n`id` is the same numeric user id that Register and Login return, and the value the white-label app passes as `userId` in your return URL (see [Return to partner](#description/return-to-partner-white-label)).\n\n---\n\n### 4. List Scenarios\n\nReturns all available tax scenarios, optionally filtered by year. Each scenario includes the current user's filings for that scenario.\n\n| | |\n| ---------------- | ---------------------------------------- |\n| **URL** | `GET /api/v1/scenarios` |\n| **Auth** | Bearer token |\n| **Query Params** | `year` (optional) — e.g., `2024`, `2025` |\n\n**Response (200):**\n\n```json\n{\n \"success\": true,\n \"data\": [\n {\n \"uuid\": \"a1b2c3d4-...\",\n \"name\": { \"en\": \"Standard Tax Return\", \"de\": \"Standard Steuererklärung\" },\n \"description\": { \"en\"\
: \"For employed individuals\", \"de\": \"Für Angestellte\" },\n \"year\": 2025,\n \"version\": 1,\n \"status\": \"active\",\n \"deadline\": \"2026-07-31T00:00:00.000Z\",\n \"filings\": [\n {\n \"uuid\": \"f1e2d3c4-...\",\n \"status\": \"inProgress\",\n \"statusChangedAt\": \"2026-04-10T08:30:00.000Z\",\n \"progress\": 45,\n \"createdAt\": \"2026-04-10T08:30:00.000Z\",\n \"updatedAt\": \"2026-04-14T12:00:00.000Z\"\n }\n ]\n }\n ]\n}\n```\n\n| Scenario Status | Description |\n| --------------- | ---------------------------- |\n| `active` | Open for new filings |\n| `review` | Under review, no new filings |\n| `inactive` | Closed |\n\n---\n\n### 5. List Filings\n\nReturns all filings belonging to the authenticated user.\n\n| | |\n| -------- | -------------------- |\n| **URL** | `GET /api/v1/filing`\
\ |\n| **Auth** | Bearer token |\n\n**Response (200):**\n\n```json\n{\n \"success\": true,\n \"data\": [\n {\n \"uuid\": \"f1e2d3c4-...\",\n \"status\": \"inProgress\",\n \"statusChangedAt\": \"2026-04-10T08:30:00.000Z\",\n \"completed\": false,\n \"year\": 2025,\n \"isJointFiling\": false,\n \"firstNamePersonA\": \"Max\",\n \"lastNamePersonA\": \"Mustermann\",\n \"firstNamePersonB\": null,\n \"lastNamePersonB\": null,\n \"scenario\": {\n \"uuid\": \"a1b2c3d4-...\",\n \"name\": { \"en\": \"Standard Tax Return\", \"de\": \"Standard Steuererklärung\" },\n \"description\": { \"en\": \"For employed individuals\", \"de\": \"Für Angestellte\" },\n \"year\": 2025\n },\n \"createdAt\": \"2026-04-10T08:30:00.000Z\",\n \"updatedAt\": \"2026-04-14T12:00:00.000Z\"\n }\n ]\n}\n```\n\n| Filing Status | Description |\n| ------------------ | ----------------------------------\
\ |\n| `inProgress` | User is filling out the form |\n| `prepared` | Form is complete, ready for review |\n| `identityVerified` | Identity has been verified |\n| `inReview` | Under review by AntX |\n| `submitted` | Submitted to the tax authority |\n| `deleted` | Deleted |\n\n---\n\n### 6. Create a Filing\n\nCreates a new tax filing for the user under a given scenario.\n\n| | |\n| -------- | --------------------- |\n| **URL** | `POST /api/v1/filing` |\n| **Auth** | Bearer token |\n\n**Request Body:**\n\n```json\n{\n \"scenarioUUID\": \"a1b2c3d4-...\"\n}\n```\n\n| Field | Type | Required | Description |\n| -------------- | ------------- | -------- | ------------------------------------------- |\n| `scenarioUUID` | string (UUID) | Yes | UUID of the scenario to create a filing for |\n\n**Success Response\
\ (201):**\n\nReturns the created filing in the same shape as the [List Filings](#description/5-list-filings) response (single object, not array).\n\n**Error Responses:**\n\n| Status | Condition |\n| ----------------- | ------------------------------------------ |\n| `400 Bad Request` | Scenario is inactive (`SCENARIO_INACTIVE`) |\n| `404 Not Found` | Scenario UUID not found |\n\n---\n\n### 7. Prefill a Filing\n\nSeeds a filing's answers with data you already hold (e.g. from accounting software, KYC, CRM) so the user opens a partially-completed return instead of a blank one. Best-effort: known keys are applied, unknown ones come back as warnings.\n\n| | |\n| -------- | ------------------------------------------ |\n| **URL** | `POST /api/v1/answer/{filingUUID}/prefill` |\n| **Auth** | Bearer token |\n\n**Behavior**\n\n- **Best-effort.** Valid\
\ fields are written; invalid ones produce per-key warnings in the response (no all-or-nothing failure).\n- **Upsert.** Calling again with the same field overwrites the previous prefill value.\n- **Partial.** Send only the fields you have. Omit anything you don't.\n- **Defaults, not answers.** Prefilled values are stored with `answered: false`, so progress stays at 0% until the user confirms each value during normal navigation. The user sees them as defaults they can change.\n- **Provenance.** While a value stays unconfirmed, question and answer responses report it under `status.prefilledFromPartner` (your partner slug), and the filing UI shows a \"Pre-filled from [partner]\" label beneath it. The marker is cleared as soon as the user confirms or edits the value.\n- **Filing must be writable.** Returns `409 FILING_READ_ONLY` for `inReview` / `submitted` filings, `410 Gone` for deleted filings.\n\n**Request Body**\n\nThe body is grouped into `personal`, `selfEmployment`, `crypto`, and\
\ `eur`. All groups and every field within them are **optional** — send only what you have.\n\nExample:\n\n```json\n{\n \"personal\": {\n \"firstName\": \"Max\",\n \"lastName\": \"Mustermann\",\n \"dateOfBirth\": \"1990-05-15\",\n \"taxId\": 12345678901,\n \"iban\": \"DE89370400440532013000\",\n \"address\": {\n \"street\": \"Chausseestraße\",\n \"houseNumber\": \"37\",\n \"zipCode\": \"10115\",\n \"city\": \"Berlin\",\n \"state\": \"Berlin\",\n \"country\": \"Germany\"\n }\n },\n \"selfEmployment\": {\n \"isSelfEmployed\": true,\n \"profession\": \"Software Developer\",\n \"revenue\": 85000,\n \"vatReceived\": 16150,\n \"phoneAndInternet\": 600,\n \"accountingCosts\": 1200,\n \"booksAndSoftware\": 350,\n \"equipmentItems\": [{ \"cost\": 1200, \"depreciationYears\": 3 }, { \"cost\": 450 }],\n \"otherCosts\": [{ \"description\": \"Cloud hosting\", \"amount\": 2400 }]\n }\n}\n```\n\nThe tables below list,\
\ for every field: its JSON type, the expected format, where to source the value on your side, and how AnyTax uses it.\n\n**`personal` fields**\n\n| Field | Type | Where to source it | Format & notes |\n| ------------- | ------ | ------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |\n| `firstName` | string | Your user account / profile data | Legal first name as it should appear on the tax return |\n| `lastName` | string | Your user account / profile data | Legal last name \
\ |\n| `dateOfBirth` | string | Your user account / KYC data | ISO 8601 (`YYYY-MM-DD`) |\n| `taxId` | number | Provided by the user — printed on Finanzamt letters and payslips (Steuer-IdNr.) | 11-digit German tax identification number, digits only |\n| `iban` | string | Provided by the user — the account the tax refund should be paid to | German IBAN (`DE` + 20 characters) |\n| `address` | object | Current residential address from your user profile | See subfields below. Determines the responsible Finanzamt, so it must be the user's registered home address |\n\n`address` subfields — `street`, `houseNumber`, `zipCode`, `city`, `state`, `country`\
\ are required when `address` is sent; `houseNumberSuffix` and `extraInfo` default to empty string. `state` is the German Bundesland of the address.\n\n**`selfEmployment` fields**\n\nAll amounts are annual totals for the filing's tax year, in euros. Source them from the user's bookkeeping / invoicing records in your product (issued invoices for income, categorized expense records for costs).\n\n| Field | Type | Where to source it | Notes |\n| ------------------- | ---------------- | ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |\n| `isSelfEmployed` | boolean | Whether the user ran a self-employed activity in the tax year | Gates the whole self-employment\
\ section |\n| `profession` | string | User profile / registration data | Professional title used for freelance work |\n| `businessName` | string | User profile / registration data | Registered business name, if any |\n| `businessTaxNumber` | string | Finanzamt correspondence of the business | Steuernummer for self-employment (often differs from personal Tax ID) |\n| `revenue` | number | Sum of net invoice amounts for the tax year | Total revenue \
\ |\n| `vatReceived` | number | VAT lines of issued invoices / USt records | VAT collected from clients |\n| `vatRefund` | number | Finanzamt VAT refunds received in the tax year | VAT refund received |\n| `costOfGoods` | number | Expense records, goods/materials category | Cost of raw materials / goods bought for resale |\n| `externalServices` | number | Expense records, subcontractor category | Payments to other freelancers / subcontractors |\n| `rentCosts` | number | Expense records,\
\ rent category | Office / co-working rent |\n| `separateRoomCosts` | number | Expense records, home-office room costs | Dedicated home-office room costs |\n| `workFromHomeDays` | number | User-confirmed count | Days worked from home |\n| `phoneAndInternet` | number | Expense records, communication category | Business phone + internet |\n| `trainingCosts` | number | Expense records, training category | Training, workshops, courses\
\ |\n| `accountingCosts` | number | Expense records, advisory category | Tax advisor / lawyer / bookkeeping software |\n| `marketingCosts` | number | Expense records, marketing category | Advertising and marketing |\n| `booksAndSoftware` | number | Expense records, supplies category | Books, software, office supplies |\n| `businessInsurance` | number | Expense records, insurance category | Business insurance \
\ |\n| `travelCosts` | number | Expense records, travel category | Flights, trains, public transport |\n| `hotelCosts` | number | Expense records, travel category | Hotel / accommodation for business trips |\n| `mealCosts` | number | Expense records, meals category | Business meals |\n| `carLeaseCosts` | number | Expense records, vehicle category | Annual car lease |\n| `otherCarCosts` | number | Expense\
\ records, vehicle category | Other car-related business costs |\n| `equipmentItems` | array of objects | Asset purchases of the tax year | Each item → one equipment instance. `{ cost, depreciationYears? }`. `depreciationYears` only relevant when `cost > 800`. |\n| `otherCosts` | array of objects | Expense records that fit no category above | Each item → one \"other cost\" instance. `{ description, amount }`. |\n\n**`crypto` fields**\n\nSource these values from the user's crypto tax report for the filing's tax year (the German tax report produced by the exchange / portfolio tracker). Each field maps to one line or section total of that report.\n\n| Field | Type | Where to source it (report line) \
\ | Notes |\n| --------------------------- | ------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |\n| `incomeTypes` | array of enum | The report's non-empty income sections: private sales, capital income, other/recurring income | Multi-select — send one enum value per income type present. See enum values below. |\n| `saleDescription` | string | Free text; use the report reference (e.g. `Refer cointracking report`) unless the user edits it | Description of the private sale income (§ 23 EStG) \
\ |\n| `saleRevenue` | integer | Private-sales section — total sale price within the 1-year holding period | Whole euros |\n| `saleAcquisitionCosts` | integer | Private-sales section — total acquisition costs of the sold assets | Whole euros |\n| `capitalGainsDomestic` | integer | Report value for Anlage KAP line 18 — gains from domestic exchanges | Whole euros |\n| `capitalGainsInternational` | integer | Report\
\ value for Anlage KAP line 19 — gains from international exchanges | Whole euros |\n| `capitalGainsForwardProfit` | integer | Report value for Anlage KAP line 21 — margin / derivatives / futures gains | Whole euros. **2024 tax year only** — when omitted, derived as `capitalGainsDomestic + capitalGainsInternational` (only if the sum is positive) |\n| `capitalGainsForwardLoss` | integer | Report value for Anlage KAP line 24 — margin / derivatives / futures losses | Whole euros. **2024 tax year only** |\n| `recurringDescription` | string | Free text; use the report reference (e.g. `Refer cointracking report`) unless the user edits it | Description of the recurring\
\ crypto income (§ 22 Nr. 3 EStG). Needed for 2024 filings; not required for 2025 |\n| `recurringRevenue` | integer | Other-income section total — sum of staking, lending, mining, airdrops, bonuses | Whole euros |\n| `capitalIncomeTypes` | array of enum | Optional — when omitted, AnyTax derives it from the capital-gains fields you send | Multi-select. See the derivation rules and enum values below. |\n\nAll money amounts are **whole-euro integers** — a fractional value is rejected with an `INVALID_VALUE_TYPE` warning and the field is skipped.\n\n`incomeTypes` enum values:\n\n| Value | Selects \
\ |\n| ----------------------------------- | ------------------------------------------------------------------------------ |\n| `income_from_sale_of_crypto_assets` | Private sale of crypto within the 1-year holding period (§ 23 EStG) |\n| `capital_income_from_crypto` | Crypto capital income (§ 20 EStG) |\n| `recurring_income_from_crypto` | Recurring crypto income — mining, staking, lending, airdrops (§ 22 Nr. 3 EStG) |\n\n`capitalIncomeTypes` enum values (send explicitly, or omit and let AnyTax derive them):\n\n| Value | Selected automatically when you send… |\n| ----------------------------------------- | ----------------------------------------------------------------------------------------- |\n| `domestic_crypto_capital_income` | `capitalGainsDomestic` \
\ |\n| `foreign_crypto_capital_income` | `capitalGainsInternational` |\n| `crypto_profit_from_forward_transactions` | any of `capitalGainsDomestic` / `capitalGainsInternational` / `capitalGainsForwardProfit` |\n| `crypto_loss_from_forward_transactions` | `capitalGainsForwardLoss` |\n\nThe two forward-transaction values only exist for **tax year 2024** filings. A derived selection is\nautomatically limited to the options the filing's tax year offers, so for a 2025 filing the\ncapital-gains fields select the domestic/foreign options only. Sending `capitalIncomeTypes`\nexplicitly with a value the tax year does not offer is rejected with an `INVALID_VALUE_TYPE`\nwarning and the field is skipped.\n\nExample:\n\n```json\n{\n \"crypto\": {\n \"incomeTypes\": [\"income_from_sale_of_crypto_assets\", \"recurring_income_from_crypto\"],\n \"saleDescription\"\
: \"Refer cointracking report\",\n \"saleRevenue\": 125192,\n \"saleAcquisitionCosts\": 131629,\n \"recurringDescription\": \"Refer cointracking report\",\n \"recurringRevenue\": 69\n }\n}\n```\n\n> AnyTax sets the underlying \"crypto details\" and \"crypto sale dates\" flags automatically whenever a `crypto` block is prefilled — you don't send these yourself: `crypto_details_tf` is set to true (the user provides detailed figures) and `crypto_sale_dates_tf` is set to false (per-transaction sale dates come from the report, not from manual entry). When no crypto data is sent, both flags stay unset.\n>\n> `capitalGainsForwardProfit` and `capitalGainsForwardLoss` only apply to tax year 2024 filings; for other years send the domestic/international gains only.\n>\n> Like every prefilled value, `crypto` fields carry the provenance marker described above and are shown in the filing UI with a \"Pre-filled from [partner]\" label until the user confirms or edits them.\n\n**`eur` block\
\ (Anlage EÜR + AVEÜR)**\n\nFills the user's EÜR (profit and loss statement for one business) from the tax year's bookkeeping. The block has the same fields as the `eur` answer, without `type` and `status`; the full schema is `PrefillEurDto` in the API reference. Unlike the other groups, the EÜR is written as a whole: each call replaces the previous EÜR prefill.\n\n| Field | Type |
# --- truncated at 32 KB (222 KB total) ---
# Full source: https://artifacts.apis.io/anytax/openapi/anytax-public-api-api-openapi.yml