Upstream messages are sent one per request; just post the text of the JSON object. Currently the JSON parser is the org.json Java JSON parser, which is fairly accepting of nonstandard JSON, but I may change it in the future so try to submit correct JSON in all requests.
Messages marked as "channel messages" must always include a channelId value, indicating the channel that they are referring to. This is not listed in their tables. Messages with no data (other than type and, if relevant, channelId) will not have a table of fields.
Some messages have a field named callbackKey. This is an arbitrary 16 bit number you can send, and the same number will be contained in the response to your message. This is present because in some cases, you may want to send out several similar messages at once, and the callbackKey lets you figure out which response goes with which request. If you don't need or care, then you can just pass in 0 as the callback key.
Sorry that this list is in such a random order. Trying to get it all down quickly, and I'm not sure the best way to arrange it.
Must be the first message sent. Starts the login process.
Field | Meaning |
---|---|
name | User name |
password | The password for the account. |
locale | The preferred locale of the user. Should be in Java locale ID format; e.g., "en_US", "fr_FR", etc. |
LOGIN_SUCCESS, LOGIN_FAILED_NO_SUCH_USER, LOGIN_FAILED_BAD_PASSWORD, LOGIN_FAILED_USER_ALREADY_EXISTS.
Requests to leave a channel.
Requests to join a user's archive channel or "user details" channel. These channels exist for each user, whether they are logged in or not, and by joining the channel you can get the information contained within.
Field | Meaning |
---|---|
name | User whose channel you want to join |
ARCHIVE_JOIN, ARCHIVE_NONEXISTANT.
Send a chat message to other users. CHAT is the standard message from one player to the others in the channel. ANNOUNCE is the same, but it is in bold; only admins and channel owners can submit this message. ANNOUNCE_TO_PLAYERS is an announcement that even players can see (usually players in a game do not see CHAT or ANNOUNCE messages).
Field | Meaning | Max Length (chars) |
---|---|---|
text | Message to send | 1000 |
Requests the names of one or more rooms, specified by their room ID. When a room name changes, all users on the server are notified, so once you have a room name you don't need to request it again unless you log out and back in.
Field | Meaning |
---|---|
rooms | A JSON array of integers, each being the channelId of a room. |
Request a user's avatar data. This probably isn't needed for a HTML-based client; they can just download the avatar directly at http://goserver.gokgs.com/avatars/userName.jpg.
Field | Meaning |
---|---|
name | User whose avatar data you want. |
Change a user's detail. After you join the user's details channel, send this to do the update. Sr. Admins can change anybody's details; otherwise you can only change your own.
Field | Meaning | Max length (chars) |
---|---|---|
personalName | "Real name" as displayed in their details. | 50 |
personalEmail | Email address. | 70 |
personalInfo | Large text block of information. | 1500 |
emailWanted | Boolean. true indicates that you want the monthly email with the KGS Plus schedule. | |
emailPrivate | Boolean. true will hide your email from other users. | |
forcedNoRank | Boolean. Settable by admins only. true to shut off the user's rank and not let them turn it back on. | |
rankWanted | Boolean. Set to true if you want a rank, false to change your rank to "-" and ignore all your games when computing ranks. | |
authLevel | String. Non-superadmins must pass in the current value unchanged. One of normal, robot_ranked, teacher, jr_admin, sr_admin, or super_admin. |
Change a user's password. Only sr. admins can change other people's passwords.
Field | Meaning |
---|---|
user | User whose password you want to change. |
password | The new password. |
Request the rank graph data of the user whose channel this is.
Request the room description (the big block of text that appears when you first join a room). Like the room name, you will be notified when this changes (even if you aren't in the room), so you only need to request it once.
Request to join the channel that this message is sent to.
JOIN.
Create a room.
Field | Meaning | Max length (chars) |
---|---|---|
callbackKey | Callback key. | |
name | The name of the room. | 50 |
description | The room description. | 1000 |
category | One of MAIN, TEMPORARY, CLUBS, LESSONS, TOURNAMENT, FRIENDLY, or NATIONAL. Non-admins can only pass in TEMPORARY. | |
locale | Setting this makes it the default room for users of this locale. Can be set by admin only. Everybody else, pass in "". | 5 |
private | Boolean. If set, this is a private room. | |
tournOnly | Boolean. If set, only tournament games (run by the KGS TD) can be in the room. | |
globalOnly | Boolean. If set, games in this room always appear on the global games list. |
ROOM_CREATE_NAME_TAKEN, ROOM_CREATE_TOO_MANY_ROOMS, ROOM_CREATED.
Edit room name, description, and flags.
Field | Meaning | Max length (chars) |
---|---|---|
name | The new name of the room. | 50 |
description | The new room description. | 1000 |
category | One of MAIN, TEMPORARY, CLUBS, LESSONS, TOURNAMENT, FRIENDLY, or NATIONAL. Non-admins must pass in the current value. | |
locale | Setting this makes it the default room for users of this locale. Can be set by admin only. Everybody else, pass in "". | 5 |
private | Boolean. If set, this is a private room. | |
tournOnly | Boolean. If set, only tournament games (run by the KGS TD) can be in the room. | |
globalOnly | Boolean. If set, games in this room always appear on the global games list. |
Add or remove a user to the owner list of the room.
Field | Meaning |
---|---|
name | Name of the user to add or remove. |
Add or remove a user to the access list of the channel. Used for private rooms, games, etc.
Field | Meaning |
---|---|
name | Name of the user to add or remove. |
Request the list of users who have access to this channel. Can only be made by senior admins and channel owners.
Request a channel for a private conversation with another user. Does nothing if you already have a channel for this user.
Field | Meaning |
---|---|
callbackKey | Callback key |
name | Name of the user to add or remove. |
CONVO_JOIN, CONVO_NO_SUCH_USER.
Create a message to leave in another user's mailbox.
Field | Meaning | Max length (chars) |
---|---|---|
callbackKey | Callback key | |
name | Name of the user to add or remove. | |
text | Text of message. | 1000 |
MESSAGE_CREATE_NO_USER, MESSAGE_CREATE_CONNECTED (in which case a private convo will be created), MESSAGE_CREATE_FULL, MESSAGE_CREATE_SUCCESS.
Delete a message left for you. It contains a list of messages to delete; if the list is missing, then all messages are deleted.
Field | Meaning |
---|---|
messages | Optional message list |
Message Format | |
date | Date when the message was left. |
name | Name of user who left the message. |
Add or remove somebody from one of your four "buddy" lists. admin_track is usable by admins only.
Field | Meaning | Max length (chars) |
---|---|---|
callbackKey | Callback key | |
friendType | One of buddy, censored, fan, or admin_track. | |
name | Name of other user | |
text | Optional text notes about friend | 50 |
FRIEND_CHANGE_NO_USER, FRIEND_ADD_SUCCESS, FRIEND_REMOVE_SUCCESS.
Create a challenge.
Field | Meaning | Max length (chars) |
---|---|---|
callbackKey | Callback key | |
global | If set, this should appear in the global (non-room) lists. | |
text | Challenge comment | 80 |
proposal | Initial proposal |
Sample message:
{ "type": "CHALLENGE_CREATE", "channelId": 4794601, "callbackKey": 1, "global": false, "text": "Test Challenge", "proposal": { "gameType": "free", "nigiri": true, "rules": { "rules": "japanese", "size": 19, "komi": 6.5, "timeSystem": "30:00+5×30" }, "players": [{ "role": "white", "name": "wms" },{ "role": "black" }] } }
Send a sync, get a sync back. Useful if you want to know when for sure an earlier command has been completed by the server (each player's commands are processed in order, one command being completely finished before the next is started).
Field | Meaning |
---|---|
callbackKey | Callback key |
Change the default proposal for a challenge. Can only be sent by the challenge owner.
Field | Meaning |
---|---|
proposal | New proposal |
Make a move in your game. Leaving out x and y indicates a pass.
Field | Meaning |
---|---|
loc | Either the string PASS, or an object with x and y values. |
y | Optional. Y coordinate of move. |
Resign the game.
Request an undo in a game, or grant an undo. To reject an undo, simply ignore it.
GAME_UNDO_REQUEST (sent to your opponent when you send your undo request)
Sent when a moderator in a channel accepts a message.
Field | Meaning |
---|---|
name | The name of the user who originally made the comment |
text | The text of the comment |
Set the mode (moderated, normal, etc.) of a channel. Only available to teachers.
Field | Meaning |
---|---|
mode | One of NORMAL, QUIET, MODERATED |
name | Optional. The name of the moderator. Not needed unless the mode is MODERATED. |
Sent in response to GAME_TIME_EXPIRED. Indicates that you are still connected.
Add time to your opponent's clock.
Field | Meaning |
---|---|
role | The role of the player to add time to. |
time | A floating point number, indicating how many seconds to add to their clock. |
Reset our idle clock. Most commands do this, but if this command does nothing else.
Set the roles of players in a demo/review. This will temporarily change the effective roles of players. Any number of roles can be set.
Field | Meaning |
---|---|
role 1 | The name of the player who is to take that role. |
role 2 | The name of the player who is to take that role. |
… | |
role n | The name of the player who is to take that role. |
Change a game into review mode. This actually creates a new channel, with the review in it, moves everybody into the new channel, then closes out the old one.
Sent from the challenge owner. Indicates that the owner wants to go back and edit the proposal before accepting any offers.
Change the flags of a game or challenge. Some can only be set by admins. Any number can be changed at once. Any flags not present will be left unchanged.
Field | Meaning |
---|---|
flag 1 | A boolean with the new setting of this flag. |
flag 2 | A boolean with the new setting of this flag. |
… | |
flag n | A boolean with the new setting of this flag. |
A block of audio for the game.
Field | Meaning |
---|---|
audio | A string of base64-encoded SPEEX audio data. |
Create a new channel to play a recorded lecture.
Field | Meaning |
---|---|
playbackTimestamp | The exact time stamp of the recorded lecture. |
Request a list of playbacks available.
Field | Meaning |
---|---|
start | The start time of the list. |
end | The end time of the list. |
Set the position and speed of a playback.
Field | Meaning |
---|---|
position | Optional. If set, a double with the position (in seconds) to jump to. Leave it out to leave the current position unchanged. |
speed | Double precision number. The speed of playback; 1.0 is normal speed, 0.5 is half speed, 2.0 is double speed, etc. |
Request to join a global game list channel.
Field | Meaning |
---|---|
list | One of CHALLENGES, ACTIVES, FANS. |
Upload new avatar data. The avatar must be a jpeg file sized 141×200 pixels and under 8KB.
Field | Meaning |
---|---|
imageData | base64 encoded jpeg image data. |
Set whether or not a given user can talk during moderated mode. By default, nobody can except the moderator.
Field | Meaning |
---|---|
name | The user to change. |
allowed | Boolean. |
Send an announcement to every channel on the server. Admin only.
Field | Meaning |
---|---|
text | The message. |
Request some miscellaneous server statistics.
Delete an account. Admin only.
Field | Meaning |
---|---|
name | The account to delete. |
DELETE_ACCOUNT_ALREADY_GONE, DELETE_ACCOUNT_SUCCESS
Request that the server block a user for a while. Admin only.
Field | Meaning | Max length (chars) |
---|---|---|
name | The account to block. | |
time | The duration (in seconds) of the block. | |
text | A note with the reason for the block. | 500 |
KEEP_OUT_LOGIN_NOT_FOUND, KEEP_OUT_SUCCESS.
Clear a keep out request. Admin only.
Field | Meaning | Max length (chars) |
---|---|---|
name | The account to allow back in. |
CLEAR_KEEP_OUT_SUCCESS, CLEAR_KEEP_OUT_FAILURE
Join a game by giving the timestamp of the game start.
Field | Meaning |
---|---|
timestamp | The time stamp of the start of the game. |
Load a saved game in a room.
Field | Meaning |
---|---|
private | If present and set to true, load as a private game. |
timestamp | The time stamp of the start of the game. |
Shut down the server. Admin only. Duh.
Field | Meaning |
---|---|
time | The time, in seconds, before the server will be shut down. |
Delete the channel. Admin only. Generally channels go away on their own, this is only when there is some urgent reason to delete a game etc.
For guests to get a permanent account.
Field | Meaning | Max length (chars) |
---|---|---|
Your email address. | 70 | |
personalName | Your "real" name. | 50 |
personalInfo | A block of text with anything you want. | 1500 |
privateEmail | Boolean. If set, hide your email from other users. | |
sendEmail | Boolean. If set, send email announcements. |
REGISTER_SUCCESS, REGISTER_BAD_EMAIL.
Clone a game into this room.
Field | Meaning |
---|---|
gameChannelId | The channel ID of the game to clone. |
Sent by challengers to indicate that they accept the proposal as it stands.
Field | Meaning |
---|---|
proposal | The proposal being accepted. |
Sent by challengers to submit themselves as players.
Field | Meaning |
---|---|
proposal | The proposal containing ourselves as one of the players. |
CONVO_NO_CHATS
Indicates that we do not want to receive any more chats in this conversation until further notice.
CHALLENGE_DECLINE
Sent by the creator of a challenge to indicate that they do not accept a submitted proposal.
Field | Meaning |
---|---|
name | The user whose challenge they are declining. |
Turn on automatch or set our default preferences.
Field | Meaning |
---|---|
maxHandicap | The maximum number of handicap stones accepted in an automatch game. |
estiamtedRank | The rank we claim to be. 1k is the highest allowed. |
freeOk | If set, free (unrated) games are OK. |
rankedOk | If set, rated games are OK. |
robotOk | If set, games against robots are OK. |
humanOk | If set, games against humans are OK. |
blitzOk | If set, blitz games are OK. |
fastOk | If set, fast games are OK. |
mediumOk | If set, medium speed games are OK. |
unrankedOk | If set, playing against unranked players are OK. |
Do not accept automatch games.
Immediately set us as idle (greyed out).
Apply a tag to a game.
Field | Meaning | Max length (chars) |
---|---|---|
gameTimestamp | The time stame of the start of the game. | |
text | The tag. | 50 |
Fetch your database of tags.
Erase a tag. Admin only.
Field | Meaning |
---|---|
gameTimestamp | The time stame of the start of the game. |
Mark whether a stone is alive or dead.
Field | Meaning |
---|---|
alive | Boolean. |
x | The x-coordinate of the piece. |
y | The y-coordinate of the piece. |
Indicate that you are satisfied with the current alive/dead marks.
Field | Meaning |
---|---|
doneId | The done ID sent down by the most recent GAME_STATE. |
Add one or more SGF events to the game.
Field | Meaning |
---|---|
sgfEvents | An array of SGF Event objects. |
Set the scores for the game. These scores will be visible until the SGF node changes.
Field | Meaning |
---|---|
white | White's score. A double. Must be a multiple of 0.5. |
black | Black's score. A double. Must be a multiple of 0.5. |
Indicates you want to log out of the server.