Scripts endpoints
Create, read, update, version, star and fork scripts.
Every public endpoint, with what it takes, what it returns and a curl you can paste. The basics (keys, rate limits, errors, paging) are on REST API. All examples assume your key is in $PASTEBLOX_TOKEN.
All endpoints
"None" means it works without a key, for public and unlisted scripts. "Owner" means your key, or the script's x-claim-token if it was created anonymously. Wherever a path has :n, 3 and v3 both work.
Your account
Who am I
GET/api/v1/me- Auth
- API key (or a bearer token)
- Success
200
The account behind the key, and which key it is. Handy to check a key works. It's what pbx whoami calls.
curl https://pasteblox.com/api/v1/me \
-H "x-api-key: $PASTEBLOX_TOKEN"{
"user": { "handle": "you", "name": "You", "image": null, "role": "user" },
"auth": { "method": "api_key", "keyId": "utl7S1TH6DlpzKlqkQjw1YNtCy8y2e9d", "keyName": "github actions" }
}401 unauthorizedNo key, or the key is invalid, expired or revoked.
List your scripts
GET/api/v1/me/scripts- Auth
- API key
- Success
200
Everything you own, every visibility, newest change first. Deleted scripts aren't listed. This is pbx ls.
Query
qstring- Search: part of a title, an exact slug, or a tag (up to 100 characters).
visibilityenum- public, unlisted or private. Leave out for all.
sortenum- updated (default), created, stars, views or fetches.
limit1–100- Page size, default 24.
cursorstring- From the last page's
nextCursor.
| Field | Type | What it is |
|---|---|---|
| q | string | Search: part of a title, an exact slug, or a tag (up to 100 characters). |
| visibility | enum | public, unlisted or private. Leave out for all. |
| sort | enum | updated (default), created, stars, views or fetches. |
| limit | 1–100 | Page size, default 24. |
| cursor | string | From the last page's nextCursor. |
curl "https://pasteblox.com/api/v1/me/scripts?sort=created&limit=2" \
-H "x-api-key: $PASTEBLOX_TOKEN"{
"items": [
{
"slug": "k3m9x2p7qa",
"title": "door",
"visibility": "unlisted",
"latestVersion": 2,
"starCount": 0,
"viewCount": 0,
"fetchCount": 0,
"riskStatus": "clean",
"keySystem": false,
…
},
…
],
"nextCursor": "SLgTdr2gACD4pSg54BNYfVFaDr9qHnSBjjAq-W_R7g"
}Items are script summaries. Two fields only show up here, for you: riskStatus (pending, clean or flagged: flagged scripts can't be public, and public ones only appear on Explore once clean) and keySystem.
Scripts
Create a script
POST/api/v1/scripts- Auth
- API key, or none for an anonymous unlisted script
- Rate limit
- 60 / hour per account (10 / hour per IP when anonymous)
- Success
201
Body
contentstringRequired- The code. Up to 512 KB, not empty.
titlestring- Up to 100 characters. Left out, pasteblox picks one from the code.
descriptionstring- Up to 2,000 characters.
languageenum- luau (default) or lua.
visibilityenum- unlisted (default), public or private. Anonymous: unlisted only.
gamestring | null- The Roblox game it's for, up to 64 characters.
tagsstring[]- Up to 8, each 1–24 of a-z 0-9 -.
messagestring- Summary of version 1, up to 200 characters.
notesstring- Changelog of version 1, up to 4,000 characters.
folderIdinteger | null- File it in one of your dashboard folders. Signed in only; the folder must be yours (otherwise
404 folder not found). It's private, so it's never sent back. namestring | null- A custom URL under your handle:
"main.lua"serves the script at/raw/you/main.lua. Signed in only. Lowercased for you; up to 4 parts split by/, see Names.
| Field | Type | What it is |
|---|---|---|
| contentRequired | string | The code. Up to 512 KB, not empty. |
| title | string | Up to 100 characters. Left out, pasteblox picks one from the code. |
| description | string | Up to 2,000 characters. |
| language | enum | luau (default) or lua. |
| visibility | enum | unlisted (default), public or private. Anonymous: unlisted only. |
| game | string | null | The Roblox game it's for, up to 64 characters. |
| tags | string[] | Up to 8, each 1–24 of a-z 0-9 -. |
| message | string | Summary of version 1, up to 200 characters. |
| notes | string | Changelog of version 1, up to 4,000 characters. |
| folderId | integer | null | File it in one of your dashboard folders. Signed in only; the folder must be yours (otherwise 404 folder not found). It's private, so it's never sent back. |
| name | string | null | A custom URL under your handle: "main.lua" serves the script at /raw/you/main.lua. Signed in only. Lowercased for you; up to 4 parts split by /, see Names. |
curl -X POST https://pasteblox.com/api/v1/scripts \
-H "x-api-key: $PASTEBLOX_TOKEN" \
-H "content-type: application/json" \
-d '{"title":"door","content":"-- door\nprint(\"open\")\n","message":"first cut"}'{
"script": {
"slug": "k3m9x2p7qa",
"name": null,
"title": "door",
"description": "",
"visibility": "unlisted",
"language": "luau",
"game": null,
"tags": [],
"latestVersion": 1,
"lineCount": 3,
"sizeBytes": 22,
"starCount": 0,
"forkCount": 0,
"viewCount": 0,
"fetchCount": 0,
"flags": [],
"owner": { "handle": "you", "name": "You", "image": null },
"createdAt": "2026-10-20T15:11:04.902Z",
"updatedAt": "2026-10-20T15:11:04.902Z",
"publishedAt": null,
"hostedFor": null,
"forkedFrom": null,
"viewer": { "canEdit": true, "starred": false },
"urls": {
"page": "https://pasteblox.com/s/k3m9x2p7qa",
"raw": "https://pasteblox.com/raw/k3m9x2p7qa",
"rawPinned": "https://pasteblox.com/raw/k3m9x2p7qa@1",
"loadstring": "loadstring(game:HttpGet(\"https://pasteblox.com/raw/k3m9x2p7qa\"))()"
}
},
"version": {
"n": 1,
"message": "first cut",
"notes": "",
"sizeBytes": 22,
"lineCount": 3,
"sha256": "dc8d19a0c35a86a8a9fadb6b763896ef4a25ab160ea8bc1a08498a90790e73a4",
"flags": [],
"source": "api",
"author": { "handle": "you", "name": "You", "image": null },
"createdAt": "2026-10-20T15:11:04.902Z"
}
}Without a key, the response also has "claimToken". It's returned this once: keep it, it's the only way to edit that script until you claim it.
403 forbiddenAnonymous with a visibility other than unlisted, a folderId or a name.404 not_foundfolderId isn't one of your folders.409 conflictAnother live script of yours already has that name.413 payload_too_largeContent over 512 KB.422 validation_failedE.g. empty content, a title over 100 characters, a bad tag.
Get a script
GET/api/v1/scripts/:slug- Auth
- None for public and unlisted; the owner for private
- Success
200
The script's details and its recent versions (without code; get that from one version).
Query
versions0–100- How many recent versions to include, newest first. Default 20.
| Field | Type | What it is |
|---|---|---|
| versions | 0–100 | How many recent versions to include, newest first. Default 20. |
curl "https://pasteblox.com/api/v1/scripts/k3m9x2p7qa?versions=1"{
"script": {
"slug": "k3m9x2p7qa",
"name": null,
"title": "door",
"description": "",
"visibility": "unlisted",
"language": "luau",
"game": null,
"tags": [],
"latestVersion": 1,
"lineCount": 3,
"sizeBytes": 22,
"starCount": 0,
"forkCount": 0,
"viewCount": 0,
"fetchCount": 0,
"flags": [],
"owner": { "handle": "you", "name": "You", "image": null },
"createdAt": "2026-10-20T15:11:04.902Z",
"updatedAt": "2026-10-20T15:11:04.902Z",
"publishedAt": null,
"hostedFor": null,
"forkedFrom": null,
"viewer": { "canEdit": true, "starred": false },
"urls": {
"page": "https://pasteblox.com/s/k3m9x2p7qa",
"raw": "https://pasteblox.com/raw/k3m9x2p7qa",
"rawPinned": "https://pasteblox.com/raw/k3m9x2p7qa@1",
"loadstring": "loadstring(game:HttpGet(\"https://pasteblox.com/raw/k3m9x2p7qa\"))()"
}
},
"versions": [{
"n": 1,
"message": "first cut",
"notes": "",
"sizeBytes": 22,
"lineCount": 3,
"sha256": "dc8d19a0c35a86a8a9fadb6b763896ef4a25ab160ea8bc1a08498a90790e73a4",
"flags": [],
"source": "api",
"author": { "handle": "you", "name": "You", "image": null },
"createdAt": "2026-10-20T15:11:04.902Z"
}]
}viewer is about you: canEdit is true for the owner, starred is null without a key. fetchCount (how often the raw link ran) is only filled in for the owner.
404 not_foundNo such slug, private and not yours, or deleted.410 goneRemoved by a moderator.
Edit a script
PATCH/api/v1/scripts/:slug- Auth
- Owner (key or claim token)
- Rate limit
- 60, then 1 / second per account
- Success
200
Change any details; send only the fields you're changing (at least one). To change the code, push a version.
Body
titlestring- Up to 100 characters.
descriptionstring- Up to 2,000 characters.
visibilityenum- public, unlisted or private. A claim token can only keep it unlisted.
languageenum- luau or lua.
gamestring | null- null clears it.
tagsstring[]- Replaces all tags. Lowercased for you.
folderIdinteger | null- Move it into one of your folders; null takes it out. Owner key only, not a claim token.
namestring | null- Set or change its custom URL; null clears it. The old name keeps serving this script. Owner key only, not a claim token.
| Field | Type | What it is |
|---|---|---|
| title | string | Up to 100 characters. |
| description | string | Up to 2,000 characters. |
| visibility | enum | public, unlisted or private. A claim token can only keep it unlisted. |
| language | enum | luau or lua. |
| game | string | null | null clears it. |
| tags | string[] | Replaces all tags. Lowercased for you. |
| folderId | integer | null | Move it into one of your folders; null takes it out. Owner key only, not a claim token. |
| name | string | null | Set or change its custom URL; null clears it. The old name keeps serving this script. Owner key only, not a claim token. |
curl -X PATCH https://pasteblox.com/api/v1/scripts/k3m9x2p7qa \
-H "x-api-key: $PASTEBLOX_TOKEN" \
-H "content-type: application/json" \
-d '{"title":"door v2","tags":["doors","Utility"],"game":"Doors"}'{
"script": {
"slug": "k3m9x2p7qa",
"title": "door v2",
"tags": ["doors", "utility"],
"game": "Doors",
"visibility": "unlisted",
…
}
}403 forbiddenNot yours; or a claim token trying to change visibility, folderId or name.404 not_foundNo such script, or folderId isn't one of your folders.409 conflictMaking a script public that the risk scan flagged, or a name another live script of yours has.422 validation_failedAn empty body ("nothing to update") or a bad field.
Names (custom URLs)
name gives a script a second raw link under its owner's handle. Once it's set, urls.raw and urls.loadstring use it; /raw/k3m9x2p7qa keeps working either way.
curl -X PATCH https://pasteblox.com/api/v1/scripts/k3m9x2p7qa \
-H "x-api-key: $PASTEBLOX_TOKEN" \
-H "content-type: application/json" \
-d '{"name":"doors/Main.lua"}'{
"script": {
"slug": "k3m9x2p7qa",
"name": "doors/main.lua",
…
"urls": {
"page": "https://pasteblox.com/s/k3m9x2p7qa",
"raw": "https://pasteblox.com/raw/you/doors/main.lua",
"rawPinned": "https://pasteblox.com/raw/k3m9x2p7qa@2",
"loadstring": "loadstring(game:HttpGet(\"https://pasteblox.com/raw/you/doors/main.lua\"))()"
}
}
}Delete a script
DELETE/api/v1/scripts/:slug- Auth
- Owner (key or claim token)
- Rate limit
- 60, then 1 / second per account
- Success
200
The raw link stops working right away. The script is kept for 30 days, until purgeAfter, and you can restore it until then. After that it's gone for good.
curl -X DELETE https://pasteblox.com/api/v1/scripts/k3m9x2p7qa \
-H "x-api-key: $PASTEBLOX_TOKEN"{ "ok": true, "purgeAfter": "2026-11-19T15:11:37.397Z" }403 forbiddenNot yours.
Restore a deleted script
POST/api/v1/scripts/:slug/restore- Auth
- The owner's API key (not a claim token)
- Success
200
Undoes a delete within the 30 days. Same slug, same raw link. This is pbx restore. No body.
curl -X POST https://pasteblox.com/api/v1/scripts/k3m9x2p7qa/restore \
-H "x-api-key: $PASTEBLOX_TOKEN"{ "script": { "slug": "k3m9x2p7qa", "title": "door v2", … } }404 not_foundNo such script, or not yours.409 conflictIt isn't deleted.410 goneThe 30 days have passed.
Versions
Push a version
POST/api/v1/scripts/:slug/versions- Auth
- Owner (key or claim token)
- Rate limit
- 20, then 10 / minute per script
- Success
201 (new version) · 200 (unchanged)
Uploads new code as the next version. The raw link and every loadstring run it right away. If the code is identical to the newest version, nothing is created: you get 200 with "unchanged": true, and message and notes are ignored.
Body
contentstringRequired- The new code. Up to 512 KB.
messagestring- One-line summary, up to 200 characters.
notesstring- Changelog, up to 4,000 characters. Bullets, ## headings, **bold**, `code`, links; added: / fixed: / changed: / removed: get labels.
baseVersioninteger- The version you started from. If it's not the newest, you get
409 version_conflictinstead of overwriting (why).
| Field | Type | What it is |
|---|---|---|
| contentRequired | string | The new code. Up to 512 KB. |
| message | string | One-line summary, up to 200 characters. |
| notes | string | Changelog, up to 4,000 characters. Bullets, ## headings, **bold**, `code`, links; added: / fixed: / changed: / removed: get labels. |
| baseVersion | integer | The version you started from. If it's not the newest, you get 409 version_conflict instead of overwriting (why). |
curl -X POST https://pasteblox.com/api/v1/scripts/k3m9x2p7qa/versions \
-H "x-api-key: $PASTEBLOX_TOKEN" \
-H "content-type: application/json" \
-d '{"content":"-- door\nprint(\"open\")\nprint(\"close\")\n","message":"close the door too","notes":"- added: close\n- fixed: debounce","baseVersion":1}'{
"unchanged": false,
"version": {
"n": 2,
"message": "close the door too",
"notes": "- added: close\n- fixed: debounce",
"sizeBytes": 37,
"lineCount": 4,
"sha256": "276f94a3b6a79bfe762b0a2d861721df1d60a00a8d92e22c820e4e216adfff69",
"flags": [],
"source": "api",
"author": { "handle": "you", "name": "You", "image": null },
"createdAt": "2026-10-20T15:11:12.958Z"
},
"urls": {
"page": "https://pasteblox.com/s/k3m9x2p7qa",
"raw": "https://pasteblox.com/raw/k3m9x2p7qa",
"rawPinned": "https://pasteblox.com/raw/k3m9x2p7qa@2",
"loadstring": "loadstring(game:HttpGet(\"https://pasteblox.com/raw/k3m9x2p7qa\"))()"
}
}403 forbiddenNot yours (or the wrong claim token).409 version_conflictbaseVersion isn't the newest. The body has latestVersion.413 payload_too_largeOver 512 KB.
Version history
GET/api/v1/scripts/:slug/versions- Auth
- None for public and unlisted; the owner for private
- Success
200
Every version's details (no code), newest first, paged.
Query
limit1–100- Page size, default 24.
cursorstring- From the last page's
nextCursor.
| Field | Type | What it is |
|---|---|---|
| limit | 1–100 | Page size, default 24. |
| cursor | string | From the last page's nextCursor. |
curl "https://pasteblox.com/api/v1/scripts/k3m9x2p7qa/versions?limit=1"{
"items": [{
"n": 2,
"message": "close the door too",
"notes": "- added: close\n- fixed: debounce",
"sizeBytes": 37,
"lineCount": 4,
"sha256": "276f94a3b6a79bfe762b0a2d861721df1d60a00a8d92e22c820e4e216adfff69",
"flags": [],
"source": "api",
"author": { "handle": "you", "name": "You", "image": null },
"createdAt": "2026-10-20T15:11:12.958Z"
}],
"nextCursor": "SLgTdr2gACD4pSg54BNYfVFaDr9qHnSBjjAq-W_R7g"
}404 not_foundNo such script, or private and not yours.
Get one version, with its code
GET/api/v1/scripts/:slug/versions/:n- Auth
- None for public and unlisted; the owner for private and key-protected
- Success
200
:n is a number or latest. Same fields as above, plus content.
curl https://pasteblox.com/api/v1/scripts/k3m9x2p7qa/versions/latest{
"version": {
"n": 2,
"message": "close the door too",
…
"content": "-- door\nprint(\"open\")\nprint(\"close\")\n"
}
}404 not_found"version 9 does not exist (latest is 2)", or the script isn't visible to you.410 goneRemoved by a moderator.
Edit a version's summary or changelog
PATCH/api/v1/scripts/:slug/versions/:n- Auth
- Owner (key or claim token)
- Rate limit
- 60, then 1 / second per script
- Success
200
Fixes the words, never the code. Send message, notes or both; "notes": "" clears the changelog. This is pbx note.
curl -X PATCH https://pasteblox.com/api/v1/scripts/k3m9x2p7qa/versions/2 \
-H "x-api-key: $PASTEBLOX_TOKEN" \
-H "content-type: application/json" \
-d '{"message":"close the door, too"}'{ "version": { "n": 2, "message": "close the door, too", … } }422 validation_failedAn empty body, or a message over 200 characters.
Get the code as plain text
GET/api/v1/scripts/:slug/versions/:n/raw- Auth
- None for public and unlisted; the owner for private and key-protected
- Rate limit
- 300, then 5 / second per IP
- Success
200 text/plain
Just the code, never cached. With a key, owners can download their private scripts this way. It's the API twin of the public /raw/k3m9x2p7qa link loadstrings use, except its errors are JSON instead of Lua.
curl -i https://pasteblox.com/api/v1/scripts/k3m9x2p7qa/versions/1/rawHTTP/1.1 200 OK
content-type: text/plain; charset=utf-8
content-disposition: inline; filename="k3m9x2p7qa.luau"
etag: "dc8d19a0c35a86a8a9fadb6b763896ef4a25ab160ea8bc1a08498a90790e73a4"
x-pasteblox-version: 1
-- door
print("open")The etag is the code's SHA-256 and x-pasteblox-version the version number, handy with latest.
Anonymous scripts
Claim anonymous scripts
POST/api/v1/claim- Auth
- API key
- Rate limit
- 10, then 10 / minute per account
- Success
200
Moves scripts you created without a key into your account, using the claimToken each one came with. Up to 100 at a time. pbx login does this for you.
Body
items{ slug, token }[]Required- 1 to 100 pairs of a slug and its claim token.
| Field | Type | What it is |
|---|---|---|
| itemsRequired | { slug, token }[] | 1 to 100 pairs of a slug and its claim token. |
curl -X POST https://pasteblox.com/api/v1/claim \
-H "x-api-key: $PASTEBLOX_TOKEN" \
-H "content-type: application/json" \
-d '{"items":[{"slug":"5u76k2bmqh","token":"<claim token>"}]}'{ "claimed": ["5u76k2bmqh"], "failed": ["22222abcde"] }failed lists the ones that didn't work, without saying why (wrong token, already claimed or gone), on purpose.
Objects
The shapes that come back, field by field. Anything marked "Owner" is only filled in for the script's owner.
Script
slugstring- 10 characters, never changes.
namestring | null- Its custom URL under the owner's handle, like
main.lua; null when it has none. title, descriptionstringvisibilityenum- public, unlisted or private.
languageenum- luau or lua.
gamestring | nulltagsstring[]latestVersioninteger- The newest version number.
lineCount, sizeBytesinteger- Of the newest version.
starCount, forkCount, viewCountintegerfetchCountinteger- How often the raw link ran. Owner; 0 for everyone else.
flagsstring[]- Risk-scan hints on the newest version (see Flags).
owneruser | null- { handle, name, image }; null for anonymous scripts.
createdAt, updatedAtdatetimepublishedAtdatetime | null- First time it went public.
hostedForobject | null- Set when the script is hosted for a partner site.
riskStatusenum- pending, clean or flagged. Owner, /me/scripts only.
keySystemboolean- Behind a key system, so the code is owner-only.
forkedFrom{ slug, version } | null- Details only.
viewer{ canEdit, starred }- About you. Details only.
urlsobject- page, raw (always newest; the named link when the script has a name), rawPinned (this version, by slug) and loadstring (uses raw). Details only.
| Field | Type | What it is |
|---|---|---|
| slug | string | 10 characters, never changes. |
| name | string | null | Its custom URL under the owner's handle, like main.lua; null when it has none. |
| title, description | string | |
| visibility | enum | public, unlisted or private. |
| language | enum | luau or lua. |
| game | string | null | |
| tags | string[] | |
| latestVersion | integer | The newest version number. |
| lineCount, sizeBytes | integer | Of the newest version. |
| starCount, forkCount, viewCount | integer | |
| fetchCount | integer | How often the raw link ran. Owner; 0 for everyone else. |
| flags | string[] | Risk-scan hints on the newest version (see Flags). |
| owner | user | null | { handle, name, image }; null for anonymous scripts. |
| createdAt, updatedAt | datetime | |
| publishedAt | datetime | null | First time it went public. |
| hostedFor | object | null | Set when the script is hosted for a partner site. |
| riskStatus | enum | pending, clean or flagged. Owner, /me/scripts only. |
| keySystem | boolean | Behind a key system, so the code is owner-only. |
| forkedFrom | { slug, version } | null | Details only. |
| viewer | { canEdit, starred } | About you. Details only. |
| urls | object | page, raw (always newest; the named link when the script has a name), rawPinned (this version, by slug) and loadstring (uses raw). Details only. |
Version
ninteger- 1, 2, 3…
messagestring- One-line summary, "" when none.
notesstring- Changelog, "" when none.
sizeBytes, lineCountintegersha256string- Of the code, 64 hex characters.
flagsflag[]- { code, severity, line?, count, hosts? }
sourceenum- Where it was pushed from: web, cli or api.
authoruser | nullcreatedAtdatetimecontentstring- The code. Only from GET …/versions/:n.
| Field | Type | What it is |
|---|---|---|
| n | integer | 1, 2, 3… |
| message | string | One-line summary, "" when none. |
| notes | string | Changelog, "" when none. |
| sizeBytes, lineCount | integer | |
| sha256 | string | Of the code, 64 hex characters. |
| flags | flag[] | { code, severity, line?, count, hosts? } |
| source | enum | Where it was pushed from: web, cli or api. |
| author | user | null | |
| createdAt | datetime | |
| content | string | The code. Only from GET …/versions/:n. |
Flags
Every push is scanned for risky patterns. Flags never block a push; they're hints shown on the script page. severity is info, warn or high.
Errors that every endpoint can return (401, 404, 429, 500…) are on REST API → Errors.
{ "error": { "code": "not_found", "message": "script not found" } }
Stars, forks and reports#
Star or unstar
PUT/api/v1/scripts/:slug/star200PUTstars,DELETEon the same path unstars. Both are safe to repeat. No body.Fork a script
POST/api/v1/scripts/:slug/fork201Copies one version into a new script on your account. The new script's
forkedFrompoints back at the original.Body (all optional)
versionintegertitlestringvisibilityenum403 forbiddenThe script is key protected (and not yours).404 not_foundNo such script or version.Report a script
POST/api/v1/scripts/:slug/reports202Flags a script for the moderators. Always answers
202, even if you (or someone else) reported it already.Body
reasonenumRequireddetailsstringversioninteger