#How it works
- Start an upload. Declare the file name, size and SHA-256, and choose
transfer: "direct". - Send the parts. Ask for a signed URL per part and PUT the bytes straight to storage β fast from anywhere.
- Complete. We check every part and the SHA-256; the new version then waits for review, or goes live for trusted authors.
There are two ways to send the bytes:
transfer=directβ recommended. Each part goes straight to our storage with a short-lived URL we sign for you: fast from anywhere, no 100-second limit. Parts are 5β100 MB (default 50 MB; the last one is the remainder).transfer=relayβ the default for older scripts: chunks go through our servers (1β50 MB each). Every chunk must arrive within 100 seconds, which can be slow from far away.
Tip: From a slow or distant network, direct can be a hundred times faster than relay β measured from Vietnam: about 30 KB/s through our servers, 4 MB/s direct.
#1. Start an upload
/api/items/{id}/uploads| Field | Type | Description |
|---|---|---|
filename required |
string | Package file name, e.g. my-item-2.5.0.zip |
size required |
integer | Bytes |
sha256 required |
hex | Checksum of the whole file |
transfer |
enum | direct (recommended) or relay (default) |
chunk_size |
integer | Bytes per part β direct 5β100 MB, relay 1β50 MB; default 50 MB |
slot |
enum | main_file (default) or installable_file (WordPress items, zip) |
replace_pending |
boolean | true when an update of this item is already waiting for review: this upload replaces its package (and the version and changelog you complete it with). See Hotfixes |
curl -X POST https://sellmycode.net/api/items/123/uploads \
-H "Authorization: Bearer $(cat ~/.config/sellmycode/token)" \
-H "Content-Type: application/json" \
-d '{"filename":"my-item-2.5.0.zip","size":48211904,"sha256":"9f2cβ¦e1","transfer":"direct"}'
$res = (new GuzzleHttp\Client)->post('https://sellmycode.net/api/items/123/uploads', [
'headers' => ['Authorization' => 'Bearer ' . $token],
'json' => ['filename' => basename($file), 'size' => filesize($file),
'sha256' => hash_file('sha256', $file), 'transfer' => 'direct'],
]);
const res = await fetch("https://sellmycode.net/api/items/123/uploads", {
method: "POST",
headers: { Authorization: `Bearer ${token}`, "Content-Type": "application/json" },
body: JSON.stringify({ filename, size, sha256, transfer: "direct" }),
});
res = requests.post("https://sellmycode.net/api/items/123/uploads",
headers={"Authorization": f"Bearer {token}"},
json={"filename": name, "size": size, "sha256": sha, "transfer": "direct"})
{
"status": "success",
"upload": { "id": "0d049a6c-β¦-2cda", "transfer": "direct", "chunk_size": 52428800,
"chunk_count": 1, "received": 0, "missing": [0], "expires_at": "2026-10-24T14:00:00Z" }
}
You can have 2 unfinished uploads at a time; an upload expires after 6 hours.
#2. Send the parts
#Direct
/api/items/{id}/uploads/{upload}/parts/{index}Returns a signed URL for part index (0 β¦ chunk_count β 1), valid for 60 minutes. PUT exactly that part to it β no Authorization header, the URL is the permission. Ask again if it expires.
{ "status": "success", "index": 0, "method": "PUT", "url": "https://β¦r2.cloudflarestorage.com/β¦",
"headers": { "Content-Length": 52428800 }, "expires_at": "2026-10-24T09:00:00Z" }
Warning: A part larger than planned cancels the whole upload and counts as a failed upload.
#Relay
/api/items/{id}/uploads/{upload}/chunks/{index}Raw request body, exactly chunk_size bytes (the last chunk is the remainder). The optional header X-Chunk-Sha256 checks the chunk. Re-sending a chunk replaces it.
#3. Check progress
/api/items/{id}/uploads/{upload}Shows how many parts arrived and which are missing β use it to resume after a network error.
#4. Complete
/api/items/{id}/uploads/{upload}/complete| Field | Type | Description |
|---|---|---|
version |
string | e.g. 2.5.0 β an installable package uses its own Version header when omitted |
changelog |
string | Shown to buyers when the version goes live |
{ "status": "success", "item_id": 123, "mode": "review", "changed": ["main_file", "version", "changelog"],
"update_id": 846, "replaced_pending": false, "sha256": "9f2cβ¦e1", "version": "2.5.0" }
#List and cancel uploads
/api/uploads/api/items/{id}/uploads/{upload}List your unfinished uploads (all items) and cancel one you will not finish β it frees the slot at once and does not count as a failed upload.
#A complete release script
F=my-item-2.5.0.zip; ID=123; API=https://sellmycode.net/api; AUTH="Authorization: Bearer $(cat ~/.config/sellmycode/token)"
SIZE=$(stat -f%z "$F" 2>/dev/null || stat -c%s "$F"); SHA=$(shasum -a 256 "$F" | cut -d' ' -f1); CS=52428800
J=$(curl -s -X POST $API/items/$ID/uploads -H "$AUTH" -H "Content-Type: application/json" \
-d "{\"filename\":\"$F\",\"size\":$SIZE,\"sha256\":\"$SHA\",\"transfer\":\"direct\",\"chunk_size\":$CS}")
UP=$(echo "$J" | python3 -c 'import sys,json;print(json.load(sys.stdin)["upload"]["id"])')
N=$(echo "$J" | python3 -c 'import sys,json;print(json.load(sys.stdin)["upload"]["chunk_count"])')
for i in $(seq 0 $((N-1))); do
URL=$(curl -s $API/items/$ID/uploads/$UP/parts/$i -H "$AUTH" | python3 -c 'import sys,json;print(json.load(sys.stdin)["url"])')
dd if="$F" bs=$CS skip=$i count=1 2>/dev/null | curl -sf -X PUT --data-binary @- "$URL" > /dev/null || echo "part $i failed β run it again"
done
curl -s -X POST $API/items/$ID/uploads/$UP/complete -H "$AUTH" -H "Content-Type: application/json" \
-d '{"version":"2.5.0","changelog":"Fixed checkout on PHP 8.4"}'
#Errors
| Code | HTTP | Meaning |
|---|---|---|
pending_update |
409 | Another update of this item is waiting for review β wait, or start the upload with replace_pending: true |
incomplete |
409 | Parts are missing β the message lists them |
checksum_mismatch |
422 | The file differs from the declared size or SHA-256 β start a new upload |
oversized_part |
422 | A part was larger than planned; the upload was cancelled |
chunk_size |
422 | The part size is outside the allowed range |
file_type |
422 | The item category does not accept this file type |
not_installable |
422 | No WordPress theme or plugin with a Version header in the zip |
too_many_uploads |
429 | Finish or cancel your other uploads first |
daily_limit |
429 | 10 GB per author per 24 hours |
upload_locked |
429 | Five failed or abandoned uploads in 24 hours pause uploads for a day |
busy |
503 | Upload capacity is busy β try again in a few minutes |
Developers