> ## Documentation Index
> Fetch the complete documentation index at: https://docs.link4sync.com/llms.txt
> Use this file to discover all available pages before exploring further.

# API overview

> Manage your Link4Sync topics from code with the Public API.

The Public API lets your services list, create, and delete topics. Every endpoint is described in the **API reference** in the sidebar, generated from the same OpenAPI description the server uses to validate requests.

| | |
| - | - |
| **Base URL** | `https://api.link4sync.com/v1` |
| **Format** | JSON requests and responses |
| **OpenAPI description** | [api.link4sync.com/v1/openapi.json](https://api.link4sync.com/v1/openapi.json) |

> [!NOTE]
>
> Messages do not go through this API. Publish through the topic’s [connections](https://docs.link4sync.com/en/connections.md)
> and read by subscribing to `<topic ID>/out`, see [Read messages](https://docs.link4sync.com/en/read-messages.md).

## Authentication

Send a Keycloak access token in the `Authorization` header:

```http theme={null}
Authorization: Bearer <access token>
```

| Token | How to get it | Can do |
| - | - | - |
| **Account token** | Your Link4Sync email and password, client `kafka-connect-access` | List, create, and delete your topics. |
| **Subaccount token** | Client credentials of a [subaccount](https://docs.link4sync.com/en/manage/subaccounts.md) | List the subaccount's topics. |

```sh theme={null}
TOKEN=$(curl -s https://auth.link4sync.com/realms/link4sync/protocol/openid-connect/token \
  -d grant_type=password -d client_id=kafka-connect-access \
  --data-urlencode "username=$LINK4SYNC_EMAIL" \
  --data-urlencode "password=$LINK4SYNC_PASSWORD" | jq -r .access_token)
```

Tokens are short-lived. Request a new one when you get `401`. Your account must have accepted the current terms in the dashboard; otherwise requests answer `403`.

## Examples

```sh theme={null}
# List your topics
curl -s https://api.link4sync.com/v1/topics -H "Authorization: Bearer $TOKEN"

# Create a topic
curl -s -X POST https://api.link4sync.com/v1/topics \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name": "orders"}'

# Delete a topic and its messages
curl -s -X DELETE https://api.link4sync.com/v1/topics/orders -H "Authorization: Bearer $TOKEN"
```

A new topic gets its connection addresses and credentials in the dashboard, as if you had created it there.

## Errors

Errors return a JSON body with a short description:

```json theme={null}
{ "error": "Topic not found" }
```

| Status | Meaning |
| - | - |
| `400` | The request does not match the API description, for example an invalid topic name. |
| `401` | The token is missing, invalid, or expired, or the subaccount was deleted. |
| `403` | This token may not do this, the plan does not allow it, or the terms are not accepted. |
| `404` | The topic does not exist or is not available to this token. |
| `409` | The topic already exists, or an immutable topic still holds locked messages. |
| `429` | Too many requests. Wait the number of seconds in `Retry-After`. |
| `502`, `503` | A temporary problem. Retry later. |

## Limits

| Limit | Value |
| - | - |
| Requests per token | 120 per minute |
| Topic creations and deletions | 10 per minute |
| Requests per IP address | 300 per minute |

Plan limits also apply, for example the number of topics on Basic.

## Versioning

The version is part of the path. Changes that could break your code come in a new version (`/v2`); `/v1` only gains new optional fields and endpoints.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.