API Navigation

Paste API Documentation

The Paste API allows you to programmatically create, retrieve, update, and delete pastes.

Base URL
https://paste.boxlabs.uk/api.php
All API responses are in JSON format. Set Accept: application/json header for best results.

Authentication

All authenticated endpoints require an API key. You can generate and manage API keys from your profile page.

Authentication Methods
Header (Recommended)
X-API-Key: your_api_key_here
Query Parameter
?api_key=your_api_key_here
POST Body
{"api_key": "your_api_key_here"}

Rate Limits

API usage is rate-limited to ensure fair access:

  • 60 requests per minute per API key
  • Rate limit window resets every 60 seconds
Exceeding the limit returns 429 Too Many Requests.

POST Create Paste

Create a new paste with the provided content and optional settings.

Endpoint
POST https://paste.boxlabs.uk/api.php?action=paste
Parameters
Parameter Type Required Description
contentstringRequiredThe main paste content
titlestringOptionalPaste title (default: "Untitled")
syntaxstringOptionalSyntax highlighting (e.g. python, javascript, php)
visibilitystringOptional"public", "unlisted", or "private"
expirystringOptional"10M", "1H", "1D", "1W", "2W", "1M", "never"
Example Request
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"
  }'
Example Response
{
  "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"
  }
}

GET Get Paste

Retrieve an existing paste by its numeric ID or slug.

Endpoint
GET https://paste.boxlabs.uk/api.php?action=get&id={id_or_slug}
Parameters
Parameter Type Required Description
idstringRequiredPaste ID (numeric) or slug
Example Request
curl "https://paste.boxlabs.uk/api.php?action=get&id=aBcDeFgH" \
  -H "X-API-Key: YOUR_API_KEY"
Example Response
{
  "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"
  }
}

PUT Update Paste

Modify an existing paste you own. Only supply the fields you want to change.

Endpoint
POST/PUT https://paste.boxlabs.uk/api.php?action=update&id={id_or_slug}
Parameters
Parameter Type Required Description
idstringRequiredPaste ID or slug to update
contentstringOptionalNew content
titlestringOptionalNew title
syntaxstringOptionalNew syntax
visibilitystringOptionalNew visibility
Example Request
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!\")"}'
Returns same format as Create Paste on success.

DELETE Delete Paste

Permanently delete a paste you own.

Endpoint
DELETE https://paste.boxlabs.uk/api.php?action=delete&id={id_or_slug}
Example Request
curl -X DELETE "https://paste.boxlabs.uk/api.php?action=delete&id=aBcDeFgH" \
  -H "X-API-Key: YOUR_API_KEY"
Example Response
{
  "success": true,
  "message": "Paste deleted successfully"
}

GET List Pastes

Retrieve a paginated list of pastes belonging to the authenticated user.

Endpoint
GET https://paste.boxlabs.uk/api.php?action=list
Parameters
Parameter Type Required Description
limitintegerOptionalResults per page (default: 20, max: 100)
offsetintegerOptionalSkip this many records (default: 0)
Example Request
curl "https://paste.boxlabs.uk/api.php?action=list&limit=10" \
  -H "X-API-Key: YOUR_API_KEY"

GET Search Pastes

Search your own pastes by title or content.

Endpoint
GET https://paste.boxlabs.uk/api.php?action=search&q={query}
Parameters
Parameter Type Required Description
qstringRequiredSearch term (min 2 characters)
limitintegerOptionalMax results (default: 20)

GET User Info

Get basic information about the authenticated account.

Endpoint
GET https://paste.boxlabs.uk/api.php?action=user
Example Response
{
  "success": true,
  "user": {
    "username": "johndoe",
    "email": "john@example.com",
    "paste_count": 42,
    "api_key_count": 2
  }
}

Error Codes

Status Error Description
400Bad RequestInvalid or missing parameters
401UnauthorizedMissing or invalid API key
403ForbiddenNo permission (e.g. not your paste)
404Not FoundPaste does not exist
429Too Many RequestsRate limit exceeded
500Server ErrorInternal server error
Error Response Format
{
  "success": false,
  "error": "Human-readable error message"
}

Code Examples

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'];
?>
Download the Python CLI client

Back to Paste