nimeet 文档中心
English

Token 与 uid 映射

构建时从公开 REST 接口定义的 `tokens` 标签生成:方法、路径、参数、请求体、响应与 curl。

由公开 REST 接口定义生成

版本 v1.1.0 · 更新于 2026-10-26 · 修订 1

分组概览

本页由公开 REST 接口定义在构建时生成:标签 tokens,共 5 个操作(全量 189 个)。鉴权、信封与分页约定见 REST API 总览.

方法路径摘要
GET/v1/meta/privilegesPrivilege catalogue per role
POST/v1/tokensIssue a channel token
POST/v1/tokens/renewRenew a token
GET/v1/tokens/verifyVerify a token and return its payload
POST/v1/uids:resolveResolve rtc uids to IM user ids

操作详情

GET /v1/meta/privileges

Privilege catalogue per role

鉴权:项目凭证(customerId:customerSecret 的 Base64)

响应

状态码说明 / schema
200privilege catalogue per role — object{ privileges, roles }

调用示例

bash
curl -s -X GET "$NIMEET_API_BASE/v1/meta/privileges" \
  -H "Authorization: Basic $NIMEET_CUSTOMER_BASIC"

POST /v1/tokens

Issue a channel token

getRTCTokenInfo implementation for the IM RTC Provider. Wildcard tokens (channelName: "*" or wildcard: true) are allowed; uid may be supplied explicitly or derived from userId.

鉴权:项目凭证(customerId:customerSecret 的 Base64)

请求体

字段类型必填说明
channelNamestring
channelstringalias of channelName
uidinteger1..2147483647
userIdstringIM user id; when supplied the rtcUid is derived and bound
roleenum(host | audience)默认 "host"
ttlSecondsinteger60..86400
wildcardboolean
json
{
  "channelName": "weekly-sync",
  "uid": 10001,
  "role": "host",
  "ttlSeconds": 3600
}

响应

状态码说明 / schema
200issued — TokenIssueResponse
400Invalid parameter — Error
401Missing/invalid credentials — Error
403Banned or service not enabled — Error
415Content-Type must be application/json — Error

调用示例

bash
curl -s -X POST "$NIMEET_API_BASE/v1/tokens" \
  -H "Authorization: Basic $NIMEET_CUSTOMER_BASIC" \
  -H "Content-Type: application/json" \
  -d '{"channelName":"weekly-sync","uid":10001,"role":"host","ttlSeconds":3600}'

POST /v1/tokens/renew

Renew a token

Accepts a token within its renewal grace window and returns a fresh token with the same channel, uid and (non-escalated) privileges.

鉴权:项目凭证(customerId:customerSecret 的 Base64)

请求体

字段类型必填说明
tokenstring是
json
{
  "token": "$RTC_TOKEN"
}

响应

状态码说明 / schema
200renewed — TokenIssueResponse
400Invalid parameter — Error
401Missing/invalid credentials — Error

调用示例

bash
curl -s -X POST "$NIMEET_API_BASE/v1/tokens/renew" \
  -H "Authorization: Basic $NIMEET_CUSTOMER_BASIC" \
  -H "Content-Type: application/json" \
  -d '{"token":"$RTC_TOKEN"}'

GET /v1/tokens/verify

Verify a token and return its payload

鉴权:项目凭证(customerId:customerSecret 的 Base64)

参数

名称位置必填类型说明
tokenquery是string
channelNamequerystring

响应

状态码说明 / schema
200valid — object{ valid, payload }
400Invalid parameter — Error
401Missing/invalid credentials — Error

调用示例

bash
curl -s -X GET "$NIMEET_API_BASE/v1/tokens/verify?token=%24RTC_TOKEN&channelName=weekly-sync" \
  -H "Authorization: Basic $NIMEET_CUSTOMER_BASIC"

POST /v1/uids:resolve

Resolve rtc uids to IM user ids

getUserIdsWithRTCUids implementation. Partial results are returned; unknown uids are omitted.

鉴权:项目凭证(customerId:customerSecret 的 Base64)

请求体

字段类型必填说明
rtcUidsarray<integer>是最多 200 项
channelNamestring
json
{
  "rtcUids": [
    10001,
    10002,
    99999
  ],
  "channelName": "weekly-sync"
}

响应

状态码说明 / schema
200mapping keyed by uid — object
400Invalid parameter — Error
401Missing/invalid credentials — Error

调用示例

bash
curl -s -X POST "$NIMEET_API_BASE/v1/uids:resolve" \
  -H "Authorization: Basic $NIMEET_CUSTOMER_BASIC" \
  -H "Content-Type: application/json" \
  -d '{"rtcUids":[10001,10002,99999],"channelName":"weekly-sync"}'

本分组用到的 Schema

Error — object{ code, message, reason, sdkCode, details }
字段类型必填说明
codestring是stable machine code, see errors.json
messagestring是
reasonstring
sdkCodeintegerAgora-aligned client error number
detailsobject
TokenIssueResponse — object
字段类型必填说明
appIdstring是
channelNamestring是
rtcTokenstring是
rtcUidinteger是1..2147483647
roleenum(host | audience)是
privilegesarray<string>是
controlTokenstringOpaque control-plane token for REST diagnostics/renewal. TokenIssueResult.controlToken is optional; toResult() always sets it.
mediaRoomstringSFU room name when the media adapter namespaces by App ID (TokenIssueResult.mediaRoom).
expireAtstring是format date-time
privilegeExpireAtstring是format date-time

本页由文档构建流水线生成 · 2026-10-31 01:24:02 UTC · 文档中心 v1.1.0.

内容依据公开 API 定义.

ni-meet 是自建 RTC PaaS,媒体面基于 LiveKit(Apache-2.0),并与声网 API 兼容。