Skip to content
Open Markdown

Replace a game screenshot image ​

PUT /v1/admin/store/games/{id}/screenshots/{shotId}

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

Multipart upload with the same image rules as adding a screenshot; keeps the screenshot id and removes stale objects.

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
shotIdpathstring<uuid>yes-

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 ​

200 ​

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 or screenshot_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"
}

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 PUT 'http://localhost:8787/v1/admin/store/games/1/screenshots/3f6c2a1e-8b4d-4e7a-9c1f-2d5b6a7e8f90' \
  -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/3f6c2a1e-8b4d-4e7a-9c1f-2d5b6a7e8f90", {
  method: "PUT",
  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.

PUT/v1/admin/store/games/{id}/screenshots/{shotId}

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.