pasteblox

REST API

Everything the website and the CLI do with your scripts, you can do from your own code: create scripts, push versions, read them back. This page covers the basics every call shares.

Top things to remember

  1. Every endpoint lives under https://pasteblox.com/api/v1. Send and receive JSON.
  2. Sign requests with your API key in the x-api-key header. Never put a key in a Roblox script, a loadstring or anything players can see: anyone with it can push code into your scripts.
  3. Every error has the same shape: { "error": { "code", "message" } }. Branch on code, show message.
  4. On a 429, wait the Retry-After seconds before trying again. Hammering keeps you blocked.
  5. A script is identified by its slug: 10 characters like k3m9x2p7qa. Versions are numbered 1, 2, 3…, and latest works wherever a number does when reading.
  6. Private scripts, and the code of key-protected scripts, are only visible to their owner. Everyone else gets 404, as if they didn't exist.
  7. Lists are paged with an opaque cursor. Keep asking with nextCursor until it's null.

Your first call

  1. 1

    Create an API key

    Go to Dashboard → API keys (more below in API keys). Copy the key, it starts with pbx_.

  2. 2

    Ask who you are

    Requestsh
    curl https://pasteblox.com/api/v1/me \
      -H "x-api-key: $PASTEBLOX_TOKEN"
    Response · 200json
    {
      "user": { "handle": "you", "name": "You", "image": null, "role": "user" },
      "auth": { "method": "api_key", "keyId": "utl7S1TH6DlpzKlqkQjw1YNtCy8y2e9d", "keyName": "github actions" }
    }

    This assumes the key is in an environment variable called PASTEBLOX_TOKEN (export PASTEBLOX_TOKEN=pbx_… on macOS and Linux, $env:PASTEBLOX_TOKEN="pbx_…" in PowerShell). That's the same variable the CLI reads.

  3. 3

    Create a script

    create.mjsjs
    // node 18+, deno, bun or a browser extension: anything with fetch
    const res = await fetch("https://pasteblox.com/api/v1/scripts", {
      method: "POST",
      headers: {
        "x-api-key": process.env.PASTEBLOX_TOKEN,
        "content-type": "application/json",
      },
      body: JSON.stringify({ title: "door", content: 'print("open")' }),
    });
    const data = await res.json();
    if (!res.ok) throw new Error(`${data.error.code}: ${data.error.message}`);
    console.log(data.script.urls.loadstring);

    Every endpoint, with its fields and examples, is on Scripts endpoints.

Base URL and versioning

Base URLhttps://pasteblox.com/api/v1
FormatJSON in and out (content-type: application/json). The one exception is the raw endpoint, which returns plain text.
Max bodyAbout 3 MB per request; a script's content can be up to 512 KB (524,288 bytes of UTF-8).
CachingEvery response is Cache-Control: private, no-store.
TimesISO 8601 in UTC, like 2026-10-20T15:11:04.902Z.

The v1 in the path is the contract the pbx CLI is built on, so it changes carefully. New fields can show up in responses over time: ignore the ones you don't know rather than failing on them.

Authentication

pasteblox looks at a request's headers in this order and uses the first one it finds:

HeaderWho it's forNotes
x-api-key: pbx_…Your programs, CI, botsThe normal way. A wrong, expired or revoked key is always a 401, never treated as logged out.
Authorization: Bearer …The CLI's sign-inA short-lived session token from the browser approval. pbx swaps it for a key right away; you won't need it.
Session cookieThe websiteOnly for reads (GET). Changes always need a key, so no other site can make your browser change your scripts.
x-claim-token: …Anonymous scriptsThe edit token returned once when a script is created without signing in. Lets you push to, edit and delete that one script.

No header at all means anonymous. Anonymous callers can read public and unlisted scripts, create unlisted scripts and report scripts.

API keys

Create them at Dashboard → API keys. A key acts as you, on everything you own, so make one per program and revoke it when you stop using it.

Dashboard → API keys, with a New API key button and one key named github actions · my-game

Dashboard → API keys: New API key (1), and your keys with when they were last used and when they expire (2).

  1. 1

    Name it and pick when it expires

    The New API key dialog: a name field, expiry choices (Never, 30 days, 90 days, 1 year) and Create key

    (1) A name you'll recognise later, like "GitHub Actions · my-game", up to 80 characters. (2) Never, 30 days, 90 days (the default) or 1 year: an expired key gets 401 unauthorized and you make a new one. (3) Create key.

  2. 2

    Copy it now

    The Copy it now dialog, showing the new key once with a Copy button and the PASTEBLOX_TOKEN secret name

    The key is shown this one time. After that pasteblox only keeps a hash of it, so nobody (us included) can show it to you again. Lost it? Revoke it and make another. For GitHub Actions, save it as a secret named PASTEBLOX_TOKEN (walkthrough).

  • The list shows each key's name, when it was last used and when it expires. Revoking is instant (and has a short undo).
  • Keys the CLI and VS Code create when you sign in are listed separately, under Dashboard → CLI devices.
  • A suspended account's keys get 403 forbidden.

Anonymous scripts and claim tokens

Create a script with no key and the response includes a claimToken, exactly once. Send it as x-claim-token to push versions, edit or delete that script. Anonymous scripts are always unlisted. Later, POST /claim with a key moves them into your account (see Claim anonymous scripts).

Rate limits

Limits are token buckets: you can do a burst of requests at once, then they refill at a steady rate. The numbers:

WhatBurstThen refillsCounted per
Any request with an API key300300 per minuteKey
Create or fork a script (signed in)6060 per hourAccount
Create a script (anonymous)1010 per hourIP address
Push a version2010 per minuteScript
Edit or delete a script601 per secondAccount (or IP)
Edit a version's summary601 per secondScript
Star or unstar601 per secondAccount
Report55 per hourAccount (or IP)
Claim anonymous scripts1010 per minuteAccount
Raw code3005 per secondIP address

Reads (getting a script, listing versions, your scripts) only count against the per-key limit. Go over any limit and you get a 429 with a Retry-After header and the same number in the body:

response · 429http
HTTP/1.1 429 Too Many Requests
Retry-After: 12

{ "error": { "code": "rate_limited", "message": "rate limited, retry in 12s", "retryAfter": 12 } }

Wait that many seconds, then retry. A client that keeps retrying right away stays blocked, because blocked requests still count.

Errors

Anything that isn't a 2xx comes back with this body (the raw endpoint too):

Response · 422json
{
  "error": {
    "code": "validation_failed",
    "message": "content: script is empty",
    "issues": [{ "path": "content", "message": "script is empty" }]
  }
}
FieldWhen
codeAlways. One of the codes below; stable, safe to branch on.
messageAlways. A readable sentence; wording may change.
issuesvalidation_failed: one { path, message } per bad field (path like "content" or "tags.2").
retryAfterrate_limited: seconds to wait (also the Retry-After header).
latestVersionversion_conflict: the newest version on pasteblox.
StatusCodeMeans
400bad_requestThe body isn't JSON.
401unauthorizedNo key where one is needed, or the key is wrong, expired or revoked.
403forbiddenYou're signed in but can't do that: not your script, anonymous trying to make a public script, a key-protected fork.
404not_foundNo such script or version, or it's private / deleted. pasteblox doesn't say which.
409conflictThe change doesn't fit the script's state, e.g. making a flagged script public, or restoring one that isn't deleted.
409version_conflictYou sent baseVersion and someone pushed since. latestVersion says where it is now.
410goneA moderator removed the script, or the 30-day restore window has passed.
413payload_too_largeThe script is over 512 KB, or the body is too big.
422validation_failedA field is missing or invalid. See issues.
422invalid_contentThe content was refused. Script endpoints report bad content as validation_failed today, but handle this one too.
429rate_limitedSlow down. See rate limits.
500internalOur fault. Try again in a bit.

Safe pushes with baseVersion

When you push a new version, send the version you started from as baseVersion. If it's not the newest any more, the push is refused instead of overwriting someone's work:

Response · 409json
{
  "error": {
    "code": "version_conflict",
    "message": "version 2 was pushed since your base @1; pull and retry",
    "latestVersion": 2
  }
}

Fetch the newest version, merge, and push again with the new baseVersion. Leave it out to always overwrite. This is exactly what pbx push does, and what --force turns off.

Pagination

List endpoints (GET /me/scripts, GET /scripts/:slug/versions) return one page at a time:

response · 200json
{ "items": [ … ], "nextCursor": "SLgTdr2gACD4pSg54BNYfVFaDr9qHnSBjjAq-W_R7g" }
limitHow many per page: 1 to 100, default 24.
cursorLeave it out for the first page. Then pass the nextCursor you got back.
nextCursornull on the last page. It's opaque: don't build or change one, just pass it back.
every-script.shsh
cursor=""
while :; do
  page=$(curl -s "https://pasteblox.com/api/v1/me/scripts?limit=100&cursor=$cursor" \
    -H "x-api-key: $PASTEBLOX_TOKEN")
  echo "$page" | jq -r '.items[].slug'
  cursor=$(echo "$page" | jq -r '.nextCursor // empty')
  [ -z "$cursor" ] && break
done

Field limits

FieldLimit
content1 byte to 512 KB of UTF-8 text. Not empty or only spaces, no NUL bytes.
title100 characters, one line.
description2,000 characters.
message (a version's summary)200 characters, one line.
notes (a version's changelog)4,000 characters.
game64 characters.
tagsUp to 8. Each 1–24 of a-z, 0-9 and -, lowercased for you; duplicates dropped.
languageluau (default) or lua.
visibilitypublic, unlisted (default) or private.

Where next