Skip to content

Create a world

POST
/spaces/maps
curl --request POST \
--url https://spaces.work.optidata.cloud/api/spaces/maps \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "name": "Head office — new meeting rooms" }'

Creates a draft world. Without data, it starts from a blank office with every layer the Spaces client expects. Builders only. name must be unique within the company.

Media typeapplication/json
object
name
required
string
>= 1 characters <= 120 characters
data

A Tiled map in its JSON format (orthogonal, 32×32 tiles). It must carry type, width, height, tilewidth, tileheight and layers. The Spaces client reads a Ground tile layer and the object layers Wall, Chair, Objects, ObjectsOnCollide, GenericObjects, GenericObjectsOnCollide, Computer, Whiteboard, Basement and VendingMachine; the easiest way to get a valid document is to create a world without data and edit the blank one it returns.

object
type
required
string
Allowed value: map
width
required
integer
height
required
integer
tilewidth
required
integer
tileheight
required
integer
layers
required
Array<object>
object
key
additional properties
any
tilesets
Array<object>
object
key
additional properties
any
key
additional properties
any
group_areas

Zones of the world reserved for groups: an object keyed by group id, each holding the [x, y] tile cells of that group’s area. Members of the group may edit the world inside its area even when they are not builders. Cells must lie inside the map.

object | null
Examples
Exampleblank
{
"name": "Head office — new meeting rooms"
}

The new draft, with its map document.

Media typeapplication/json
object
identifier
required
string
name
required
string
source_map

The world this one was copied from, if any.

string | null
status
required
string
Allowed values: draft active
is_active
required
boolean
version
required

Grows with every saved change.

integer
activated_at
string | null format: date-time
created_by_uuid
string | null
updated_by_uuid
string | null
created_at
string format: date-time
updated_at
string format: date-time
data

A Tiled map in its JSON format (orthogonal, 32×32 tiles). It must carry type, width, height, tilewidth, tileheight and layers. The Spaces client reads a Ground tile layer and the object layers Wall, Chair, Objects, ObjectsOnCollide, GenericObjects, GenericObjectsOnCollide, Computer, Whiteboard, Basement and VendingMachine; the easiest way to get a valid document is to create a world without data and edit the blank one it returns.

object
type
required
string
Allowed value: map
width
required
integer
height
required
integer
tilewidth
required
integer
tileheight
required
integer
layers
required
Array<object>
object
key
additional properties
any
tilesets
Array<object>
object
key
additional properties
any
key
additional properties
any
group_areas

Zones of the world reserved for groups: an object keyed by group id, each holding the [x, y] tile cells of that group’s area. Members of the group may edit the world inside its area even when they are not builders. Cells must lie inside the map.

object | null
Example
{
"status": "draft",
"data": {
"type": "map"
}
}

No authentication key was sent.

Media typeapplication/json

Authentication failures use an error key rather than message.

object
error
required
string
Examples
Examplemissing

No bearer token sent

{
"error": "JWT passport exception: Missing bearer token in request"
}

The caller is not allowed to do this (see “Who may do what”), or the authentication key is not recognised (empty message).

Media typeapplication/json
object
message
required
string
Examples

Not the space's owner

{
"message": "You do not have permission to update this space."
}

The authentication key is expired or not recognised. Get a fresh one and retry.

Media typeapplication/json

Authentication failures use an error key rather than message.

object
error
required
string
Examples
Exampleexpired
{
"error": "JWT passport expired: Passport expired"
}

The name is taken, or the map document is not valid.

Media typeapplication/json
object
message
required

The first validation message.

string
errors
required

Validation messages keyed by field name.

object
key
additional properties
Array<string>
Examples
ExamplenameTaken
{
"message": "The name has already been taken.",
"errors": {
"name": [
"The name has already been taken."
]
}
}