· 6 years ago · Jan 13, 2020, 11:32 PM
1<paste_key>0b42rwhf</paste_key>
2 <paste_date>1297953260</paste_date>
3 <paste_title>javascript test</paste_title>
4 <paste_size>15</paste_size>
5 <paste_expire_date>1297956860</paste_expire_date>
6 <paste_private>0</paste_private>
7 <paste_format_long>JavaScript</paste_format_long>
8 <paste_format_short>javascript</paste_format_short>
9 <paste_url>https://pastebin.com/0b42rwhf</paste_url>
10 <paste_hits>15</paste_hits>
11</paste>
12<paste>
13 <paste_key>0C343n0d</paste_key>
14 <paste_date>1297694343</paste_date>
15 <paste_title>Welcome To Pastebin V3</paste_title>
16 <paste_size>490</paste_size>
17 <paste_expire_date>0</paste_expire_date>
18 <paste_private>0</paste_private>
19 <paste_format_long>None</paste_format_long>
20 <paste_format_short>text</paste_format_short>
21 <paste_url>https://pastebin.com/0C343n0d</paste_url>
22 <paste_hits>65</paste_hits>
23</paste>
24Other Possible Good API Responses:
25No pastes found.
26Possible Bad API Responses:
27Bad API request, invalid api_option
28Bad API request, invalid api_dev_key
29Bad API request, invalid api_user_key
30Deleting A Paste Created By A User
31With 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:
32https://pastebin.com/api/api_post.php
33Include all the following POST parameters when you request the url:
341. api_dev_key - this is your API Developer Key, in your case: 78e4bd87056384e587893c6d4275dd1a
352. api_user_key - this is the session key of the logged in user. How to obtain such a key
363. api_paste_key - this is the unique key of the paste you want to delete.
374. api_option - set as 'delete'
38
39Below is a PHP example using curl how to create a valid 'api_user_key':
40$api_dev_key = '78e4bd87056384e587893c6d4275dd1a';
41$api_user_key = '';
42$api_paste_key = '';
43$url = 'https://pastebin.com/api/api_post.php';
44$ch = curl_init($url);
45
46curl_setopt($ch, CURLOPT_POST, true);
47curl_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.'');
48curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
49curl_setopt($ch, CURLOPT_VERBOSE, 1);
50curl_setopt($ch, CURLOPT_NOBODY, 0);
51
52$response = curl_exec($ch);
53echo $response;
54Possible Good API Responses:
55Paste Removed
56Possible Bad API Responses:
57Bad API request, invalid api_option
58Bad API request, invalid api_dev_key
59Bad API request, invalid api_user_key
60Bad API request, invalid permission to remove paste
61Getting A Users Information And Settings
62With 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:
63https://pastebin.com/api/api_post.php
64Include all the following POST parameters when you request the url:
651. api_dev_key - this is your API Developer Key, in your case: 78e4bd87056384e587893c6d4275dd1a
662. api_user_key - this is the session key of the logged in user. How to obtain such a key
673. api_option - set as 'userdetails'
68
69Below is a PHP example using curl how to create a valid 'api_user_key':
70$api_dev_key = '78e4bd87056384e587893c6d4275dd1a';
71$api_user_key = '';
72$url = 'https://pastebin.com/api/api_post.php';
73$ch = curl_init($url);
74
75curl_setopt($ch, CURLOPT_POST, true);
76curl_setopt($ch, CURLOPT_POSTFIELDS, 'api_option=userdetails&api_user_key='.$api_user_key.'&api_dev_key='.$api_dev_key.'');
77curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
78curl_setopt($ch, CURLOPT_VERBOSE, 1);
79curl_setopt($ch, CURLOPT_NOBODY, 0);
80
81$response = curl_exec($ch);
82echo $response;
83Below is an example output of a user information listing:
84<user>
85 <user_name>wiz_kitty</user_name>
86 <user_format_short>text</user_format_short>
87 <user_expiration>N</user_expiration>
88 <user_avatar_url>https://pastebin.com/cache/a/1.jpg</user_avatar_url>
89 <user_private>1</user_private> (0 Public, 1 Unlisted, 2 Private)
90 <user_website>https://myawesomesite.com</user_website>
91 <user_email>oh@dear.com</user_email>
92 <user_location>New York</user_location>
93 <user_account_type>1</user_account_type> (0 normal, 1 PRO)
94</user>