· 6 years ago · Mar 28, 2020, 04:08 PM
1PASTEBIN
2GO API TOOLS FAQ DEALS
3
4paste
5SIGN IN SIGN UP
6Public Pastes
7Diamond Sableye
88 sec ago
9Untitled
1018 sec ago
11Untitled
12C# | 24 sec ago
13Aud3
14Java | 25 sec ago
15Untitled
1627 sec ago
17fdsfdsfds
1830 sec ago
19Untitled
2031 sec ago
21Untitled
2241 sec ago
23
24
25
26
27Looking for our Scraping API? Check out the Scraping API documentation.
28Developers API
29This is the Pastebin.com developers API documentation page. Here you can find all the information you need to get started with our API. If you have questions, feel free to contact us. If you are a developer, and you are building something for Pastebin which might benefit others as well, be sure to contact us, as we might be able to feature your creation on our tools page.
301. Your Unique Developer API Key
312. Creating A New Paste
323. Creating A New Paste, [Required Parameters]
334. Creating A New Paste, [Optional Parameters]
345. Creating A New Paste, The 'api_paste_format' Paramater In Detail
356. Creating A New Paste, The 'api_paste_expire_date' Paramater In Detail
367. Creating A New Paste, The 'api_paste_private' Paramater In Detail
378. Creating An 'api_user_key' Using The API Member Login System
389. Listing Pastes Created By A User
3910. Deleting A Paste Created By A User
4011. Getting A Users Information And Settings
4112. Getting raw paste output of users pastes including 'private' pastes
4213. Getting raw paste output of any 'public' & 'unlisted' pastes
43Your Unique Developer API Key
44Everybody using our API is required to use a valid Developer API Key. You automatically get a key when you become a member of Pastebin. Please login to your account, and return to this page to find your Developer API Key.
45Creating A New Paste
46Creating a new paste via our API is very easy. You simply have to send a valid POST request to the url shown below. Please make sure you are sending the data
47as the UTF-8 charset.
48https://pastebin.com/api/api_post.php
49Below is a PHP example using curl how to create a new paste:
50$api_dev_key = 'YOUR API DEVELOPER KEY'; // your api_developer_key
51$api_paste_code = 'just some random text you :)'; // your paste text
52$api_paste_private = '1'; // 0=public 1=unlisted 2=private
53$api_paste_name = 'justmyfilename.php'; // name or title of your paste
54$api_paste_expire_date = '10M';
55$api_paste_format = 'php';
56$api_user_key = ''; // if an invalid or expired api_user_key is used, an error will spawn. If no api_user_key is used, a guest paste will be created
57$api_paste_name = urlencode($api_paste_name);
58$api_paste_code = urlencode($api_paste_code);
59
60$url = 'https://pastebin.com/api/api_post.php';
61$ch = curl_init($url);
62
63curl_setopt($ch, CURLOPT_POST, true);
64curl_setopt($ch, CURLOPT_POSTFIELDS, 'api_option=paste&api_user_key='.$api_user_key.'&api_paste_private='.$api_paste_private.'&api_paste_name='.$api_paste_name.'&api_paste_expire_date='.$api_paste_expire_date.'&api_paste_format='.$api_paste_format.'&api_dev_key='.$api_dev_key.'&api_paste_code='.$api_paste_code.'');
65curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
66curl_setopt($ch, CURLOPT_VERBOSE, 1);
67curl_setopt($ch, CURLOPT_NOBODY, 0);
68
69$response = curl_exec($ch);
70echo $response;
71Possible Good API Responses: (example)
72https://pastebin.com/UIFdu235s
73Possible Bad API Responses:
74Bad API request, invalid api_option
75Bad API request, invalid api_dev_key
76Bad API request, IP blocked
77Bad API request, maximum number of 25 unlisted pastes for your free account
78Bad API request, maximum number of 10 private pastes for your free account
79Bad API request, api_paste_code was empty
80Bad API request, maximum paste file size exceeded
81Bad API request, invalid api_expire_date
82Bad API request, invalid api_paste_private
83Bad API request, invalid api_paste_format
84Bad API request, invalid api_user_key
85Bad API request, invalid or expired api_user_key
86Creating A New Paste, [Required Parameters]
87Include all the following POST parameters when you request the url:
88
891. api_dev_key - which is your unique API Developers Key.
902. api_option - set as paste, this will indicate you want to create a new paste.
913. api_paste_code - this is the text that will be written inside your paste.
92
93Leaving any of these parameters out will result in an error.
94Creating A New Paste, [Optional Parameters]
95These parameters are not required when you create a new paste, but are possible to add:
96
971. api_user_key - this paramater is part of the login system, which is explained further down the page.
982. api_paste_name - this will be the name / title of your paste.
993. api_paste_format - this will be the syntax highlighting value, which is explained in detail further down the page.
1004. api_paste_private - this makes a paste public, unlisted or private, public = 0, unlisted = 1, private = 2
1015. api_paste_expire_date - this sets the expiration date of your paste, the values are explained futher down the page.
102Creating A New Paste, The 'api_paste_format' Paramater In Detail
103We have over 200 syntax highlighting options available, below you can find a list of all the possible values you can use in combination with api_paste_format. Always include the value on the left from the list below, the value on the right is just the full name of the language in question.
104 4cs = 4CS
105 6502acme = 6502 ACME Cross Asse...
106 6502kickass = 6502 Kick Assembler
107 6502tasm = 6502 TASM/64TASS
108 abap = ABAP
109 actionscript = ActionScript
110 actionscript3 = ActionScript 3
111 ada = Ada
112 aimms = AIMMS
113 algol68 = ALGOL 68
114 apache = Apache Log
115 applescript = AppleScript
116 apt_sources = APT Sources
117 arduino = Arduino
118 arm = ARM
119 asm = ASM (NASM)
120 asp = ASP
121 asymptote = Asymptote
122 autoconf = autoconf
123 autohotkey = Autohotkey
124 autoit = AutoIt
125 avisynth = Avisynth
126 awk = Awk
127 bascomavr = BASCOM AVR
128 bash = Bash
129 basic4gl = Basic4GL
130 dos = Batch
131 bibtex = BibTeX
132 blitzbasic = Blitz Basic
133 b3d = Blitz3D
134 bmx = BlitzMax
135 bnf = BNF
136 boo = BOO
137 bf = BrainFuck
138 c = C
139 c_winapi = C (WinAPI)
140 c_mac = C for Macs
141 cil = C Intermediate Language
142 csharp = C#
143 cpp = C++
144 cpp-winapi = C++ (WinAPI)
145 cpp-qt = C++ (with Qt extensi...
146 c_loadrunner = C: Loadrunner
147 caddcl = CAD DCL
148 cadlisp = CAD Lisp
149 ceylon = Ceylon
150 cfdg = CFDG
151 chaiscript = ChaiScript
152 chapel = Chapel
153 clojure = Clojure
154 klonec = Clone C
155 klonecpp = Clone C++
156 cmake = CMake
157 cobol = COBOL
158 coffeescript = CoffeeScript
159 cfm = ColdFusion
160 css = CSS
161 cuesheet = Cuesheet
162 d = D
163 dart = Dart
164 dcl = DCL
165 dcpu16 = DCPU-16
166 dcs = DCS
167 delphi = Delphi
168 oxygene = Delphi Prism (Oxygene)
169 diff = Diff
170 div = DIV
171 dot = DOT
172 e = E
173 ezt = Easytrieve
174 ecmascript = ECMAScript
175 eiffel = Eiffel
176 email = Email
177 epc = EPC
178 erlang = Erlang
179 euphoria = Euphoria
180 fsharp = F#
181 falcon = Falcon
182 filemaker = Filemaker
183 fo = FO Language
184 f1 = Formula One
185 fortran = Fortran
186 freebasic = FreeBasic
187 freeswitch = FreeSWITCH
188 gambas = GAMBAS
189 gml = Game Maker
190 gdb = GDB
191 genero = Genero
192 genie = Genie
193 gettext = GetText
194 go = Go
195 groovy = Groovy
196 gwbasic = GwBasic
197 haskell = Haskell
198 haxe = Haxe
199 hicest = HicEst
200 hq9plus = HQ9 Plus
201 html4strict = HTML
202 html5 = HTML 5
203 icon = Icon
204 idl = IDL
205 ini = INI file
206 inno = Inno Script
207 intercal = INTERCAL
208 io = IO
209 ispfpanel = ISPF Panel Definition
210 j = J
211 java = Java
212 java5 = Java 5
213 javascript = JavaScript
214 jcl = JCL
215 jquery = jQuery
216 json = JSON
217 julia = Julia
218 kixtart = KiXtart
219 kotlin = Kotlin
220 latex = Latex
221 ldif = LDIF
222 lb = Liberty BASIC
223 lsl2 = Linden Scripting
224 lisp = Lisp
225 llvm = LLVM
226 locobasic = Loco Basic
227 logtalk = Logtalk
228 lolcode = LOL Code
229 lotusformulas = Lotus Formulas
230 lotusscript = Lotus Script
231 lscript = LScript
232 lua = Lua
233 m68k = M68000 Assembler
234 magiksf = MagikSF
235 make = Make
236 mapbasic = MapBasic
237 markdown = Markdown
238 matlab = MatLab
239 mirc = mIRC
240 mmix = MIX Assembler
241 modula2 = Modula 2
242 modula3 = Modula 3
243 68000devpac = Motorola 68000 HiSof...
244 mpasm = MPASM
245 mxml = MXML
246 mysql = MySQL
247 nagios = Nagios
248 netrexx = NetRexx
249 newlisp = newLISP
250 nginx = Nginx
251 nim = Nim
252 text = None
253 nsis = NullSoft Installer
254 oberon2 = Oberon 2
255 objeck = Objeck Programming L...
256 objc = Objective C
257 ocaml = OCaml
258 ocaml-brief = OCaml Brief
259 octave = Octave
260 oorexx = Open Object Rexx
261 pf = OpenBSD PACKET FILTER
262 glsl = OpenGL Shading
263 oobas = Openoffice BASIC
264 oracle11 = Oracle 11
265 oracle8 = Oracle 8
266 oz = Oz
267 parasail = ParaSail
268 parigp = PARI/GP
269 pascal = Pascal
270 pawn = Pawn
271 pcre = PCRE
272 per = Per
273 perl = Perl
274 perl6 = Perl 6
275 php = PHP
276 php-brief = PHP Brief
277 pic16 = Pic 16
278 pike = Pike
279 pixelbender = Pixel Bender
280 pli = PL/I
281 plsql = PL/SQL
282 postgresql = PostgreSQL
283 postscript = PostScript
284 povray = POV-Ray
285 powerbuilder = PowerBuilder
286 powershell = PowerShell
287 proftpd = ProFTPd
288 progress = Progress
289 prolog = Prolog
290 properties = Properties
291 providex = ProvideX
292 puppet = Puppet
293 purebasic = PureBasic
294 pycon = PyCon
295 python = Python
296 pys60 = Python for S60
297 q = q/kdb+
298 qbasic = QBasic
299 qml = QML
300 rsplus = R
301 racket = Racket
302 rails = Rails
303 rbs = RBScript
304 rebol = REBOL
305 reg = REG
306 rexx = Rexx
307 robots = Robots
308 rpmspec = RPM Spec
309 ruby = Ruby
310 gnuplot = Ruby Gnuplot
311 rust = Rust
312 sas = SAS
313 scala = Scala
314 scheme = Scheme
315 scilab = Scilab
316 scl = SCL
317 sdlbasic = SdlBasic
318 smalltalk = Smalltalk
319 smarty = Smarty
320 spark = SPARK
321 sparql = SPARQL
322 sqf = SQF
323 sql = SQL
324 standardml = StandardML
325 stonescript = StoneScript
326 sclang = SuperCollider
327 swift = Swift
328 systemverilog = SystemVerilog
329 tsql = T-SQL
330 tcl = TCL
331 teraterm = Tera Term
332 thinbasic = thinBasic
333 typoscript = TypoScript
334 unicon = Unicon
335 uscript = UnrealScript
336 upc = UPC
337 urbi = Urbi
338 vala = Vala
339 vbnet = VB.NET
340 vbscript = VBScript
341 vedit = Vedit
342 verilog = VeriLog
343 vhdl = VHDL
344 vim = VIM
345 visualprolog = Visual Pro Log
346 vb = VisualBasic
347 visualfoxpro = VisualFoxPro
348 whitespace = WhiteSpace
349 whois = WHOIS
350 winbatch = Winbatch
351 xbasic = XBasic
352 xml = XML
353 xorg_conf = Xorg Config
354 xpp = XPP
355 yaml = YAML
356 z80 = Z80 Assembler
357 zxbasic = ZXBasic
358
359Creating A New Paste, The 'api_paste_expire_date' Paramater In Detail
360We have 9 valid values available which you can use with the api_paste_expire_date parameter:
361 N = Never
362 10M = 10 Minutes
363 1H = 1 Hour
364 1D = 1 Day
365 1W = 1 Week
366 2W = 2 Weeks
367 1M = 1 Month
368 6M = 6 Months
369 1Y = 1 Year
370Creating A New Paste, The 'api_paste_private' Paramater In Detail
371We have 3 valid values available which you can use with the api_paste_private parameter:
372 0 = Public
373 1 = Unlisted
374 2 = Private (only allowed in combination with api_user_key, as you have to be logged into your account to access the paste)
375Creating An 'api_user_key' Using The API Member Login System
376With this API we allow you to create applications which use the Pastebin members system. Sending a valid POST request to our API login system will return a unique api_user_key which can then be used to create a paste as a logged in user. Please send the request to the link shown below:
377https://pastebin.com/api/api_login.php
378Include all the following POST parameters when you request the url:
3791. api_dev_key - this is your API Developer Key, in your case: YOUR API DEVELOPER KEY
3802. api_user_name - this is the username of the user you want to login.
3813. api_user_password - this is the password of the user you want to login.
382
383If all 3 values match, a valid user session key will be returned. This key can be used as the api_user_key paramater. Only one key can be active at the same time for the same user. This key does not expire, unless a new one is generated. We recommend creating just one, then caching that key locally as it does not expire.
384
385Below is a PHP example using curl how to create a valid api_user_key:
386$api_dev_key = 'YOUR API DEVELOPER KEY';
387$api_user_name = 'a_users_username';
388$api_user_password = 'a_users_password';
389$api_user_name = urlencode($api_user_name);
390$api_user_password = urlencode($api_user_password);
391$url = 'https://pastebin.com/api/api_login.php';
392$ch = curl_init($url);
393
394curl_setopt($ch, CURLOPT_POST, true);
395curl_setopt($ch, CURLOPT_POSTFIELDS, 'api_dev_key='.$api_dev_key.'&api_user_name='.$api_user_name.'&api_user_password='.$api_user_password.'');
396curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
397curl_setopt($ch, CURLOPT_VERBOSE, 1);
398curl_setopt($ch, CURLOPT_NOBODY, 0);
399
400$response = curl_exec($ch);
401echo $response;
402Possible Good API Responses: (example)
4036c6d3fe13b19bbd6e479b705df0a607f
404Possible Bad API Responses:
405Bad API request, use POST request, not GET
406Bad API request, invalid api_dev_key
407Bad API request, invalid login
408Bad API request, account not active
409Bad API request, invalid POST parameters
410If you quickly need to create a personal api_user_key, you can use this form to generate one.
411Listing Pastes Created By A User
412With this API you can list all the pastes created by a certain user. You will need send a valid POST request to the url below to access the data:
413https://pastebin.com/api/api_post.php
414Include all the following POST parameters when you request the url:
4151. api_dev_key - this is your API Developer Key, in your case: YOUR API DEVELOPER KEY
4162. api_user_key - this is the session key of the logged in user. How to obtain such a key
4173. api_results_limit - this is not required, by default its set to 50, min value is 1, max value is 1000
4184. api_option - set as 'list'
419
420Below is a PHP example using curl how to list pastes:
421$api_dev_key = 'YOUR API DEVELOPER KEY';
422$api_user_key = '';
423$api_results_limit = '100';
424$url = 'https://pastebin.com/api/api_post.php';
425$ch = curl_init($url);
426
427curl_setopt($ch, CURLOPT_POST, true);
428curl_setopt($ch, CURLOPT_POSTFIELDS, 'api_option=list&api_user_key='.$api_user_key.'&api_dev_key='.$api_dev_key.'&api_results_limit='.$api_results_limit.'');
429curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
430curl_setopt($ch, CURLOPT_VERBOSE, 1);
431curl_setopt($ch, CURLOPT_NOBODY, 0);
432
433$response = curl_exec($ch);
434echo $response;
435Below is an example output of a users paste listing:
436<paste>
437 <paste_key>0b42rwhf</paste_key>
438 <paste_date>1297953260</paste_date>
439 <paste_title>javascript test</paste_title>
440 <paste_size>15</paste_size>
441 <paste_expire_date>1297956860</paste_expire_date>
442 <paste_private>0</paste_private>
443 <paste_format_long>JavaScript</paste_format_long>
444 <paste_format_short>javascript</paste_format_short>
445 <paste_url>https://pastebin.com/0b42rwhf</paste_url>
446 <paste_hits>15</paste_hits>
447</paste>
448<paste>
449 <paste_key>0C343n0d</paste_key>
450 <paste_date>1297694343</paste_date>
451 <paste_title>Welcome To Pastebin V3</paste_title>
452 <paste_size>490</paste_size>
453 <paste_expire_date>0</paste_expire_date>
454 <paste_private>0</paste_private>
455 <paste_format_long>None</paste_format_long>
456 <paste_format_short>text</paste_format_short>
457 <paste_url>https://pastebin.com/0C343n0d</paste_url>
458 <paste_hits>65</paste_hits>
459</paste>
460Other Possible Good API Responses:
461No pastes found.
462Possible Bad API Responses:
463Bad API request, invalid api_option
464Bad API request, invalid api_dev_key
465Bad API request, invalid api_user_key
466Deleting A Paste Created By A User
467With this API you can delete pastes created by certain users. You will need to send a valid POST request to the url below to access the data:
468https://pastebin.com/api/api_post.php
469Include all the following POST parameters when you request the url:
4701. api_dev_key - this is your API Developer Key, in your case: YOUR API DEVELOPER KEY
4712. api_user_key - this is the session key of the logged in user. How to obtain such a key
4723. api_paste_key - this is the unique key of the paste you want to delete.
4734. api_option - set as 'delete'
474
475Below is a PHP example using curl how to create a valid 'api_user_key':
476$api_dev_key = 'YOUR API DEVELOPER KEY';
477$api_user_key = '';
478$api_paste_key = '';
479$url = 'https://pastebin.com/api/api_post.php';
480$ch = curl_init($url);
481
482curl_setopt($ch, CURLOPT_POST, true);
483curl_setopt($ch, CURLOPT_POSTFIELDS, 'api_option=delete&api_user_key='.$api_user_key.'&api_dev_key='.$api_dev_key.'&api_paste_key='.$api_paste_key.'');
484curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
485curl_setopt($ch, CURLOPT_VERBOSE, 1);
486curl_setopt($ch, CURLOPT_NOBODY, 0);
487
488$response = curl_exec($ch);
489echo $response;
490Possible Good API Responses:
491Paste Removed
492Possible Bad API Responses:
493Bad API request, invalid api_option
494Bad API request, invalid api_dev_key
495Bad API request, invalid api_user_key
496Bad API request, invalid permission to remove paste
497Getting A Users Information And Settings
498With this API you can obtain a users personal information and certain settings. You will need to send a valid POST request to the url below to access the data:
499https://pastebin.com/api/api_post.php
500Include all the following POST parameters when you request the url:
5011. api_dev_key - this is your API Developer Key, in your case: YOUR API DEVELOPER KEY
5022. api_user_key - this is the session key of the logged in user. How to obtain such a key
5033. api_option - set as 'userdetails'
504
505Below is a PHP example using curl how to create a valid 'api_user_key':
506$api_dev_key = 'YOUR API DEVELOPER KEY';
507$api_user_key = '';
508$url = 'https://pastebin.com/api/api_post.php';
509$ch = curl_init($url);
510
511curl_setopt($ch, CURLOPT_POST, true);
512curl_setopt($ch, CURLOPT_POSTFIELDS, 'api_option=userdetails&api_user_key='.$api_user_key.'&api_dev_key='.$api_dev_key.'');
513curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
514curl_setopt($ch, CURLOPT_VERBOSE, 1);
515curl_setopt($ch, CURLOPT_NOBODY, 0);
516
517$response = curl_exec($ch);
518echo $response;
519Below is an example output of a user information listing:
520<user>
521 <user_name>wiz_kitty</user_name>
522 <user_format_short>text</user_format_short>
523 <user_expiration>N</user_expiration>
524 <user_avatar_url>https://pastebin.com/cache/a/1.jpg</user_avatar_url>
525 <user_private>1</user_private> (0 Public, 1 Unlisted, 2 Private)
526 <user_website>https://myawesomesite.com</user_website>
527 <user_email>oh@dear.com</user_email>
528 <user_location>New York</user_location>
529 <user_account_type>1</user_account_type> (0 normal, 1 PRO)
530</user>
531Possible Bad API Responses:
532Bad API request, invalid api_option
533Bad API request, invalid api_dev_key
534Bad API request, invalid api_user_key
535Getting raw paste output of users pastes including 'private' pastes
536With this API you can obtain the raw paste output of a users pastes, including private pastes:
537https://pastebin.com/api/api_raw.php
538Include all the following POST parameters when you request the url:
5391. api_dev_key - this is your API Developer Key, in your case: YOUR API DEVELOPER KEY
5402. api_user_key - this is the session key of the logged in user. How to obtain such a key
5413. api_paste_key - this is paste key you want to fetch the data from.
5424. api_option - set as 'show_paste'
543
544Below is a PHP example using curl how to fetch a users raw paste output:
545$api_dev_key = 'YOUR API DEVELOPER KEY';
546$api_user_key = '';
547$url = 'https://pastebin.com/api/api_raw.php';
548$ch = curl_init($url);
549
550curl_setopt($ch, CURLOPT_POST, true);
551curl_setopt($ch, CURLOPT_POSTFIELDS, 'api_option=show_paste&api_user_key='.$api_user_key.'&api_dev_key='.$api_dev_key.'&api_paste_key=A_VALID_PASTE_KEY_HERE');
552curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
553curl_setopt($ch, CURLOPT_VERBOSE, 1);
554curl_setopt($ch, CURLOPT_NOBODY, 0);
555
556$response = curl_exec($ch);
557echo $response;
558Possible Bad API Responses:
559Bad API request, invalid api_option
560Bad API request, invalid api_dev_key
561Bad API request, invalid api_user_key
562Bad API request, invalid permission to view this paste or invalid api_paste_key
563Getting raw paste output of any 'public' & 'unlisted' pastes
564This option is actually not part of our API, but you might still want to use it. To get the raw output of any public or unlisted paste you can use our raw data output url:
565https://pastebin.com/raw/
566Simply add the paste_key at the end of that url and you will get the raw output.
567TIP: If you are trying to scrape our content, check out our scraping API.
568
569
570create new paste / dealsnew! / syntax languages / archive / faq / tools / night mode / api / scraping api
571privacy statement / cookies policy / terms of service / security disclosure / dmca / contact
572
573By using Pastebin.com you agree to our cookies policy to enhance your experience.
574Site design & logo © 2020 Pastebin; user contributions (pastes) licensed under cc by-sa 3.0 Dedicated Server Hosting by Steadfast
575
576
577Top