Binbox API (beta)
Using our API is an easy way to earn money through referrals. Each user is given a specific API URL as well as a global API URL for anybody who wants to use our API without an account. By using your API URL, other people can make pastes and you'll earn a percentage of the earnings.
There are two SDKs available for JavaScript and PHP (coming soon) to assist your development.
Your API URL: http://binbox.io/
API requests can be returned in the format of your choosing: XML or JSON. In the following documentation, $format should be replaced with "json" or "xml."
Creating a Short Link
POST http://binbox.io/submit.$format
Parameters
- url
- The URL to be shortened - must be a valid URL
- title (optional)
- Plain text title
- Defaults to "Untitled"
- folder (optional)
- Specify id of the folder where this link should be stored.
- Default is primary folder (0). A JSON-encoded list of your folders can be found here: https://binbox.io/history/folders
Response
{"ok": true, "id": "VV8cu"}
Creating a Paste
POST http://binbox.io/submit.$format
Parameters
- data
- Base64-encoded string of a JSON-object containing the parameters of the encrypted paste contents. Encryption is performed by Stanford Javascript Crypto Library. For more information see How to Encrypt a Paste.
- title (optional)
- Plain text title
- Defaults to "Untitled"
- folder (optional)
- Specify id of the folder where this link should be stored.
- Default is primary folder (0). A JSON-encoded list of your folders can be found here: https://binbox.io/history/folders
Response
{"ok": true, "id": "VV8cu"} {"ok": false, "error": "invalid_encryption"}
Retrieving a Paste
Pastes can be retrieved in either JSON or XML format with the paste's ID (random character string) and for the URL's extension, choose the delivery format.
GET http://binbox.io/$pasteID.$format
Response
{ "ok":true, "paste":{ "id":"VV8cu", "author":"1", "title":"Untitled", "text":"{\"iv\":\"ZADah0db8WIRYGQCnLiYSw\",\"v\":1,\"iter\":1000,\"ks\":128,\"ts\":64,\"mode\":\"ccm\",\"adata\":\"\",\"cipher\":\"aes\",\"salt\":\"rCjpWlptkZk\",\"ct\":\"ZdqU7naTOD54ZTWfXD4k1i0V2T9f59UMfQ\"}", "url":null, "is_deleted":"0", "views":"0", "timestamp":"2013-06-27 17:58:32" }, "author":{ "id":1, "username":"cpt", "joined":"1365881613" }
Encrypting a Paste
To encrypt a paste you must use our JavaScript SDK.