Prepare an uploaded image for an article
All field references · Articles
POST /v1/articles/{id}/images
Validate a live upload and prepare an immutable article image. JPEG, PNG, GIF and WebP are accepted up to 10 MiB; SVG is rejected. The image is converted to WebP with a maximum edge of 1600 pixels. This does not change the article or its revision. Use image_ref in a subsequent versioned article or variant command to select it. Repeating the same upload_id for the same article returns the same reference even after the original upload is gone or changed. Use a new upload_id for different bytes. Unknown and foreign articles are indistinguishable.
Required scopes: "products:write", "files:write".
#Parameters
#path: id
Required. Existing article owned by your organization.
| Field | Type | Presence | null | Meaning, limits and examples |
|---|---|---|---|---|
| $ (whole value) | string | Whole value | Not allowed | format: "uuid". |
#Request body
Request body required.
Content type: application/json
| Field | Type | Presence | null | Meaning, limits and examples |
|---|---|---|---|---|
| $ (whole value) | object | Whole value | Not allowed | Additional properties are not allowed. |
| upload_id | string | Required when parent is present | Not allowed | Upload identity returned by POST /uploads. First PUT exactly one JPEG, PNG, GIF or WebP file of at most 10 MiB to its upload_url using a live key. The same upload and article always identify the same prepared image. format: "uuid". |
#Response 200
200: Success
Content type: application/json
| Field | Type | Presence | null | Meaning, limits and examples |
|---|---|---|---|---|
| $ (whole value) | object | Whole value | Not allowed | Additional properties are not allowed. |
| data | object | Required when parent is present | Not allowed | Prepared image for this article. Preparation itself does not assign the image to the article. Additional properties are not allowed. |
| data.article_id | string | Required when parent is present | Not allowed | The article for which this image was prepared. format: "uuid". |
| data.upload_id | string | Required when parent is present | Not allowed | The original upload identity; keep it for unchanged retries. format: "uuid". |
| data.image_ref | string | Required when parent is present | Not allowed | Opaque permanent image reference. Keep it unchanged and pass it to this article’s primary_image_ref or gallery_image_refs, or the variant imageRef. It is not a public URL; do not construct or parse it. minLength: 1. |
| data.content_type | string | Required when parent is present | Not allowed | Stored image format after validation and conversion. const: "image/webp". |
#Response 400, 401, 403, 404, 413, 422, 429, 500, 503
400: The request is not valid JSON. 401: The key is missing, unknown, revoked or expired. 403: The key lacks a required scope, or the operation requires a live key. 404: Not found. Also applies to IDs that belong to another organization — we deliberately do not distinguish between "does not exist" and "does not belong to you". 413: The JSON request exceeds 256 KiB. 422: Content validation failed. The response lists all affected locations at once. 429: A rate limit was reached and the request did not run. Wait for Retry-After, then repeat it unchanged. X-RateLimit-Scope names the limit: key (120 requests per minute), organization (300 per minute across all keys), write (1,000 at once, refilling at 60 per minute) or list (300 unfiltered list pages at once, refilling at 10 per minute). 500: Unexpected error on our side. 503: Temporarily unavailable. Repeat the same request with the same business identity.
Content type: application/json
| Field | Type | Presence | null | Meaning, limits and examples |
|---|---|---|---|---|
| $ (whole value) | object | Whole value | Not allowed | — |
| error | object | Required when parent is present | Not allowed | Machine-readable error code; use it to select the documented recovery path. |
| error.code | string | Required when parent is present | Not allowed | Machine-readable, permanently stable error code. Program against it, not against message. |
| error.message | string | Required when parent is present | Not allowed | Explanation for humans. May change at any time. |
| error.field | string | Optional | Not allowed | Affected location in the request, if it can be determined. |
| error.doc_url | string | Required when parent is present | Not allowed | Documentation link explaining this API error. format: "uri". |
Machine-readable version of this page: https://www.meykt.com/developers/fields-prepare-article-image.md