Skip to content

Authorize one direct P2P streaming room on the signalling relay (Pro+).

POST
/v1/p2p/rooms
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).

Media typeapplication/json
object
room
required

Public room half of the pairing code (4-64 alphanumeric).

string
role
required
string
Allowed values: send recv

Room authorized.

Media typeapplication/json
object
room
string
role
string
Allowed values: send recv
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"
}

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"
}
}