Prepare to enter a space
const url = 'https://spaces.work.optidata.cloud/api/spaces/a3051110-3152-412d-a015-6d0228be403e/joins/setup';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"participant_name":"example"}'};
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://spaces.work.optidata.cloud/api/spaces/a3051110-3152-412d-a015-6d0228be403e/joins/setup \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "participant_name": "example" }'Returns what the Spaces client needs to put the caller inside the space:
a short-lived entry token (join_token, valid for 60 seconds),
the address of the realtime server (colyseus_url) and of the Spaces
client (frontend_url), the world to load, the caller’s name, role and
avatar, and what the caller may do there.
Ask for a new setup every time you enter; do not store the token.
Archived spaces cannot be entered (403).
Authorizations
Section titled “Authorizations”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters”The space’s uuid or hash.
Request Body
Section titled “Request Body”object
Display name for a guest. Signed-in users always appear under their Optiwork name.
Examplegenerated
{ "participant_name": "example"}Responses
Section titled “ Responses ”Everything needed to enter the space.
object
object
The world to load — a world identifier, or a built-in office.
The realtime room of the space.
Address of the realtime server.
Entry token for the realtime server. Valid for 60 seconds.
Address of the Spaces client.
Your company’s identifier.
The caller’s avatar.
Whether the caller may edit the world — anywhere for builders, inside their groups’ areas for everyone else.
The ids of the caller’s groups, as used as keys of group_areas.
object
Examples
{ "space_id": 2, "setup_info": { "space_uuid": "a3051110-3152-412d-a015-6d0228be403e", "space_hash": "a3051110-31f8-4b91-8026-owt42-e19896afc357", "map": "a28e5bf3-26b4-4a34-9f98-9a116a2700ca", "map_source": "tenant", "map_version": 8, "room_name": "owt42:a3051110-31f8-4b91-8026-owt42-e19896afc357", "colyseus_url": "wss://spaces-mpws.work.optidata.cloud:443", "join_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJPcHRpd29yayBTcGFjZXMifQ.c2lnbmF0dXJl", "frontend_url": "https://spaces-mp.work.optidata.cloud/?via=link", "tenant": "owt42", "space_name": "Acme HQ", "participant_name": "Ana Souza", "participant_role": "owner", "skin": "premade:04", "has_skin_preference": true, "available_skins": [ "premade:01", "premade:02", "premade:03", "premade:04" ], "is_custom_skin_accepted": true, "profile_photo_url": "https://spaces.work.optidata.cloud/vendor/opticloud/images/user-default.svg", "is_super_admin": false, "is_builder": true, "can_edit": true, "group_ids": [], "features": { "chat_enabled": true, "max_participants_per_space": 30 }, "locale": "en" }}No authentication key was sent.
Authentication failures use an error key rather than message.
object
Examples
No bearer token sent
{ "error": "JWT passport exception: Missing bearer token in request"}The space is archived, or belongs to another company.
object
Examples
{ "message": "This space has been archived."}Nothing has this identifier.
object
Examplegenerated
{ "message": "example"}The authentication key is expired or not recognised. Get a fresh one and retry.
Authentication failures use an error key rather than message.
object
Examples
{ "error": "JWT passport expired: Passport expired"}The body failed validation.
object
The first validation message.
Validation messages keyed by field name.
object
Examplegenerated
{ "message": "example", "errors": { "additionalProperty": [ "example" ] }}