REST API 500 error when challenging player

I have been trying to use the REST API in order to create a challenge to a specific player and I keep getting a 500 error. I am doing a POST request to the endpoint, where the body of the request is as follows

    "game": {
        "name": "Rengo game",
        "rules": "chinese",
        "ranked": false,
        "handicap": 0,
        "time_control": "simple",
        "time_control_parameters": {
            "system": "simple",
            "speed": "correspondence",
            "per_move": 2419000.0
        "pause_on_weekends": true,
        "width": 19,
        "height": 19,
        "disable_analysis": false
    "challenger_color": "black",
    "min_ranking": 0,
    "max_ranking": 30

Am I missing something with this?

Rengo is not supported :smiley: :wink:

Just joking.

Can you clarify what other authorised calls you have (or have not) had success with?

IE are you still on the ramp up of how to use the API as a logged in player, or is this a specific problem with challenges?

1 Like

I have been able to access the /api/v1/me/settings endpoint, but have not had any success with others yet (I haven’t done extensive testing with them yet, challenging is the first part).

Hopefully, when I get everything with this project working rengo will be supported :slight_smile:

1 Like

You may just be reaching the /me endpoint because you have the cookies on your computer for your own personal account.

You first need to get the authentication token API For Online Go (OGS) · Apiary
and send that along in the header

Secondly, this is the body I send


(where the <text> are game specific variables)

Out if curiosity, what are you working on?

Thank you so much! It looks like I was missing a couple of parameters that were not specified in the documentation. It also seemed to help (I’m using the python requests module) when I manually specified the Content-Type header (I thought I didn’t need to, but I guess providing custom headers overrides that) and by using the json parameter instead of the data parameter

I am working on a Discord bot that will work to handle rengo on OGS by having an unranked game between 2 accounts controlled by the bot, where the moves come from a Discord server

glad it helped. Yeah, unfortunately some of the params are not listed in the documentation. I lifted them either from elsewhere on the forum and/or I inspected the network logs of OGS when making a game

sounds neat! I once set up a site where players were shown an iframe of OGS and given a login to use in the iframe. Then I blocked the players moves when it wasn’t there turn and showed some visuals as well.

The discord bot will likely work better, haha.

Yeah, inspecting my network traffic was going to be my next step if I didn’t get a response soon enough. I very well may end up doing that for the other endpoints I need, if I can’t figure them out

That sounds like a cool way of doing it. Hopefully this bot works out and catches on among the player base. I plan on making it open-source once it’s working, so anyone can register a bot and use it

1 Like