### Game Started Source: https://docs.battlesnake.com/api/webhooks Sent when a Battlesnake enters a new game. The game engine ignores the response. ```APIDOC ## POST /start ### Description Your Battlesnake will receive this request when it has been entered into a new game that is about to begin. Every game has a unique ID that can be used to allocated resources or data you may need. Your response to this request will be ignored. ### Method POST ### Endpoint /start ### Request Data - **game** (object) - Game Object describing the game being played. - **turn** (integer) - Turn number (always 0 for new games). - **board** (object) - Board Object describing the initial state of the game board. - **you** (object) - Battlesnake Object describing your Battlesnake. ### Response Responses to this request are ignored by the game engine. ``` -------------------------------- ### Battlesnake Customization Response Source: https://docs.battlesnake.com/api/webhooks Example response for a GET / request. This response provides API version, author, color, head, and tail customizations for your Battlesnake. ```json { "apiversion": "1", "author": "MyUsername", "color": "#888888", "head": "default", "tail": "default", "version": "0.0.1-beta" } ``` -------------------------------- ### Example RulesetSettings Object Source: https://docs.battlesnake.com/api/objects/ruleset-settings This JSON object represents a complete set of ruleset settings. Note that ruleset-specific settings like 'royale' and 'squad' only apply when those respective rulesets are active. ```json { "foodSpawnChance": 25, "minimumFood": 1, "hazardDamagePerTurn": 14, "royale": { "shrinkEveryNTurns": 5 }, "squad": { "allowBodyCollisions": true, "sharedElimination": true, "sharedHealth": true, "sharedLength": true } } ``` -------------------------------- ### Battlesnake Move Request Example Source: https://docs.battlesnake.com/api/example-move This JSON object represents a typical move request sent to a Battlesnake. It contains detailed information about the current game state, board dimensions, food locations, hazards, and the status of all snakes on the board, including your own. ```json { "game": { "id": "totally-unique-game-id", "ruleset": { "name": "standard", "version": "v1.1.15", "settings": { "foodSpawnChance": 15, "minimumFood": 1, "hazardDamagePerTurn": 14 } }, "map": "standard", "source": "league", "timeout": 500 }, "turn": 14, "board": { "height": 11, "width": 11, "food": [ {"x": 5, "y": 5}, {"x": 9, "y": 0}, {"x": 2, "y": 6} ], "hazards": [ {"x": 3, "y": 2} ], "snakes": [ { "id": "snake-508e96ac-94ad-11ea-bb37", "name": "My Snake", "health": 54, "body": [ {"x": 0, "y": 0}, {"x": 1, "y": 0}, {"x": 2, "y": 0} ], "latency": "111", "head": {"x": 0, "y": 0}, "length": 3, "shout": "why are we shouting??", "customizations":{ "color":"#FF0000", "head":"pixel", "tail":"pixel" } }, { "id": "snake-b67f4906-94ae-11ea-bb37", "name": "Another Snake", "health": 16, "body": [ {"x": 5, "y": 4}, {"x": 5, "y": 3}, {"x": 6, "y": 3}, {"x": 6, "y": 2} ], "latency": "222", "head": {"x": 5, "y": 4}, "length": 4, "shout": "I'm not really sure...", "customizations":{ "color":"#26CF04", "head":"silly", "tail":"curled" } } ] }, "you": { "id": "snake-508e96ac-94ad-11ea-bb37", "name": "My Snake", "health": 54, "body": [ {"x": 0, "y": 0}, {"x": 1, "y": 0}, {"x": 2, "y": 0} ], "latency": "111", "head": {"x": 0, "y": 0}, "length": 3, "shout": "why are we shouting??", "customizations": { "color":"#FF0000", "head":"pixel", "tail":"pixel" } } } ``` -------------------------------- ### Battlesnake Move Response Example Source: https://docs.battlesnake.com/api/example-move This JSON object represents a successful move response from a Battlesnake. It specifies the chosen move (up, down, left, or right) and an optional shout message. ```json { "move": "up", "shout": "I guess I'll go up then." } ``` -------------------------------- ### Battlesnake Details Source: https://docs.battlesnake.com/api/webhooks An empty GET request to the root URL of your Battlesnake server. Used for customization, latency checks, and communication verification. ```APIDOC ## GET / ### Description An empty GET request made to the root URL of your Battlesnake, used to load customization, check latency, and verifying successful communications between the game engine and your Battlesnake. ### Method GET ### Endpoint / ### Request Example None, the game engine will send an empty request body. ### Response #### Success Response (200 OK) - **apiversion** (string) - Required - Version of the Battlesnake API implemented by this Battlesnake. Currently only API version 1 is valid. - **author** (string) - Optional - Username of the author of this Battlesnake. If provided, this will be used to verify ownership. - **color** (string) - Optional - Hex color code used to display this Battlesnake. Must start with "#", followed by 6 hexadecimal characters. - **head** (string) - Optional - Head customization. - **tail** (string) - Optional - Tail customization. - **version** (string) - Optional - An optional version string for your Battlesnake. This value is not used in gameplay, but can be useful for tracking deployments on your end. #### Response Example { "apiversion": "1", "author": "MyUsername", "color": "#888888", "head": "default", "tail": "default", "version": "0.0.1-beta" } ``` -------------------------------- ### Example Battlesnake Customization JSON Source: https://docs.battlesnake.com/guides/customizations This JSON object defines the color, head, and tail for a Battlesnake. It is returned by the Battlesnake API to specify the snake's appearance. ```json { "color": "#736CCB", "head": "beluga", "tail": "curled" } ``` -------------------------------- ### Battlesnake API 1.0 Snake Data Example Source: https://docs.battlesnake.com/blog/2020/06/02/battlesnake-developer-update---may-2020 This JSON structure represents the data provided to a Battlesnake, including its ID, name, health, body, head, length, and shout. It demonstrates the new root properties for head location and snake length. ```json { "id": "totally-unique-snake-id", "name": "Sneky McSnek Face", "health": 54, "body": [ {"x": 0, "y": 0}, {"x": 1, "y": 0}, {"x": 2, "y": 0} ], "head": {"x": 0, "y": 0}, "length": 3, "shout": "why are we shouting??" } ``` -------------------------------- ### Ruleset Object Structure Source: https://docs.battlesnake.com/api/objects/ruleset This snippet shows the basic structure of the Ruleset object, including its name, version, and settings. ```json "ruleset": { "name": "standard", "version": "v1.2.3", "settings": { ... } } ``` -------------------------------- ### Battlesnake Server Response Source: https://docs.battlesnake.com/quickstart This JSON response indicates that your Battlesnake server is running correctly and ready to play games. It's returned when accessing the root URL of your server. ```json {"apiversion": "1", "author": "", "color": "#888888", "head": "default", "tail": "default"} ```