.:K Paste • API


XML Output
JSON Output

This pastebin API provides the following functions that can be hit by a GET or a POST request. The functions return the result in XML/JSON format depending upon the page to which the HTTP request is made.
Some URLs in this document will not work if the pastebin server does not have URL rewriting enabled. Please check out the .htaccess file here to view all mappings.

API → Create

To create a new paste, you need to send a GET or POST request with certain parameters to http://paste.kani.hu/

Mandatory parameters

  • paste_data - The text to be pasted
  • paste_lang - The development language used
  • api_submit - Set this parameter to true
  • mode - Pass xml or json to this parameter

Optional parameters

  • paste_user - An alphanumeric username of the paste author
  • paste_password - A password string to protect the paste
  • paste_private - Private post flag, having the values: yes or no
  • paste_expire - Time in seconds after which paste will be deleted from server. Set this value to 0 to disable this feature.
  • paste_project - Whether to associate a project with the paste
For a list of supported language codes for the paste_lang parameter, see http://qbnz.com/highlighter/.

Return values on success

  • id - ID of the paste
  • hash - Hash/key for the paste (only for private pastes)
URLs can be framed as http://paste.kani.hu/<id> for public pastes and http://paste.kani.hu/<id>/<hash> for private pastes.

Return values on error

A parameter error with one of these error codes is returned:
  • err_nothing_to_do - No POST request was received by the create API
  • err_author_numeric - The paste author's alias should be alphanumeric
  • err_save_error - An error occurred while saving the paste
  • err_spamguard_ipban - Poster's IP address is banned
  • err_spamguard_stealth - The paste triggered the spam filter
  • err_spamguard_noflood - Poster is trying the flood
  • err_spamguard_php - Poster's IP address is listed as malicious

API → Show

The paste show API listens to both GET and POST requests and returns XML/JSON data. Even though you can use both methods to retrieve all information, we strongly recommend that you use POST when sending password over to the pastebin server.

You can send the http GET request in the following format: http://paste.kani.hu/api/<format>/<id>/<hash>/<password>.
You may send a POST request to http://paste.kani.hu/show.php

Mandatory parameters

  • id - ID of the paste
  • format - The format (xml or json) in which you want the result

Optional parameters

  • hash - Hash/key for the paste (only for private pastes)
  • password - Password to unlock the paste (only for protected pastes)

Return values on success

  • id - ID of the paste
  • author - Author of the paste
  • timestamp - UNIX timestamp representing paste creation time
  • language - Language of the paste data
  • data - The paste data

Return values on error

A parameter error with one of these error codes is returned:
  • err_not_found - Paste not found
  • err_invalid_hash - Invalid hash code
  • err_password_required - Password required to view the paste
  • err_invalid_password - Incorrect password entered

API → List

For getting a list of paste IDs, send a GET request to http://paste.kani.hu/api/<format>/all or http://paste.kani.hu/api/<format>/all/<page>.
For project specific data, use http://paste.kani.hu/~<project>/api/<format>/all/<page> (page is optional).

Mandatory parameters

  • format - The format (xml or json) in which you want the result

Optional parameters

  • project - Project that the paste collection belongs to
  • page - The list page to be fetched

Return values on success

  • pastes - Contains sub-elements like paste1, paste2 etc. each of which have a paste ID
  • count - Number of paste elements enclosed within pastes
  • pages - Total number of pages

Return values on error

A parameter error with one of these error codes is returned:
  • err_no_pastes - No pastes found