paste has a simple HTTP API which can be used to read and write pastes programmatically.
Important
If you are using the official instance of paste (https://pastes.dev), please note the following:
- You must provide a
User-Agentheader to uniquely identify your application in all requests. This should include the application name and contact information, e.g.ExampleApp (github.com/ExampleUser/ExampleApp)orMyExampleScript (github.com/ExampleUser). - You must only upload content when prompted by a user action, e.g. a button click or command line input. Automated or scheduled uploads are not allowed.
- An additional terms of service applies. In summary:
- No Illegal Use (no illegal, harmful or unlawful content)
- No Malicious Content (no malware, phishing, personal data without consent, etc.)
- Content Responsibility (you are responsible for what you post)
- Moderation (we reserve the right to remove content or block access)
- No Liability (the service is provided "as is" without warranties)
Otherwise, please enjoy using the service! :)
The base URL for the 'official' paste instance is: https://api.pastes.dev/.
If you are self-hosting, use the base URL of your own instance. With the default Docker Compose setup, this will be http://localhost:8080/data/.
To upload content, send an HTTP POST request to {BASE URL}/post.
- Include the content in the request body.
- Specify the language with the
Content-Type: text/<language>header - If using the official instance, please remember to provide a suitable
User-Agentheader as well. (see above for more details) - The paste "key" is returned in the
Locationheader, and in the response body as a JSON object in the format{"key": "<key>"}.**
To read content, send an HTTP GET request to {BASE URL}/{key}.
- Replace
{key}with the id of the paste. - The content is returned in the response body.
- The
Content-Typeheader istext/<language>, where language is the id of the language the paste was saved with.