Appearance
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 โ
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | integer | yes | Greater than: 0 |
Request body โ
Required: yes. Multipart form with a single file field.
Content type: multipart/form-data
Schema: object
| Field | Type | Required | Description |
|---|---|---|---|
file | string<binary> | yes | Image 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)
| Field | Type | Required | Description |
|---|---|---|---|
id | string<uuid> | yes | - |
game_id | integer | yes | - |
full_path | string | yes | - |
thumb_path | string | yes | - |
width | integer | null | yes | - |
height | integer | null | yes | - |
created_at | string | yes | ISO 8601 timestamp. |
updated_at | string | yes | ISO 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)
| Field | Type | Required | Description |
|---|---|---|---|
(variant 1).success | boolean | yes | One of: false |
(variant 1).error | object | yes | - |
(variant 1).error.name | string | yes | One of: "ZodError" |
(variant 1).error.issues | object[] | yes | - |
(variant 1).error.issues[].code | string | yes | - |
(variant 1).error.issues[].path | (string | number)[] | yes | - |
(variant 1).error.issues[].message | string | yes | - |
(variant 2).error | string | yes | Stable machine-readable error code, e.g. forbidden, not_found. |
(variant 2).details | any | no | Optional 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)
| Field | Type | Required | Description |
|---|---|---|---|
error | string | yes | Stable machine-readable error code, e.g. forbidden, not_found. |
details | any | no | Optional 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();