# Open Source Games: guide for AI agents

You are helping a game creator manage their game page on Open Source Games (https://opensourcegames.dev), a home for playable open-source games. Pages publish immediately, so be accurate: players read every word.

## Authentication

- The creator gives you a personal access token that starts with `osg_`. They create it at https://opensourcegames.dev/studio/agents.
- Send it on every request: `Authorization: Bearer osg_…`.
- Never print the token in logs, commit it, or put it in a file inside the game's repository.
- Base URL for every endpoint below: `https://opensourcegames.dev/api/portal`.
- Send JSON bodies with `Content-Type: application/json`. Errors return `{ "message": "…" }` with a 4xx status. Read the message and fix the input.

## Workflow for adding a game

1. `GET /me` to confirm whose account this is and list the games they already manage.
2. Read the game's repository: README, license file, build or play instructions, controls, and the release or demo page.
3. Collect 1–6 real gameplay screenshots. Take them yourself by running the game if you can (a browser game: open the play URL and capture the screen mid-game). Use project screenshots from the README only if they show actual gameplay. No logos, title screens, or promotional art as the first image.
4. Upload each image: `POST /media` as `multipart/form-data` with a `file` field (PNG, JPEG, or WebP under 3 MB). Each response gives `url`. Put those URLs in `screenshots`, cover first.
5. `POST /games` with the fields below. The response includes the public `url`. Send the creator that link.
6. If the response is `409` with `existing`, the repository is already listed. Don't create a second page. If `existing.claimable` is true, tell the creator to open `existing.url` and choose "Claim with GitHub".

```bash
curl -X POST https://opensourcegames.dev/api/portal/media \
  -H "Authorization: Bearer $OSG_TOKEN" \
  -F "file=@gameplay-1.png"

curl -X POST https://opensourcegames.dev/api/portal/games \
  -H "Authorization: Bearer $OSG_TOKEN" \
  -H "Content-Type: application/json" \
  -d @game.json
```

## Game fields

| Field | Required | Rules |
| --- | --- | --- |
| `name` | yes | 2–100 characters. The game's real name. |
| `description` | yes | 20–240 characters. One specific sentence: what the player does. No marketing fluff. |
| `about` | yes | 40–12000 characters, plain text with line breaks. The experience, goals, controls, current state, and anything a player should know first. |
| `category` | yes | One of `racing-and-flying`, `simulation`, `exploration`, `action-and-shooters`, `roguelikes`, `puzzle`, `strategy`, `role-playing`, `sandbox`, `rhythm`, `learn-through-play`. |
| `repository` | yes | Public `https://` URL on github.com, gitlab.com, codeberg.org or sr.ht. |
| `url` | yes | Where people play or download it today: the browser build, a release page or a store page. |
| `license` | yes | Code license as written in the repository, e.g. `MIT`, `GPL-3.0`. |
| `assetLicense` | no | Art, music and other asset licenses, if different or declared. |
| `platforms` | yes | Any of `Browser`, `Windows`, `macOS`, `Linux`, `Android`, `iOS`, `Terminal`. Only ones that actually work. |
| `modes` | no | Any of `solo`, `online`, `local`, `lan`. |
| `inputs` | no | Any of `keyboard`, `mouse`, `touch`, `controller`. Only inputs the game supports. |
| `controlsSource` | no | URL documenting the controls. |
| `trailer` | no | A YouTube or Vimeo URL of real footage. |
| `screenshots` | no | Up to 6 URLs returned by `POST /media`. Strongly recommended: pages without art look empty. |
| `note` | no | Up to 1000 characters on requirements: build steps, controllers, original game data. |
| `needsOriginal` | no | `true` if it needs files from a commercial original game. |
| `aiAssisted` | no | `true` if the creator documents using AI tools to build it. Ask the creator; don't guess. |
| `publish` | no | Defaults to `true`. Send `false` to save a private draft, then `POST /games/{id}/publish` later. |

## Managing games

- `GET /studio`: every game the creator manages, with review, comment and library counts.
- `PATCH /games/{id}`: change a page. Send `"partial": true` with only the fields you change; without it, send the whole game. Changes are live immediately.
- `POST /games/{id}/publish`, `POST /games/{id}/unpublish`: show or hide a page you own.
- `DELETE /games/{id}`: delete a page the creator added, with its reviews and discussion. Confirm with the creator first.
- `POST /games/{id}/updates` with `{ "title", "body", "version" }`: post release notes or a devlog (title 3–140, body 30–10000 characters). Followers and players who saved the game see it in their feed. `PATCH /updates/{id}` and `DELETE /updates/{id}` edit or remove one.
- `GET /games/{id}`: the public page data, including player reviews, so you can summarise feedback for the creator.
- `GET /comments?kind=game&target={id}`: the game's discussion. `POST /comments` with `{ "kind": "game", "target": "{id}", "parentId": "…", "body": "…" }` replies as the creator. Only post replies the creator asked for or approved.

## Rules

- Only add games the creator made or is authorized to manage, with source code under an open-source license.
- Write in your own words from the repository. Don't copy long passages from other sites.
- Never write reviews, react, or comment on other people's games for the creator. Reviews come from players.
- Rate limits: 10 new games per day per account, 600 token requests per hour. A `429` includes `Retry-After`.
- Community guidelines: https://opensourcegames.dev/guidelines
