Available in VPC
Create a topic.
Request
This section describes the request format. The method and URI are as follows:
| Method | URI |
|---|---|
| POST | /api/v1/topics |
Request headers
For information about the headers common to all Data Stream APIs, see Data Stream request headers.
Request body
You can include the following data in the body of your request:
| Field | Type | Required | Description |
|---|---|---|---|
name |
String | Required | Topic name
|
description |
String | Optional | Topic description (up to 200 characters) |
partitions |
Number | Optional | Number of topic partitions
|
retentionMs |
Number | Optional | Topic partition message retention period (millisecond)
|
Request example
The request example is as follows:
curl --location --request POST 'https://datastream.apigw.ntruss.com/api/v1/topics' \
--header 'x-ncp-apigw-timestamp: {Timestamp}' \
--header 'x-ncp-iam-access-key: {Access Key}' \
--header 'x-ncp-apigw-signature-v2: {API Gateway Signature}' \
--data '{
"name": "h4j6l-ds001",
"description": "Data Stream Topic",
"partitions": 1,
"retentionMs": 86400000
}'
Response
This section describes the response format.
Response body
The response body includes the following data:
| Field | Type | Required | Description |
|---|---|---|---|
topicId |
String | - | Topic ID |
topicName |
String | - | Topic name |
description |
String | - | Topic description |
partitions |
Number | - | Number of topic partitions |
retentionMs |
Number | - | Topic partition message retention period (millisecond) |
status |
String | - | Topic status
|
tcpEndpoint |
String | - | TCP endpoint |
createdDate |
String | - | Topic creation date and time
|
updatedDate |
String | - | Topic modification date and time
|
Response status codes
For information about the HTTP status codes common to all Data Stream APIs, see Data Stream response status codes.
Response example
The response example is as follows:
{
"topicId": "jkH8v*****",
"topicName": "h4j6l-ds001",
"description": "Data Stream Topic",
"partitions": 1,
"retentionMs": 86400000,
"status": "CREATED",
"tcpEndpoint": "sample-cluster.datastream.naverncp.com:{PORT}",
"createdDate": "2025-05-28T17:29:21Z",
"updatedDate": "2025-05-28T17:29:21Z"
}