- Upload each new image with
POST /media/uploads. It is checked and stored privately for 24 hours, and you get an upload id back. - Send one
PUT /mediathat says what the item should show: new uploads, current screenshots you keep, in the order you want.
The PUT is one change, like a PATCH: it waits for review unless your account publishes updates directly, and an item has at most one update waiting (send replace_pending: true to replace it).
Note: Screenshots have no captions on SellMyCode, so there is no caption field.
#Read the current media
/api/items/{id}/mediaNeeds items:read. Also shows what the waiting update would change, and the image rules of the item's category.
curl https://sellmycode.net/api/items/123/media \
-H "Authorization: Bearer YOUR_API_KEY"
{
"status": "success",
"item_id": 123,
"media": {
"thumbnail": { "url": "SellMyCode/files/items/ab12/thumb.webp" },
"preview": { "type": "image", "url": "SellMyCode/files/items/ab12/preview.webp" },
"screenshots": [
{ "position": 0, "url": "SellMyCode/files/items/ab12/s1.webp" },
{ "position": 1, "url": "SellMyCode/files/items/ab12/s2.webp" }
]
},
"pending_update": null,
"rules": {
"formats": ["jpg", "png"],
"max_bytes": 10485760,
"thumbnail_min": { "width": 240, "height": 240 },
"preview_image_min": { "width": 1120, "height": 630, "ratio": "16:9" },
"screenshot_min_long_side": 600,
"max_screenshots": 10,
"staged_hours": 24
}
}
#Upload an image
/api/items/{id}/media/uploadsNeeds items:upload. Send the image as multipart/form-data, one image per request.
| Parameter | Type | Description |
|---|---|---|
file required |
file | JPG or PNG, at most 10 MB. The type is read from the file itself |
slot required |
string | thumbnail, preview_image or screenshot |
The same checks as the upload fields in Workspace:
| Slot | Rule |
|---|---|
thumbnail |
At least the category's thumbnail size (see rules). Padded to a square and resized |
preview_image |
At least 1120Γ630 and landscape 16:9. Within Β±2 % it is kept as it is, up to Β±10 % it is cropped to 16:9, beyond that it is refused (wrong_ratio) |
screenshot |
At least 600 px on the longer side |
Images are converted to WebP when the site does that for web uploads. Uploads you do not use expire after 24 hours; you can have 30 unused images at a time (429 too_many_uploads).
curl -X POST https://sellmycode.net/api/items/123/media/uploads \
-H "Authorization: Bearer YOUR_API_KEY" \
-F slot=screenshot \
-F file=@dashboard.png
{
"status": "success",
"upload": {
"id": "k3Jx9Qw2LmPa",
"slot": "screenshot",
"width": 1600,
"height": 900,
"url": "SellMyCode/files/items/ab12/new.webp",
"expires_at": "2026-11-15T09:00:00Z"
}
}
#Set the media
/api/items/{id}/mediaNeeds items:write. Send only what changes.
| Parameter | Type | Description |
|---|---|---|
thumbnail |
string | Upload id of a thumbnail upload |
preview_image |
string | Upload id of a preview_image upload (items with an image preview only) |
screenshots |
array | The whole gallery, in order. Each entry is {"keep": position} (a current screenshot, positions from GET /media) or {"upload": "id"} (a screenshot upload). At least 1, at most the category's max_screenshots |
replace_pending |
boolean | Replace the update that is waiting for review |
Removing a screenshot = leaving it out of the list. Reordering = listing the entries in the new order. A gallery identical to the current one changes nothing (mode: unchanged).
curl -X PUT https://sellmycode.net/api/items/123/media \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"screenshots":[{"upload":"k3Jx9Qw2LmPa"},{"keep":0},{"keep":1}]}'
{
"status": "success",
"item_id": 123,
"mode": "review",
"changed": ["screenshots"],
"update_id": 9912,
"replaced_pending": false
}
mode is published (live now, HTTP 200) or review (waiting for approval, HTTP 202). Follow the review with Review state or the item.update_* webhooks. When the change goes live, the images it no longer uses are deleted; images you kept stay as they are. If the update is rejected, its new uploads are deleted and the item keeps its current images.
#Errors
| Code | HTTP | Meaning |
|---|---|---|
invalid_type |
422 | Not a JPG or PNG |
too_large |
413 | Over 10 MB |
too_small / wrong_ratio |
422 | Below the minimum size, or not 16:9 (preview) |
slot_unavailable |
422 | The item's category has no gallery, or the item uses a video/audio preview |
too_many_uploads |
429 | 30 unused images are waiting |
upload_not_found |
422 | Unknown or expired upload id, or an upload made for another item |
wrong_slot |
422 | e.g. a screenshot upload sent as thumbnail |
invalid_screenshot / duplicate_screenshot |
422 | An entry without exactly one of keep/upload, a position that does not exist, or the same image twice |
too_many_screenshots |
422 | More than the category allows |
pending_update |
409 | An update is already waiting; send replace_pending: true to replace it |
Developers