# Test endpoints and test data

The test environment is where you build and try an integration with test data, without touching real people or real money. It also has test endpoints that create or change test data. The production API reference lists them too, but they are meant for test.
Examples use the **test** environment; see [Environments](https://code.salaxy.com/get-started/environments.md) for demo and production.

*Diagram: Your integration builds against the test environment, which holds test data only and has extra test endpoints for creating accounts, setting tax card data and triggering a tax invoice. Test and demo share the same data. When the integration is ready you switch the hosts to production, which has the same API and real data. Your code does not call the test endpoints there. (Build against test. Test endpoints help you create data; in production your code does not call them.)*

## What the test environment is for

- **Test and demo share the same data.** Data created in one is visible in the other. Use fake data only, never real people's data. See [Environments](https://code.salaxy.com/get-started/environments.md).
- **Test runs the latest development code.** An endpoint may exist in test before production. The test endpoints below are marked **v04 beta**: they may change.
- **Get a test account first.** See [Get a test account](https://code.salaxy.com/get-started/test-account.md) and [Create an account](https://code.salaxy.com/get-started/rest/create-account.md). A test company account works in both test and demo.
- **Some jobs do not run on their own in test.** If your flow needs a scheduled job, for example the [monthly cycle](https://code.salaxy.com/integration/monthly-cycle.md), ask Salaxy to trigger it. See [Support](https://code.salaxy.com/get-started/support.md).

## Test endpoints in v03

These are in the [Test](https://code.salaxy.com/reference/rest/test.md) and [TestData](https://code.salaxy.com/reference/rest/testdata.md) tag pages. The ones that change data work in the test environment only.

| Method | Path | Purpose |
|---|---|---|
| `POST` | `/v03/api/test/accounts` | Creates a test account from an `Onboarding` object and returns the account details. For a person, fill in names and personal ID. For a company, fill in the company id, type and name, and the contact person. Test environment only |
| `DELETE` | `/v03/api/test/accounts/{id}` | Deletes a test account. Test environment only |
| `POST` | `/v03/api/test-data/taxcard-api` | Sets the data that the tax card API returns for a personal ID, so you can test [tax cards](https://code.salaxy.com/integration/tax-cards.md) without a real card. Body: `TaxcardInput` |
| `GET` | `/v03/api/test-data/taxcard-api/{personalId}` | Reads the tax card data set for a personal ID |
| `GET` | `/v03/api/test/delay` | Waits for the given number of seconds and returns it. For testing a long request. Test environment only |
| `GET` | `/v03/api/test/user-name` | The user name of the current user. Requires a token |
| `GET` | `/v03/api/test/user-name-allow-anon` | The user name, or `Anonymous` without a token |
| `GET` | `/v03/api/test/authorization` | A welcome message that requires a token. Use it to check that your authentication works |
| `GET` | `/v03/api/test/hello/{message}` | Returns the message. A call that needs no token |
| `GET` | `/v03/api/test/exceptions/{type}` | Throws an exception, for testing your error handling. See [Errors](https://code.salaxy.com/reference/errors.md) |

The rest of the Test tag (`values`, `serialization`, `odata`, `text/{lang}/{key}`, `testList`, `metrics/{name}`, `federation`, `token`, `testNullableBoolean`) are helpers for serialisation and platform tests. See the [Test](https://code.salaxy.com/reference/rest/test.md) tag page.

```http
POST https://test-secure.salaxy.com/v03/api/test-data/taxcard-api
Content-Type: application/json

{
  "personalId": "190372-942M",
  "forYear": 2026
}
```

## Reset and seed

There is no single "reset" endpoint. The stated ways to control test data are:

- **Create what you need.** Create test accounts, employees and calculations through the normal endpoints; see [Create an account](https://code.salaxy.com/get-started/rest/create-account.md).
- **Delete a test account** with `DELETE /v03/api/test/accounts/{id}` when you want to start again.
- **Set tax card data** with `POST /v03/api/test-data/taxcard-api` before you test a tax card lookup.

If you need other seed data, ask Salaxy; see [Support](https://code.salaxy.com/get-started/support.md).

## Test helpers in v04 beta

These work in the test environment only. They may change. Read their request and response models in the [v04 reference](https://code.salaxy.com/reference/rest-api-v04.md).

| Area | Paths | Purpose |
|---|---|---|
| Tax invoice | `POST /v04/api/test/invoices/tax` | Rebuilds the current company's Tax invoice for a month from the month's paid salaries and releases it to the payment channel at once, also for the current month. Lets you test the tax payment without waiting for the monthly run. A read or paid Tax invoice blocks the rebuild: cancel it first. Also at `POST /v03/api/test/invoices/tax` |
| Company authorisation | `POST /v04/api/company-authorization/link/test` | Creates a start link without credentials, naming the partner in the request. The flow the link starts is identical to production, so what you test is what ships. In production, use `POST /v04/api/company-authorization/link` |

Other new endpoints, such as payment messages, the data funnel, the Pro workbench and the report table, are not test endpoints: they work in test and production alike. See [Versions](https://code.salaxy.com/reference/versions.md) and [Payment channels](https://code.salaxy.com/integration/payment-channels.md#payment-messages-v04-beta).

## Checklist

- You build and test against the test environment and use fake data only.
- Production hosts are in configuration, not in code: you switch them when you go live.
- Your code does not call a test endpoint in production.
- You treat the v04 test helpers as beta.
