Pastebin API
Pastebin API for Developers
Automate paste creation and management with the GistPad API. Create shareable pastes from your applications, scripts, CI workflows and developer tools without having to create each paste manually.
The API supports API-key authentication, paste visibility, expiration, syntax highlighting, categories, folders and other paste-management operations.
What is a Pastebin API?
A Pastebin API allows developers to create and manage text or code pastes programmatically instead of using a web form. This is useful when your application, script or automation needs to generate a paste and receive a shareable URL automatically.
GistPad provides an API designed around this workflow, making it possible to integrate paste sharing into developer tools, automation scripts, debugging workflows and other applications.
Create a Paste with the API
To create a new paste, send a POST request to:
Requests use the X-API-KEY header for authentication and send the paste content as part of the request.
cURL Example
A simple cURL request can create a new paste and return the resulting paste URL.
curl --location 'https://gistpad.com/api/paste/create' \
--header 'Accept: application/json' \
--header 'X-API-KEY: YOUR_API_KEY' \
--form 'content="Hello from the GistPad API"' \
--form 'status="0"' \
--form 'expire="N"' \
--form 'title="API Test Paste"'
PHP Example
The API can also be integrated directly into PHP applications using cURL.
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://gistpad.com/api/paste/create',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => [
'content' => 'Hello from PHP',
'status' => '0',
'expire' => 'N',
'title' => 'PHP API Example'
],
CURLOPT_HTTPHEADER => [
'Accept: application/json',
'X-API-KEY: YOUR_API_KEY'
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
API Parameters
| Parameter | Purpose |
|---|---|
X-API-KEY |
Your developer API key, sent in the request header. |
content |
The text or code that will be stored in the paste. |
title |
Optional title for the paste. |
status |
Controls visibility: Public, Unlisted or Private. |
expire |
Controls how long the paste remains available. |
syntax_id |
Selects the syntax highlighting language. |
category_id |
Assigns a supported paste category. |
password |
Optional password protection for a paste. |
Paste Visibility
Your application can control the visibility of a paste with the status
parameter.
Paste Expiration
GistPad supports several expiration values through the API, including temporary expiration and a never-expire option.
| Value | Duration |
|---|---|
10M |
10 Minutes |
1H |
1 Hour |
1D |
1 Day |
1W |
1 Week |
2W |
2 Weeks |
1M |
1 Month |
6M |
6 Months |
1Y |
1 Year |
N |
Never |
B |
Burn After Read |
A Simple API Workflow
What Can You Build With a Pastebin API?
Other GistPad API Endpoints
GistPad's developer documentation also lists endpoints for additional operations, including listing API-created pastes, deleting pastes, updating pastes and working with raw paste content.
https://gistpad.com/api/my-pastes
https://gistpad.com/api/paste/delete
https://gistpad.com/api/paste/update
https://gistpad.com/api/raw/paste-slug
https://gistpad.com/api/search
https://gistpad.com/api/trending
Protect Your API Key
Treat your API key like a credential. Do not publish it inside client-side JavaScript, public repositories or publicly accessible configuration files.
Keep the key on the server side whenever possible and avoid exposing it in application logs or publicly shared code.
Pastebin API FAQ
Does GistPad have a Pastebin API?
Do I need an API key?
Can I create pastes automatically?
Can I set paste expiration through the API?
Can I control paste visibility?
Where can I find the complete documentation?
Related GistPad Pages
Start Building With the GistPad API
Connect paste sharing to your applications, automation and developer workflows. Read the documentation and start creating pastes programmatically.
Explore the API Documentation