API

Create and read bins from scripts and tools. An API key is optional. Without one, new bins are anonymous.

Base URL https://bin.sirblob.co

Authentication

Create a key on the API keys page and send it in the Authorization header. Bins you create with a key show up in your dashboard, and you can read your own private bins.

Authorization: Bearer tb_your_key_here

For password protected bins, send the password in the X-Bin-Password header.

Bins

Create a bin

POST /api/bins API key optional

Creates a new text bin and returns its share link. Without an API key the bin is anonymous. To share an image, use the upload image endpoint.

JSON body

  • content string

    Required The text or code to save. Up to 512 KB.

  • name string

    A title for the bin. Defaults to "Untitled".

  • language string

    A language id from the list below. Defaults to "txt".

  • visibility string

    "link" (default, anyone with the link), "password", or "private" (only you, needs an API key).

  • password string

    Required when visibility is "password". At least 4 characters.

  • expiry string

    When to delete the bin: "never", "10m", "1h", "1d", "1w", "1mo". Defaults to "never". Bins created without an API key are always deleted within 1 week.

  • burnAfterReading boolean

    Delete the bin the first time someone else opens it.

Example request

curl -X POST https://bin.sirblob.co/api/bins \
  -H "Authorization: Bearer $THEBIN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"hello","language":"js","content":"console.log('Hello!')"}'

Responses

201 The bin was created.

201 response
{
  "id": "a1b2c3d4e5",
  "url": "https://bin.sirblob.co/a1b2c3d4e5",
  "rawUrl": "https://bin.sirblob.co/a1b2c3d4e5/raw"
}

400 The content is empty, too large, or the language is unknown.

400 response
{
  "message": "The bin is empty."
}

401 The API key is invalid or has been revoked.

401 response
{
  "message": "The API key is invalid or has been revoked"
}

415 The request body is not JSON.

415 response
{
  "message": "Content-Type must be application/json"
}

Get a bin

GET /api/bins/:id API key optional

Returns a bin and its details as JSON. For image bins, content is null. Send X-Bin-Password for password protected bins, and your API key to read your own private bins.

Path parameters

  • id string

    Required The 10 character bin id from the share link.

Example request

curl https://bin.sirblob.co/api/bins/a1b2c3d4e5

Responses

200 The bin was found.

200 response
{
  "id": "a1b2c3d4e5",
  "name": "hello",
  "language": "js",
  "sizeBytes": 21,
  "visibility": "link",
  "expiresAt": null,
  "burnAfterReading": false,
  "createdAt": "2026-11-27T12:00:00.000Z",
  "updatedAt": "2026-11-27T12:00:00.000Z",
  "content": "console.log('Hello!')",
  "url": "https://bin.sirblob.co/a1b2c3d4e5",
  "rawUrl": "https://bin.sirblob.co/a1b2c3d4e5/raw"
}

401 The bin is password protected and the password is missing or wrong.

401 response
{
  "message": "Send the bin password in the X-Bin-Password header"
}

404 No bin has this id, or it is private.

404 response
{
  "message": "Bin not found"
}

Get raw content

GET /:id/raw

Returns the plain text of a bin, or the image file for image bins. Handy for piping into other tools.

Path parameters

  • id string

    Required The 10 character bin id from the share link.

Example request

curl https://bin.sirblob.co/a1b2c3d4e5/raw

Responses

200 The content as text/plain, or the image with its own content type.

404 No bin has this id.

Images

Upload an image

POST /api/images API key optional

Creates a new image bin. Send the image file as the request body with its image Content-Type. PNG, JPEG, GIF and WebP are accepted.

Query parameters

  • name query string

    A title for the image, passed as ?name=. Defaults to "Untitled".

  • visibility, expiry query string

    The same sharing options as for text bins, passed as ?visibility= and ?expiry=. Send a password in the X-Bin-Password header.

Request body

  • body binary

    Required The raw image file, up to the size limit set by the site admin.

Example request

curl -X POST "https://bin.sirblob.co/api/images?name=screenshot" \
  -H "Content-Type: image/png" \
  --data-binary @screenshot.png

Responses

201 The image was uploaded.

201 response
{
  "id": "a1b2c3d4e5",
  "mimeType": "image/png",
  "sizeBytes": 48213,
  "url": "https://bin.sirblob.co/a1b2c3d4e5",
  "rawUrl": "https://bin.sirblob.co/a1b2c3d4e5/raw"
}

400 The file is empty or is not a PNG, JPEG, GIF or WebP image.

400 response
{
  "message": "Only PNG, JPEG, GIF and WebP images are allowed."
}

413 The image is larger than the size limit.

413 response
{
  "message": "The image is too large. The limit is 2.0 MB."
}

Download an image

GET /api/images/:id API key optional

Returns the image file of an image bin with its original content type.

Path parameters

  • id string

    Required The 10 character bin id from the share link.

Example request

curl -o image.png https://bin.sirblob.co/api/images/a1b2c3d4e5

Responses

200 The image file.

404 No image bin has this id. Text bins return 404 here.

404 response
{
  "message": "Image not found"
}

Your bins

List your bins

GET /api/bins API key required

Returns the bins that belong to your API key, newest first by default. Expired bins are left out.

Query parameters

  • q query string

    Only bins whose name contains this text.

  • language query string

    Only bins with this language id, or "img" for images.

  • sort query string

    "newest", "oldest", "name", "largest" or "views".

  • limit query string

    How many bins to return, up to 100. Defaults to 50.

  • offset query string

    How many bins to skip, for paging.

Example request

curl -H "Authorization: Bearer $THEBIN_API_KEY" \
  "https://bin.sirblob.co/api/bins?sort=views&limit=10"

Responses

200 Your bins. hasMore is true when another page may follow.

200 response
{
  "bins": [
    {
      "id": "a1b2c3d4e5",
      "name": "hello",
      "language": "js",
      "sizeBytes": 21,
      "visibility": "link",
      "expiresAt": null,
      "burnAfterReading": false,
      "viewCount": 12,
      "lastViewedAt": "2026-11-27T13:00:00.000Z",
      "createdAt": "2026-11-27T12:00:00.000Z",
      "updatedAt": "2026-11-27T12:00:00.000Z",
      "url": "https://bin.sirblob.co/a1b2c3d4e5",
      "rawUrl": "https://bin.sirblob.co/a1b2c3d4e5/raw"
    }
  ],
  "limit": 10,
  "offset": 0,
  "hasMore": false
}

401 The API key is missing, invalid or revoked.

401 response
{
  "message": "Send a valid API key in the Authorization header"
}

Update a bin

PATCH /api/bins/:id API key required

Changes one of your bins. Send only the fields you want to change. Image bins can change their name and sharing options.

Path parameters

  • id string

    Required The 10 character bin id from the share link.

JSON body

  • name string

    A new title.

  • content string

    New text content. Text bins only.

  • language string

    A new language id. Text bins only.

  • visibility string

    "link" (default, anyone with the link), "password", or "private" (only you, needs an API key).

  • password string

    A new password. Leave it out to keep the current one.

  • expiry string

    A new expiry, counted from now. Leave it out to keep the current one.

Example request

cURL
curl -X PATCH https://bin.sirblob.co/api/bins/a1b2c3d4e5 \
  -H "Authorization: Bearer $THEBIN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "hello v2", "expiry": "1w"}'

Responses

200 The updated bin.

200 response
{
  "id": "a1b2c3d4e5",
  "name": "hello v2",
  "language": "js",
  "sizeBytes": 21,
  "visibility": "link",
  "expiresAt": null,
  "burnAfterReading": false,
  "viewCount": 12,
  "lastViewedAt": "2026-11-27T13:00:00.000Z",
  "createdAt": "2026-11-27T12:00:00.000Z",
  "updatedAt": "2026-11-27T12:00:00.000Z",
  "url": "https://bin.sirblob.co/a1b2c3d4e5",
  "rawUrl": "https://bin.sirblob.co/a1b2c3d4e5/raw",
  "content": "console.log('Hello!')"
}

400 A value is invalid.

400 response
{
  "message": "Unknown or unsupported language"
}

401 The API key is missing, invalid or revoked.

401 response
{
  "message": "Send a valid API key in the Authorization header"
}

404 No bin with this id belongs to you.

404 response
{
  "message": "Bin not found"
}

Delete a bin

DELETE /api/bins/:id API key required

Deletes one of your bins for good, including its image.

Path parameters

  • id string

    Required The 10 character bin id from the share link.

Example request

cURL
curl -X DELETE -H "Authorization: Bearer $THEBIN_API_KEY" \
  https://bin.sirblob.co/api/bins/a1b2c3d4e5

Responses

204 The bin was deleted. There is no body.

401 The API key is missing, invalid or revoked.

401 response
{
  "message": "Send a valid API key in the Authorization header"
}

404 No bin with this id belongs to you.

404 response
{
  "message": "Bin not found"
}

Replace an image

PUT /api/images/:id API key required

Swaps the image in one of your image bins. The link stays the same. Send the file the same way as when uploading.

Path parameters

  • id string

    Required The 10 character bin id from the share link.

Request body

  • body binary

    Required The new image file with its image Content-Type.

Example request

cURL
curl -X PUT https://bin.sirblob.co/api/images/a1b2c3d4e5 \
  -H "Authorization: Bearer $THEBIN_API_KEY" \
  -H "Content-Type: image/png" \
  --data-binary @new-screenshot.png

Responses

200 The image was replaced.

200 response
{
  "id": "a1b2c3d4e5",
  "mimeType": "image/png",
  "sizeBytes": 51022,
  "url": "https://bin.sirblob.co/a1b2c3d4e5",
  "rawUrl": "https://bin.sirblob.co/a1b2c3d4e5/raw"
}

400 The file is not a supported image, or the bin is a text bin.

400 response
{
  "message": "Only PNG, JPEG, GIF and WebP images are allowed."
}

401 The API key is missing, invalid or revoked.

401 response
{
  "message": "Send a valid API key in the Authorization header"
}

404 No bin with this id belongs to you.

404 response
{
  "message": "Bin not found"
}

Copy a bin

POST /api/bins/:id/copy API key optional

Makes a new text bin with the same content as any bin you can open. With an API key the copy belongs to you. The body is optional.

Path parameters

  • id string

    Required The 10 character bin id from the share link.

JSON body

  • name string

    A title for the copy. Defaults to "Copy of ...".

  • visibility string

    "link" (default, anyone with the link), "password", or "private" (only you, needs an API key).

  • password string

    Required when visibility is "password". At least 4 characters.

  • expiry string

    When to delete the bin: "never", "10m", "1h", "1d", "1w", "1mo". Defaults to "never". Bins created without an API key are always deleted within 1 week.

Example request

cURL
curl -X POST -H "Authorization: Bearer $THEBIN_API_KEY" \
  https://bin.sirblob.co/api/bins/a1b2c3d4e5/copy

Responses

201 The copy was created.

201 response
{
  "id": "f6g7h8i9j0",
  "url": "https://bin.sirblob.co/f6g7h8i9j0",
  "rawUrl": "https://bin.sirblob.co/f6g7h8i9j0/raw"
}

400 Image bins and bins that burn after reading cannot be copied.

400 response
{
  "message": "Image bins cannot be copied"
}

404 No bin has this id, or you cannot open it.

404 response
{
  "message": "Bin not found"
}

Info

Your account

GET /api/me API key required

Shows who an API key belongs to and their usage. A quick way to check that a key works.

Example request

cURL
curl -H "Authorization: Bearer $THEBIN_API_KEY" https://bin.sirblob.co/api/me

Responses

200 The account and its stats.

200 response
{
  "id": "665f1c2e9b1d4a0012345678",
  "name": "Alex",
  "email": "[email protected]",
  "role": "user",
  "stats": {
    "binCount": 42,
    "textCount": 37,
    "imageCount": 5,
    "totalBytes": 1843200,
    "imageBytes": 1720320,
    "recentCount": 6,
    "firstCreatedAt": "2026-01-04T09:30:00.000Z",
    "lastCreatedAt": "2026-11-27T12:00:00.000Z",
    "languages": [
      {
        "language": "js",
        "count": 14
      }
    ]
  }
}

401 The API key is missing, invalid or revoked.

401 response
{
  "message": "Send a valid API key in the Authorization header"
}

List languages

GET /api/languages

Every language id you can use for a text bin, with its display name.

Example request

cURL
curl https://bin.sirblob.co/api/languages

Responses

200 The supported languages.

200 response
{
  "languages": [
    {
      "id": "txt",
      "label": "Text"
    },
    {
      "id": "js",
      "label": "JavaScript"
    }
  ]
}

Get limits

GET /api/limits

The current size limits, rate limit and expiry choices, so tools can check before uploading.

Example request

cURL
curl https://bin.sirblob.co/api/limits

Responses

200 The limits. Sizes are in bytes and times in seconds.

200 response
{
  "maxContentBytes": 524288,
  "maxImageBytes": 2097152,
  "maxNameLength": 100,
  "minBinPasswordLength": 4,
  "allowedImageTypes": [
    "image/png",
    "image/jpeg",
    "image/gif",
    "image/webp"
  ],
  "createRequestsPerMinute": 20,
  "anonymousBinLifetimeSeconds": 604800,
  "expiryChoices": [
    {
      "id": "1h",
      "label": "1 hour",
      "seconds": 3600
    }
  ]
}

Errors

Errors come back as JSON with a message field when the request sends Accept: application/json.

  • 400 The request is missing something or has an invalid value.
  • 401 The API key or bin password is missing or wrong.
  • 404 The bin does not exist, has expired, or is private.
  • 413 The uploaded image is larger than the size limit.
  • 415 The Content-Type is wrong. Bins need application/json, images need an image type.
  • 429 Too many requests. You can create, copy or change up to 20 bins and images per minute.
  • 507 The site has run out of storage space.

Limits

  • Up to 20 new bins and images per minute from each address
  • Text content up to 512 KB per bin
  • Images up to 2.0 MB, as PNG, JPEG, GIF or WebP

Languages

Use one of these ids for the language field.

txt Text
html HTML
css CSS
js JavaScript
ts TypeScript
jsx JSX
tsx TSX
java Java
kt Kotlin
groovy Groovy
scala Scala
cs C#
php PHP
py Python
rb Ruby
perl Perl
lua Lua
r R
julia Julia
c C
cpp C++
objc Objective-C
go Go
rust Rust
swift Swift
dart Dart
hs Haskell
clj Clojure
sh Shell
ps1 PowerShell
sass Sass
less Less
md Markdown
tex LaTeX
typ Typst
json JSON
yaml YAML
toml TOML
ini INI
xml XML
sql SQL
graphql GraphQL
proto Protobuf
docker Dockerfile
nginx Nginx
cmake CMake
diff Diff
vue Vue
svelte Svelte
ang Angular