You need to enable JavaScript to run this app.
Message Queue for Kafka

Message Queue for Kafka

Copy page
Download PDF
Topic management
DescribeTopicPartitions - View Topic partitions
Copy page
Download PDF
DescribeTopicPartitions - View Topic partitions
Call the DescribeTopicPartitions API to get the Topic's partition information.​
Instructions​
The DescribeTopicPartitions API offers paged queries to view the number of partitions of a specified Topic, partition ISR status, and other details.​
Debug​
API Explorer
You can initiate calls online through API Explorer without paying attention to the signature generation process and quickly obtain the call results.
​
Request parameters​
Only the unique request parameters of this interface and some common parameters are listed below. For more information, see common parameters.​
Action string required Example value: DescribeTopicPartitions​
Operation to execute, value: DescribeTopicPartitions.​
​
Version string required Example value: 2022-05-01​
API version, value: 2022-05-01.​
​
InstanceId string required Example value: kafka-cnngbnntswg1****x​
Instance ID.​
​
TopicName string required Example value: my_topic​
Topic name.​
​
PageNumber integer required Example value: 1​
Page number of the list, minimum value is 1.​
​
PageSize integer required Example value: 10​
The number of items per page in the list, ranging from 1 to 100.​
​
PartitionIds integer[] No Example value: [1,2]​
Partition ID. If not specified, information for all partitions is returned.​
​
UnderInsyncOnly boolean No Example: true​
Query only partitions with unsynced replicas, default is false.​
  • true: Query only partitions with unsynced replicas.​
  • false: (default) Query all partitions.​
​
​
​
Response parameters​
Only the unique response parameters of this API are listed below. For more details, see response structure.​
Total integer Example value: 2​
Total number of partitions matching the query conditions.​
​
PartitionsInfo object[] Example value: --​
List of partitions matching the query criteria.​
PartitionId integer Example value: 0​
Partition number.​
​
Leader integer Example value: 2​
Partition leader ID.​
​
Replicas integer[] Example value: [2,0,1]​
The replica list of the partition.​
​
InsyncReplicas integer[] Example value: [2, 0, 1]​
List of synchronized replicas for the partition.​
​
UnderInsyncReplicas integer[] Example value: []​
Out-of-sync replica list.​
​
StartOffset long Example value: 7758654122​
Offset of the earliest message currently held by the partition leader.​
​
EndOffset long Example value: 7774940552​
The offset of the next message for the partition leader. The current latest message position is EndOffset - 1.​
​
MessageCount long Example value: 16286430​
The current number of messages within the partition leader. Where MessageCount = EndOffset - StartOffset.​
​
​
​
​
Request example​
​
POST /?Action=DescribeTopicPartitions&Version=2022-05-01 HTTP/1.1​
Content-Type: application/json​
Host: kafka.volcengineapi.com​
X-Date: 20210328T100802Z​
Authorization: HMAC-SHA256 Credential=AK********/20210328/cn-beijing/Kafka/request, SignedHeaders=x-date, Signature=********​
​
{​
"InstanceId": "kafka-cnngbnntswg1****",​
"TopicName": "my_topic",​
"PageNumber": 1,​
"PageSize": 1​
}​
​
Response example​
​
{​
"ResponseMetadata": {​
"RequestId": "2023022720063227B3DCC115F59769D448",​
"Action": "DescribeTopicPartitions",​
"Version": "2022-05-01",​
"Service": "Kafka",​
"Region": "cn-beijing"​
},​
"Result": {​
"PartitionsInfo": [​
{​
"EndOffset": 7774940552,​
"InsyncReplicas": [​
2,​
1,​
0​
],​
"Leader": 2,​
"MessageCount": 16286430,​
"PartitionId": 0,​
"Replicas": [​
2,​
1,​
0​
],​
"StartOffset": 7758654122,​
"UnderInsyncReplicas": []​
}​
],​
"Total": 2​
}​
}​
​
Error code​
The following table lists error codes related to this interface and business logic. Refer to the Public error codes section for common error codes.​
​
Status code​
Error code​
Error message​
Specifications​
400​
InvalidParameter​
The specified parameter is not valid.​
Invalid parameter value.​
403​
OperationDenied.AccountNotAuthorized​
You are not authorized to perform this operation.​
You are not authorized. Authorize or switch accounts and try again.​
403​
OperationDenied.InvalidInstanceStatus​
The operation is not valid for the current status of the instance.​
The current instance state does not allow this operation.​
403​
OperationDenied.InvalidTopicStatus​
The operation is not valid for the current status of the topic.​
The current Kafka topic status does not allow this operation.​
404​
InvalidInstanceId.NotFound​
The specified Instance ID does not exist.​
Instance does not exist.​
404​
InvalidTopicName.NotFound​
The specified topic does not exist.​
Topic does not exist.​
500​
InternalError​
The request failed due to some unknown error, exception or failure.​
Internal error, please try again later.​
​
​
Last updated: 2025.06.30 12:00:29