- HTTP-based Kafka Operations: Manage topics, produce/consume messages, and administer your cluster using any language and standard tools like curl, without needing native Kafka client libraries.
- Full Protocol Compatibility: Faithfully supports the Kafka protocol, ensuring seamless integration and expected behavior for all standard operations.
- Built-in Security: Integrated with StreamNative’s authentication and authorization systems
- Multi-tenancy Support: Native support for StreamNative’s tenant/namespace isolation model
Prerequisites
Before using the Kafka REST API, ensure you have:- A StreamNative Cloud account with an active Kafka-enabled cluster
- Appropriate permissions to create service accounts and manage Kafka resources
- Basic familiarity with REST APIs and HTTP tools like
curl
Step 1: Create a service account
Currently, you can’t edit a service account. If you need a service account to have Super Admin access, make sure to enable it when creating the service account. By default, service accounts do not have Super Admin enabled.
- On the left navigation pane, click Service Accounts.
- Click Create Service Account.
- (Optional) Select Super Admin to grant the service account with Super admin access to a namespace or tenant.
- Enter a name for the service account, and then click Confirm.
Step 2: Create an API key for your service account
Before using an API key, verify that the service account is authorized to access the resources, such as tenants, namespaces, and topics.
Step 3: Grant service account permissions
If you use a Super Admin service account, you can skip this step because a Super Admin service account already has the required permissions.
Step 4: Get the HTTP Service URL of your StreamNative cluster
To get the service URL(s) of a StreamNative cluster, follow these steps.- Navigate to the Cluster Dashboard page by switching to the cluster workspace.
- On the Cluster Dashboard page, click Details tab.
- You will see the available service URLs in the Access Points area.
- You can click Copy at the end of the row of the service URL that you want to use.
For the Kafka REST API, you need to use the HTTP Service URL (TLS) endpoint.
Step 5: Get topic list
The following example shows how to list topics using the Kafka REST API. For a complete list of all available API, see the full Kafka REST API Reference.Never hardcode authentication tokens in your applications. Instead:
- Store tokens in secure environment variables or secret management systems
- Implement token rotation policies to regularly refresh credentials
- Use service accounts with minimal required permissions following the principle of least privilege
- Always use HTTPS (TLS) endpoints to encrypt data in transit