Messaging
Players can send direct messages to other players in the same season, and broadcast messages to all alliance members. All messaging is REST-based — poll the inbox endpoint to check for new messages.
Find Players to Message
GET /api/v1/players/directory/
Discover other players in your realm season so you can pick a recipient_player_id. Returns { id, username } for every player in your current season except yourself, ordered by username. Filter with ?search= (case-insensitive username match) and paginate with limit (default 50, max 200) and offset.
import httpx
response = httpx.get( "http://localhost:8731/api/v1/players/directory/", headers={"Authorization": "Bearer your-token-here"}, params={"search": "ada", "limit": 50, "offset": 0},)print(response.json())curl "http://localhost:8731/api/v1/players/directory/?search=ada&limit=50&offset=0" \ -H "Authorization: Bearer your-token-here"const response = await fetch( "http://localhost:8731/api/v1/players/directory/?search=ada&limit=50&offset=0", { headers: { "Authorization": "Bearer your-token-here" } });const directory = await response.json();Response envelope: { "count": <total>, "limit": <limit>, "offset": <offset>, "results": [{ "id": ..., "username": ... }] }
Send a Direct Message
POST /api/v1/messages/
Send a message to another player in the same realm season. The recipient must be in the same season as you.
import httpx
response = httpx.post( "http://localhost:8731/api/v1/messages/", headers={"Authorization": "Bearer your-token-here"}, json={ "recipient_player_id": "player-uuid-here", "subject": "Alliance proposal", "content": "Want to join forces against the eastern coalition?", },)print(response.json())curl -X POST http://localhost:8731/api/v1/messages/ \ -H "Authorization: Bearer your-token-here" \ -H "Content-Type: application/json" \ -d '{ "recipient_player_id": "player-uuid-here", "subject": "Alliance proposal", "content": "Want to join forces against the eastern coalition?" }'const response = await fetch("http://localhost:8731/api/v1/messages/", { method: "POST", headers: { "Authorization": "Bearer your-token-here", "Content-Type": "application/json", }, body: JSON.stringify({ recipient_player_id: "player-uuid-here", subject: "Alliance proposal", content: "Want to join forces against the eastern coalition?", }),});const message = await response.json();The response includes the full message object with sender/recipient usernames, subject, content, read status, and timestamp.
Constraints:
- You cannot message yourself (400).
- The recipient must be in the same season (404 if not found).
- Subject: 1–128 characters. Content: 1–2000 characters.
Read Your Inbox
GET /api/v1/messages/inbox/
Returns messages you have received, newest first. Supports limit and offset query parameters for pagination (limit defaults to 50, max 200; offset defaults to 0).
import httpx
response = httpx.get( "http://localhost:8731/api/v1/messages/inbox/", headers={"Authorization": "Bearer your-token-here"}, params={"limit": 50, "offset": 0},)print(response.json())curl "http://localhost:8731/api/v1/messages/inbox/?limit=50&offset=0" \ -H "Authorization: Bearer your-token-here"const response = await fetch( "http://localhost:8731/api/v1/messages/inbox/?limit=50&offset=0", { headers: { "Authorization": "Bearer your-token-here" } });const inbox = await response.json();Response envelope: { "count": <total>, "limit": <limit>, "offset": <offset>, "results": [...] }
Read Your Sent Messages
GET /api/v1/messages/sent/
Returns messages you have sent, newest first. Same pagination as inbox.
import httpx
response = httpx.get( "http://localhost:8731/api/v1/messages/sent/", headers={"Authorization": "Bearer your-token-here"},)print(response.json())curl http://localhost:8731/api/v1/messages/sent/ \ -H "Authorization: Bearer your-token-here"const response = await fetch("http://localhost:8731/api/v1/messages/sent/", { headers: { "Authorization": "Bearer your-token-here" },});const sent = await response.json();Get a Single Message
GET /api/v1/messages/{message_id}/
Retrieve a specific message by ID. Only the sender or recipient can view the message — anyone else receives a 404.
import httpx
response = httpx.get( "http://localhost:8731/api/v1/messages/message-uuid-here/", headers={"Authorization": "Bearer your-token-here"},)print(response.json())curl http://localhost:8731/api/v1/messages/message-uuid-here/ \ -H "Authorization: Bearer your-token-here"const response = await fetch( "http://localhost:8731/api/v1/messages/message-uuid-here/", { headers: { "Authorization": "Bearer your-token-here" } });const message = await response.json();Mark a Message as Read
POST /api/v1/messages/{message_id}/read/
Mark a received message as read. Only the recipient can mark a message read — anyone else (including the sender) receives a 404. Returns the updated message.
import httpx
response = httpx.post( "http://localhost:8731/api/v1/messages/message-uuid-here/read/", headers={"Authorization": "Bearer your-token-here"},)print(response.json())curl -X POST http://localhost:8731/api/v1/messages/message-uuid-here/read/ \ -H "Authorization: Bearer your-token-here"const response = await fetch( "http://localhost:8731/api/v1/messages/message-uuid-here/read/", { method: "POST", headers: { "Authorization": "Bearer your-token-here" }, });const message = await response.json();Delete a Message
DELETE /api/v1/messages/{message_id}/
Removes a message from your mailbox only. Deletion is per-side: the other participant keeps their copy. Works for both received and sent messages. Once both the sender and the recipient have deleted a message, it is removed entirely. Returns 204 No Content.
import httpx
httpx.delete( "http://localhost:8731/api/v1/messages/message-uuid-here/", headers={"Authorization": "Bearer your-token-here"},)curl -X DELETE http://localhost:8731/api/v1/messages/message-uuid-here/ \ -H "Authorization: Bearer your-token-here"await fetch( "http://localhost:8731/api/v1/messages/message-uuid-here/", { method: "DELETE", headers: { "Authorization": "Bearer your-token-here" }, });Errors:
404— Message not found, or you are not a participant.
Alliance Broadcast
POST /api/v1/messages/broadcast/
Send a message to all other members of your alliance at once. You must be a member of an alliance, and your alliance role must be Vice Host or Host — Evony’s “send group messages” power; Presbyters, Officers and Members get 403 (Your alliance role (Presbyter) may not broadcast to the alliance.). The recipient_player_id field in the request body is ignored — the message is delivered to every alliance member except yourself.
import httpx
response = httpx.post( "http://localhost:8731/api/v1/messages/broadcast/", headers={"Authorization": "Bearer your-token-here"}, json={ "recipient_player_id": "00000000-0000-0000-0000-000000000000", "subject": "War council", "content": "All members report to the eastern front by dawn!", },)messages = response.json()print(f"Sent to {len(messages)} alliance members")curl -X POST http://localhost:8731/api/v1/messages/broadcast/ \ -H "Authorization: Bearer your-token-here" \ -H "Content-Type: application/json" \ -d '{ "recipient_player_id": "00000000-0000-0000-0000-000000000000", "subject": "War council", "content": "All members report to the eastern front by dawn!" }'const response = await fetch("http://localhost:8731/api/v1/messages/broadcast/", { method: "POST", headers: { "Authorization": "Bearer your-token-here", "Content-Type": "application/json", }, body: JSON.stringify({ recipient_player_id: "00000000-0000-0000-0000-000000000000", subject: "War council", content: "All members report to the eastern front by dawn!", }),});const messages = await response.json();Returns a list of the messages created — one per recipient. Returns an empty list if you are the only member. Returns 400 if you are not in an alliance.