The Paste API allows you to programmatically create, retrieve, update, and delete pastes.
https://paste.boxlabs.uk/api.php
Accept: application/json header for best results.
All authenticated endpoints require an API key. You can generate and manage API keys from your profile page.
X-API-Key: your_api_key_here
?api_key=your_api_key_here
{"api_key": "your_api_key_here"}
API usage is rate-limited to ensure fair access:
429 Too Many Requests.
Create a new paste with the provided content and optional settings.
POST https://paste.boxlabs.uk/api.php?action=paste
| Parameter | Type | Required | Description |
|---|---|---|---|
content | string | Required | The main paste content |
title | string | Optional | Paste title (default: "Untitled") |
syntax | string | Optional | Syntax highlighting (e.g. python, javascript, php) |
visibility | string | Optional | "public", "unlisted", or "private" |
expiry | string | Optional | "10M", "1H", "1D", "1W", "2W", "1M", "never" |
curl -X POST "https://paste.boxlabs.uk/api.php?action=paste" \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"content": "print(\"Hello, World!\")",
"title": "My Python Script",
"syntax": "python",
"visibility": "public"
}'
{
"success": true,
"paste": {
"id": 123,
"slug": "aBcDeFgH",
"url": "https://paste.boxlabs.uk/aBcDeFgH",
"title": "My Python Script",
"syntax": "python",
"visibility": "public",
"created_at": "2026-02-03 14:30:00"
}
}
Retrieve an existing paste by its numeric ID or slug.
GET https://paste.boxlabs.uk/api.php?action=get&id={id_or_slug}
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Required | Paste ID (numeric) or slug |
curl "https://paste.boxlabs.uk/api.php?action=get&id=aBcDeFgH" \
-H "X-API-Key: YOUR_API_KEY"
{
"success": true,
"paste": {
"id": 123,
"slug": "aBcDeFgH",
"title": "My Python Script",
"content": "print(\"Hello, World!\")",
"syntax": "python",
"visibility": "public",
"views": 42,
"created_at": "2026-02-03 14:30:00",
"author": "johndoe"
}
}
Modify an existing paste you own. Only supply the fields you want to change.
POST/PUT https://paste.boxlabs.uk/api.php?action=update&id={id_or_slug}
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Required | Paste ID or slug to update |
content | string | Optional | New content |
title | string | Optional | New title |
syntax | string | Optional | New syntax |
visibility | string | Optional | New visibility |
curl -X PUT "https://paste.boxlabs.uk/api.php?action=update&id=aBcDeFgH" \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"title": "Updated Title", "content": "print(\"Updated content!\")"}'
Permanently delete a paste you own.
DELETE https://paste.boxlabs.uk/api.php?action=delete&id={id_or_slug}
curl -X DELETE "https://paste.boxlabs.uk/api.php?action=delete&id=aBcDeFgH" \
-H "X-API-Key: YOUR_API_KEY"
{
"success": true,
"message": "Paste deleted successfully"
}
Retrieve a paginated list of pastes belonging to the authenticated user.
GET https://paste.boxlabs.uk/api.php?action=list
| Parameter | Type | Required | Description |
|---|---|---|---|
limit | integer | Optional | Results per page (default: 20, max: 100) |
offset | integer | Optional | Skip this many records (default: 0) |
curl "https://paste.boxlabs.uk/api.php?action=list&limit=10" \
-H "X-API-Key: YOUR_API_KEY"
Search your own pastes by title or content.
GET https://paste.boxlabs.uk/api.php?action=search&q={query}
| Parameter | Type | Required | Description |
|---|---|---|---|
q | string | Required | Search term (min 2 characters) |
limit | integer | Optional | Max results (default: 20) |
Get basic information about the authenticated account.
GET https://paste.boxlabs.uk/api.php?action=user
{
"success": true,
"user": {
"username": "johndoe",
"email": "john@example.com",
"paste_count": 42,
"api_key_count": 2
}
}
| Status | Error | Description |
|---|---|---|
| 400 | Bad Request | Invalid or missing parameters |
| 401 | Unauthorized | Missing or invalid API key |
| 403 | Forbidden | No permission (e.g. not your paste) |
| 404 | Not Found | Paste does not exist |
| 429 | Too Many Requests | Rate limit exceeded |
| 500 | Server Error | Internal server error |
{
"success": false,
"error": "Human-readable error message"
}
import requests
API_URL = "https://paste.boxlabs.uk/api.php"
API_KEY = "your_api_key_here"
headers = {"X-API-Key": API_KEY}
# Create a paste
response = requests.post(
f"{API_URL}?action=paste",
headers=headers,
json={
"content": "print('Hello, World!')",
"title": "My Python Paste",
"syntax": "python"
}
)
result = response.json()
print(f"Paste URL: {result['paste']['url']}")
# Get a paste
response = requests.get(
f"{API_URL}?action=get&id=aBcDeFgH",
headers=headers
)
paste = response.json()['paste']
print(f"Content: {paste['content']}")
#!/bin/bash
API_URL="https://paste.boxlabs.uk/api.php"
API_KEY="your_api_key_here"
# Create a paste from file
paste_file() {
curl -s -X POST "$API_URL?action=paste" \
-H "X-API-Key: $API_KEY" \
-H "Content-Type: application/json" \
-d "{\"content\": $(cat "$1" | jq -Rs .), \"title\": \"$1\", \"syntax\": \"text\"}"
}
# Create paste from stdin
echo "Hello, World!" | curl -s -X POST "$API_URL?action=paste" \
-H "X-API-Key: $API_KEY" \
-H "Content-Type: application/json" \
-d "{\"content\": \"$(cat)\"}"
const API_URL = 'https://paste.boxlabs.uk/api.php';
const API_KEY = 'your_api_key_here';
// Create a paste
async function createPaste(content, title, syntax) {
const response = await fetch(`${API_URL}?action=paste`, {
method: 'POST',
headers: {
'X-API-Key': API_KEY,
'Content-Type': 'application/json'
},
body: JSON.stringify({ content, title, syntax })
});
return response.json();
}
// Get a paste
async function getPaste(id) {
const response = await fetch(`${API_URL}?action=get&id=${id}`, {
headers: { 'X-API-Key': API_KEY }
});
return response.json();
}
// Usage
createPaste('console.log("Hello!");', 'My JS Paste', 'javascript')
.then(result => console.log('Created:', result.paste.url));
<?php
$api_url = 'https://paste.boxlabs.uk/api.php';
$api_key = 'your_api_key_here';
// Create a paste
$data = [
'content' => '<?php echo "Hello, World!"; ?>',
'title' => 'My PHP Paste',
'syntax' => 'php'
];
$ch = curl_init("$api_url?action=paste");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
"X-API-Key: $api_key",
"Content-Type: application/json"
],
CURLOPT_POSTFIELDS => json_encode($data)
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
echo "Paste URL: " . $response['paste']['url'];
?>