Skip to content

Add a game screenshot โ€‹

POST /v1/admin/store/games/{id}/screenshots

  • Operation ID: addStoreGameScreenshot
  • Tags: Store game art
  • Base URL: http://localhost:8787

Multipart upload. Must be 16:9 and at least 1920x1080; the full image is capped at 3840 wide and a 600x337 thumbnail is generated. A game holds at most 12 screenshots.

Workflow: Integration guide.

Authentication: staff Bearer JWT with permission store.write.

Authentication โ€‹

  • Auth: staff Bearer JWT (Authorization: Bearer <access_token>) with the permissions below.
  • Required permissions: store.write

Parameters โ€‹

NameInTypeRequiredDescription
idpathintegeryesGreater than: 0

Request body โ€‹

Required: yes. Multipart form with a single file field.

Content type: multipart/form-data

Schema: object

FieldTypeRequiredDescription
filestring<binary>yesImage file (JPEG, WebP or PNG, up to 8 MiB).

Responses โ€‹

201 โ€‹

Stored screenshot record.

  • Header x-request-id: Request identifier; quote it when reporting an error. Content type: application/json

Schema: object (StoreGameScreenshotRecord)

FieldTypeRequiredDescription
idstring<uuid>yes-
game_idintegeryes-
full_pathstringyes-
thumb_pathstringyes-
widthinteger | nullyes-
heightinteger | nullyes-
created_atstringyesISO 8601 timestamp.
updated_atstringyesISO 8601 timestamp.

Errors โ€‹

400 โ€‹

Request validation failed. validation_failed (details { file: "required" }: no multipart file field), unsupported_mime, file_too_large (over 8 MiB), invalid_image, bad_aspect_ratio or too_small.

  • Header x-request-id: Request identifier; quote it when reporting an error. Content type: application/json

Schema: object (ValidationErrorBody) | object (ErrorBody)

FieldTypeRequiredDescription
(variant 1).successbooleanyesOne of: false
(variant 1).errorobjectyes-
(variant 1).error.namestringyesOne of: "ZodError"
(variant 1).error.issuesobject[]yes-
(variant 1).error.issues[].codestringyes-
(variant 1).error.issues[].path(string | number)[]yes-
(variant 1).error.issues[].messagestringyes-
(variant 2).errorstringyesStable machine-readable error code, e.g. forbidden, not_found.
(variant 2).detailsanynoOptional structured context. For 403 it is { perm }.

Request validation

json
{
  "success": false,
  "error": {
    "name": "ZodError",
    "issues": [
      {
        "code": "custom",
        "path": [
          "field"
        ],
        "message": "Invalid value"
      }
    ]
  }
}

Application error

json
{
  "error": "validation_failed"
}

401 โ€‹

Missing, malformed, expired or wrong-audience Bearer token (missing_token, invalid_token, invalid_audience).

  • Header x-request-id: Request identifier; quote it when reporting an error. Content type: application/json

Schema: object (ErrorBody)

FieldTypeRequiredDescription
errorstringyesStable machine-readable error code, e.g. forbidden, not_found.
detailsanynoOptional structured context. For 403 it is { perm }.

Error response

json
{
  "error": "missing_token"
}

403 โ€‹

Authenticated but lacking the required permission. details.perm lists the accepted permission keys.

  • Header x-request-id: Request identifier; quote it when reporting an error. Content type: application/json

Schema: object (ErrorBody), fields as described above.

Error response

json
{
  "error": "forbidden",
  "details": {
    "perm": "store.write"
  }
}

404 โ€‹

game_not_found.

  • Header x-request-id: Request identifier; quote it when reporting an error. Content type: application/json

Schema: object (ErrorBody), fields as described above.

Error response

json
{
  "error": "game_not_found"
}

409 โ€‹

too_many_screenshots (details { max }).

  • Header x-request-id: Request identifier; quote it when reporting an error. Content type: application/json

Schema: object (ErrorBody), fields as described above.

Error response

json
{
  "error": "too_many_screenshots"
}

413 โ€‹

file_too_large: request body exceeds the 8 MiB upload limit (details { max }).

  • Header x-request-id: Request identifier; quote it when reporting an error. Content type: application/json

Schema: object (ErrorBody), fields as described above.

Error response

json
{
  "error": "file_too_large"
}

500 โ€‹

Unexpected server error (internal). No details are returned.

  • Header x-request-id: Request identifier; quote it when reporting an error. Content type: application/json

Schema: object (ErrorBody), fields as described above.

Error response

json
{
  "error": "internal"
}

Examples โ€‹

curl โ€‹

bash
curl -X POST 'http://localhost:8787/v1/admin/store/games/1/screenshots' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -F 'file=@./file.png'

TypeScript โ€‹

ts
import { readFile } from "node:fs/promises";

const accessToken = process.env.ACCESS_TOKEN; // user JWT from your sign-in flow

const body = new FormData();
body.append("file", new Blob([await readFile("./file.png")], { type: "image/png" }), "file.png");

const response = await fetch("http://localhost:8787/v1/admin/store/games/1/screenshots", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${accessToken}`,
  },
  body: body,
});
if (!response.ok) throw new Error(`HTTP ${response.status}: ${await response.text()}`);
const data = response.status === 204 || response.status === 205
  ? undefined
  : response.headers.get("content-type")?.includes("json")
    ? await response.json()
    : await response.text();

Try this endpoint

Requests go directly from your browser to the API. Send request executes this endpoint against the selected server.

POST/v1/admin/store/games/{id}/screenshots

Your token stays in this tab's memory and is sent only when you press Send request.

Parameters
Request body (required)

Built for developers. Ready for agents.