VideoRayan API
Three steps to a live visit: create the visit → mint a token per role → connect your UI. The full OpenAPI contract is served by the engine itself.
Authentication
Your platform receives an API key (rtck_...) and sends it in the header. Keep it server-side only — never distribute it inside client apps.
Authorization: Bearer rtck_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Public routes (/public/*, /guest/*) are keyless — they power the web panel.
The visit lifecycle
Create the visit
POST /v1/rooms with an Idempotency-Key — replaying the key returns the same visit, so duplicates are impossible.Mint a token per role
POST /v1/rooms/{id}/tokens with role doctor / patient / secretary — one seat per role per visit.Connect to the roomHand token + wsUrl to any LiveKit SDK (web, Android, iOS) or redirect users to our web room.
End & eventsEnd with DELETE; a signed webhook also notifies your system when the visit finishes.
Endpoints
| Method | Path | Purpose |
|---|---|---|
| POST | /v1/rooms | Create a visit (externalId, subject, expiresInSeconds) |
| GET | /v1/rooms/{id} | Visit status |
| POST | /v1/rooms/{id}/tokens | Mint a token with role doctor / patient / secretary |
| GET | /v1/rooms/{id}/participants | Live participant list |
| DELETE | /v1/rooms/{id}/participants/{pid} | Remove a participant |
| DELETE | /v1/rooms/{id} | End the visit (all tokens immediately invalidated) |
| POST | /v1/public/rooms | Keyless public visit (name = permanent link) |
| POST | /v1/guest/rooms/{ref}/tokens | Guest join with role |
| GET | /v1/health · /v1/ready · /v1/whoami | Liveness, readiness, key check |
Code samples
API=https://api.example.ir/v1
KEY=rtck_...
# 1) Create the visit
ROOM=$(curl -s -X POST $API/rooms \
-H "Authorization: Bearer $KEY" \
-H "Idempotency-Key: appt-4821" \
-H "Content-Type: application/json" \
-d '{"externalId":"appt-4821","subject":"Follow-up visit"}' | jq -r .roomId)
# 2) One token per role
for ROLE in doctor patient secretary; do
curl -s -X POST $API/rooms/$ROOM/tokens \
-H "Authorization: Bearer $KEY" \
-H "Content-Type: application/json" \
-d "{\"identity\":\"user-$ROLE\",\"role\":\"$ROLE\",\"ttlSeconds\":3600}"
done
# 3) End the visit
curl -s -X DELETE $API/rooms/$ROOM -H "Authorization: Bearer $KEY"
Error codes
| Code | Meaning | Recommended handling |
|---|---|---|
400 invalid_input | Invalid field | Fix the payload |
401 unauthorized | Bad or missing key | Check the key |
404 room_not_found | Visit missing/expired (cross-platform existence is never revealed) | Create the visit again |
409 room_full | 3-seat capacity reached | Reject the 4th participant |
409 role_taken | That role seat is occupied | Use another role or the seat owner's identity |
409 room_expired | Visit expired or ended | Create a new visit |
429 rate_limited | >120 requests/min | Retry with backoff (Retry-After) |
403 wrong_password | Wrong visit password | Ask the visit owner |
Rules of thumb: tokens are join-only, valid ≤1 hour, non-renewable (mint again for the same person — no new seat consumed). Max body size 64 KB.
End-of-visit webhook
When a visit ends (by command or automatically), your system is notified so it can update the appointment. Each event carries a verifiable JWT signature.
POST https://your-system.example.com/video/webhook
Content-Type: application/json
{
"event": "room_finished",
"roomId": "…",
"externalId": "appt-4821",
"endedAt": "2026-11-26T09:12:00Z"
}