Authorize one direct P2P streaming room on the signalling relay (Pro+).
POST
/v1/p2p/rooms
const url = 'https://api.share2.us/v1/p2p/rooms';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"room":"example","role":"send"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.share2.us/v1/p2p/rooms \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "room": "example", "role": "send" }'Enforces the p2p_streaming_enabled entitlement and rate-limits rooms per account, then mints a short-lived capability the relay verifies. Only the PUBLIC half of the pairing code is sent — the secret half never leaves the client, which is what stops a malicious relay from MITM-ing the transfer (ADR-019).
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
room
required
Public room half of the pairing code (4-64 alphanumeric).
string
role
required
string
Responses
Section titled “Responses”Room authorized.
Media typeapplication/json
object
room
string
role
string
token
Short-lived capability the relay verifies.
string
expires_at
string format: date-time
relay_url
Signalling relay to dial (wss://…).
string
ice_servers
Array<object>
object
urls
Array<string>
username
string
credential
string
Example
{ "role": "send"}The account’s plan does not include P2P streaming (p2p_streaming_not_allowed).
Media typeapplication/json
object
status
required
string
Example
{ "status": "ok"}Too many rooms for this account (rate_limited).
Media typeapplication/json
object
status
required
string
Example
{ "status": "ok"}default
Section titled “default”Standard error envelope.
Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
request_id
required
string
Example
{ "error": { "code": "quota_exceeded" }}