API docs
Everything a bot needs to play. Plain REST and JSON: send a request, get JSON back. The arena lives at https://bot-arena.lastdog.app.
Getting started
- Log in (this creates your account).
- Create a bot on the Bots page and copy its Bot ID.
- Create a key on the API keys page. It is shown once: save it.
- Call
/create_maze, then/lookand/moveuntil you reach the target.
Authentication
Send your API key as a bearer token in the Authorization header of every call:
Authorization: Bearer ba_…A key acts as you, so keep it out of source control and logs. We store only a hash of it: if you lose one, delete it and make another. Each game belongs to one of your bots, named by bot_uuid when you create the maze.
Conventions
- Every game call is a
POSTwith a JSON body andContent-Type: application/json. - The maze is a square grid of
size×sizesquares.xgrows to the right andygrows downward, both from 0. - A Location is
{"x": 3, "y": 4}: two integers ≥ 0. - A uuid is a string like
3f2a9c1e-0a7d-4b2c-8e6f-1a3b5c7d9e0f.
When something is wrong you get an HTTP error with no JSON body:
| Status | Means |
|---|---|
400 / 415 | The body is not JSON, or the Content-Type header is missing. |
422 | Valid JSON, but not a valid action: a missing field, an axis that is not 0 or 1, a direction of 0, or a game that is over. |
500 | Something broke on our side. |
Endpoints
POST /create_maze
Start a game: a new square maze for one of your bots.
You always start in the top-left corner, (0, 0). The target is placed at random.
You learn where the target is, but not where the walls are: that is what /look is for.
Request body
| Field | Type | Meaning |
|---|---|---|
size | integer | Width and height of the maze, in squares. |
bot_uuid | uuid | Which of your bots is playing: its Bot ID from the Bots page. |
{
"size": 10,
"bot_uuid": "d0000000-0000-4000-8000-000000000002"
}Response
| Field | Type | Meaning |
|---|---|---|
game_id | uuid | Names this game in every later call. |
start_location | Location | Where you are now: always (0, 0). |
target_location | Location | The square to reach. |
{
"game_id": "3f2a9c1e-0a7d-4b2c-8e6f-1a3b5c7d9e0f",
"start_location": {
"x": 0,
"y": 0
},
"target_location": {
"x": 7,
"y": 4
}
}POST /look
How far is clear along an axis, from where you stand.
Looking never moves you.
Request body
| Field | Type | Meaning |
|---|---|---|
game_id | uuid | The game, as returned by /create_maze. |
axis | integer, 0 or 1 | 0 is x (left–right), 1 is y (up–down). |
direction | integer, not 0 | Only the sign counts: positive looks right (x) or down (y), negative looks left or up. |
{
"game_id": "3f2a9c1e-0a7d-4b2c-8e6f-1a3b5c7d9e0f",
"axis": 0,
"direction": 1
}Response
| Field | Type | Meaning |
|---|---|---|
free_spaces | integer ≥ 0 | Squares you could move that way before a wall or the edge of the maze. |
{
"free_spaces": 3
}POST /move
Move along an axis. A wall stops you short.
You travel |distance| squares, or as far as the first wall if that is nearer.
Every call counts as a move, so a bump into a wall costs one too.
Request body
| Field | Type | Meaning |
|---|---|---|
game_id | uuid | The game, as returned by /create_maze. |
axis | integer, 0 or 1 | 0 is x (left–right), 1 is y (up–down). |
distance | integer, not 0 | How far to go. The sign is the direction: positive is right (x) or down (y). |
{
"game_id": "3f2a9c1e-0a7d-4b2c-8e6f-1a3b5c7d9e0f",
"axis": 1,
"distance": -2
}Response
| Field | Type | Meaning |
|---|---|---|
absolute_distance_traveled | integer ≥ 0 | How far you actually went: between 0 and |distance|. |
winner | boolean | True when this move stopped you on the target. |
{
"absolute_distance_traveled": 2,
"winner": false
}POST /quit
Abandon a game.
Request body
| Field | Type | Meaning |
|---|---|---|
game_id | uuid | The game, as returned by /create_maze. |
{
"game_id": "3f2a9c1e-0a7d-4b2c-8e6f-1a3b5c7d9e0f"
}Response
200 OK with an empty body.
GET /healthz
Is the arena up? No API key or body needed.
503 Service Unavailable when the arena cannot reach its database.
Response
| Field | Type | Meaning |
|---|---|---|
status | string | "Ok" when the arena is serving. |
{
"status": "Ok"
}A whole game with curl
ARENA=https://bot-arena.lastdog.app
KEY=ba_… # from the API keys page
BOT=… # your Bot ID, from the Bots page
curl -s $ARENA/create_maze -H "Authorization: Bearer $KEY" \
-H "Content-Type: application/json" -d '{"size": 10, "bot_uuid": "'$BOT'"}'
# {"game_id":"3f2a…","start_location":{"x":0,"y":0},"target_location":{"x":7,"y":4}}
GAME=3f2a… # the game_id from above
curl -s $ARENA/look -H "Authorization: Bearer $KEY" \
-H "Content-Type: application/json" -d '{"game_id": "'$GAME'", "axis": 0, "direction": 1}'
# {"free_spaces":3}
curl -s $ARENA/move -H "Authorization: Bearer $KEY" \
-H "Content-Type: application/json" -d '{"game_id": "'$GAME'", "axis": 0, "distance": 3}'
# {"absolute_distance_traveled":3,"winner":false}The exact Rust types for every body are in crates/arena_api. For a working client, see test_bot in the arena's repository.