Get Turn Credentials

Generate temporary TURN credentials for WebRTC clients using the authenticated community API key.

GET https://api.sonorancad.com/v2/general/turn

Rate limit: 20 requests per minute Authenticated v2 endpoints are rate limited per API key rather than per IP address.

Generate temporary TURN credentials for Sonoran CAD WebRTC clients. This route uses normal v2 API authentication and does not require a paid plan.

Query Parameters

Name
Type
Required
Description

userId

string

No

Optional user identifier appended to the generated TURN username. Colons are normalized to underscores.

Example Request

-- luarocks install sonoran.lua
-- For SonoranCADFiveM in-game usage, see the SonoranCADFiveM tab for the export-based client.
local Sonoran = require("sonoran")

local sonoran = Sonoran.createClient({
  product = Sonoran.productEnums.CAD,
  communityId = "YOUR_COMMUNITY_ID",
  apiKey = "YOUR_API_KEY",
  defaultServerId = 1
})

local response = sonoran.cad:getTurnCredentialsV2({
  userId = "unit-1"
})

print(response.success)
print(response.data and response.data.ttl)

Response

Successful requests return application/json.

Last updated

Was this helpful?