All API endpoints must finish their response with a round trip time of less than 500 ms. Otherwise, a default response is assumed. In case no valid response is received following a POST /move, the last action will be repeated. If no action was taken yet, a random action is executed.
Technical Documentation
Endpoints
Your API must implement the following HTTP endpoints:
GET /: Query information about your snakePOST /start: Notify about the start of a gamePOST /move: Notify about the next turn and query the next action from the agentPOST /end: Notify about the end of a game
All endpoints must return a status code of 200 - OK. Redirections are not permitted. For requests where a reply is expected, the reply
must be a JSON-object. Your implementation may return additional fields, they are ignored.
Definitions
Snake information response
A response with the following body as a JSON-object is expected from a GET /request. The request itself has no body.
| Property | Type | Description |
|---|---|---|
| author | string (optional) | Name of the snake. If provided, must match exactly with the name used in registration. (Named author for compatibility with the original battlesnake) |
| color | string (optional) | Hexadecimal RGB color code for snake, if provided must have format #XXXXXX |
Example Response
{
"author": "TestSnake",
"color": "#ff2222"
}
Start of game request, Move request, End of game request
A request with the following body as a JSON-object is made during a POST /start, POST /move and POST /end.
| Property | Type | Description |
|---|---|---|
| game | object | Definition of the game |
| turn | integer | Turn number |
| board | object | Initial board state |
| you | object | Initial state of your snake |
Move response
A response with the following body as a JSON-object is expected from a POST /move.
| Property | Type | Description |
|---|---|---|
| move | string (required) | Direction to move, must be one of up, down, left, right |
Example Response
{
"move": "up"
}