It doesn't have very good error handling right now, but I will update it so that it does.
You can download it here: http://pastebin.com/MpZXv6Hz
You can get a devkey to use it here: http://pastebin.com/api
Here are some examples:
--Logging in and doing stuff.
os.loadAPI("pbapi")
--Pastebin with or without using its API sends passwords in plaintext which you can see if you use wireshark. Sign up with a password you don't use normally!'
local h = pbapi.getUserHandle("your api devkey here","any username here","password for that user")
--Creating a paste:
local url = h.newPaste("paste content here")
--Creating a paste with optional parameters
--0: Public, 1: Unlisted, 2: Private
--Languages are at http://pastebin.com/api#5
--Only certain expire strings are allowed, http://pastebin.com/api#6
local otherurl = h.newPaste("NSString* gato = [[Person getCat] description]","migato (paste title)",2,"objc","10M")
--Listing pastes:
print(textutils.serialise(pbapi.listPastes()))
--Listing trending pastes:
print(textutils.serialise(pbapi.listTrending()))
--Listing user details:
print(textutils.serialise(pbapi.userDetails()))
--Deleting a paste:
h.deletePaste("paste key that belongs to user")
--Finally, reading a paste.
local data = h.rawPaste("public or unlisted paste key, or private paste key belonging to the user.")
There is also pbapi.getGuestHandle which behaves the same, but functions like listPastes that require to be logged in will not work.



