Create topic

Prev Next

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
  • Enter in prefix-name format.
  • Enter up to 200 characters by combining lowercase English letters, numbers, and special character "-".
  • See Get topic name prefix.
  • e.g, if the topic name prefix is h4j6l- and the name to set is ds001: Enter as h4j6l-ds001.
description String Optional Topic description (up to 200 characters)
partitions Number Optional Number of topic partitions
  • 1-16 (default: 1)
retentionMs Number Optional Topic partition message retention period (millisecond)
  • 3600000-1296000000 (default: 86400000)

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
  • CREATING | CREATED
    • CREATING: Topic being created
    • CREATED: Topic creation completed (active)
tcpEndpoint String - TCP endpoint
createdDate String - Topic creation date and time
  • ISO 8601 format
  • YYYY-MM-DDThh:mm:ssZ
updatedDate String - Topic modification date and time
  • ISO 8601 format
  • YYYY-MM-DDThh:mm:ssZ

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"
}