About API

As you can see in the about us you can paste using command-line with nc. However, if you need an api to develop apps using our pastebin, you should have api-key! To obtain that, you can contact MohammadAmin Vahedinia from the about us section and get the api-key. After that, you can use this functions:

Variables

Here are variables you may work with them:

Name Type/Len Required/Optional Description
api-key UnicodeString - 255 required your unique api-key, used to authenticate you (and revoke access if you are spamming!)
pasteTitle UnicodeString - 255 optional paste title, what paste is for, default is Untitled
pasteAuthor UnicodeString - 255 optional name of the person who pasted this paste default is Anonymous
pasteLanguage UnicodeString - 10 required what syntax highlighting to use for this paste, valid options are provided with /api/langs
pasteExpire UnicodeString - 10 optional time in seconds to keep paste, default is 0 means keep for ever
pasteRaw LongText required the paste raw text
pasteEncryption UnicodeString - 6 optional which encryption method is used to encrypt paste, default is no, accepted values are no, pgp, passwd
pasteID UnicodeString - 6 required when you want to get some paste's data, it is required
shortURL UnicodeString - 60 not used it is returned in get function

Create Pastes

To create paste, you should send data in json format to /api using POST method. pasteRaw, api-key and pasteLanguage are required and other variables are optional. You will be returned a string called url in json format where url is the url of the newly created paste.

Get Paste

To get an specific paste, you need to just send a GET request to /api/{pasteID} where {pasteID} is the 6-char paste uri, and you will be returned the variables described above in json format.

Get Languages List

To get list of valid syntax highlightings, you need to just send a simple GET request to /api/langs and you be given the list of valid languages as tuples of "shortname", "longname" as langs, and you should send shortname in your requests!

Examples

Create a Paste
import requests
data = {'api-key': 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', 'pasteRaw': 'some text!', 'pasteLanguage': 'text'}
r = requests.post('https://beepaste.io/api', json=data)
Get a Paste
import requests
r = requests.get('https://beepaste.io/api/AAAAAA')