Query metadata
Retrieve custom metadata (key-value pairs) for a specific open channel.
Request
POST: https://[Base URL](/platform-chat-api/base-url)/v4/open-channel/metadata/batch/get
Rate limit: 100 per second
Signature: Required. See API request signature.
Request body
Content type: application/json
| Parameter | Type | Required | Description |
|---|---|---|---|
channelId | String | Yes | The open channel ID. |
metadataKeys | String[] | No | Specific keys to query. Up to 100 keys. Omit to return all metadata. |
Request example
HTTP
POST /v4/open-channel/metadata/batch/get HTTP/1.1
Host: api.sg-light-api.com
App-Key: uwd1c0sxdlx2
Nonce: 14314
Timestamp: 1408710653491
Signature: 45beb7cc7307889a8e711219a47b7cf6a5b000e8
Content-Type: application/json
{
"channelId": "kvchatroom2",
"metadataKeys": ["Lnq9MJsPY", "Lnq88JsPY"]
}
Response
| Field | Type | Description |
|---|---|---|
code | Number | Return code. 0 indicates success. |
result.metadata | Array | Array of metadata entries. |
result.metadata[].key | String | Metadata key. |
result.metadata[].value | String | Metadata value. |
result.metadata[].userId | String | User ID that last set this key. |
result.metadata[].shouldAutoDelete | Number | Whether this key is deleted when the owner leaves. 0: keep. 1: delete. |
result.metadata[].updatedAt | Number | Timestamp (milliseconds) when this key was last updated. |
Response example
HTTP
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"code": 0,
"result": {
"metadata": [
{
"key": "key1",
"value": "value1",
"userId": "2121",
"shouldAutoDelete": 0,
"updatedAt": 1742457600000
},
{
"key": "key2",
"value": "value2",
"userId": "4343",
"shouldAutoDelete": 1,
"updatedAt": 1742457600000
}
]
}
}