You can read Private & Public bins using the Read API.
Root
https://api.jsonbin.io/v3
Route (READ a specific Bin)
/b/<BIN_ID>
Route (READ a specific Bin Version)
/b/<BIN_ID>/<BIN_VERSION>
Route (READ the latest Record of a Bin)
/b/<BIN_ID>/latest # Will always return the last Updated record
Request Type
GET
Request Headers
Header | Value | Required |
X-Master-Key | <YOUR_API_KEY> | No |
X-Master-Key
X-Master-Key needs to be passed in-order to Read a Private bin. In-order to get the key, you need to sign-up and navigate to API Keys page.
Basic Code Samples
curl -v\
-H "X-Master-key: <YOUR_API_KEY>" \
--request GET \
https://api.jsonbin.io/v3/b/<BIN_ID>/<BIN_VERSION | latest>
let req = new XMLHttpRequest();
req.onreadystatechange = () => {
if (req.readyState == XMLHttpRequest.DONE) {
console.log(req.responseText);
}
};
req.open("GET", "https://api.jsonbin.io/v3/b/<BIN_ID>/<BIN_VERSION | latest>", true);
req.setRequestHeader("X-Master-Key", "<YOUR_API_KEY>");
req.send();
import requests
url = 'https://api.jsonbin.io/v3/b/<BIN_ID>/<BIN_VERSION | latest>'
headers = {
'X-Master-Key': '<YOUR_API_KEY>'
}
req = requests.get(url, json=None, headers=headers)
print(req.text)
require 'net/http'
require 'json'
uri = URI("https://api.jsonbin.io/v3/b/<BIN_ID>/<BIN_VERSION | latest>")
res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
req = Net::HTTP::Post.new(uri)
req['X-Master-Key'] = '<YOUR_API_KEY>'
http.request()
end
puts res.body
Request Response
Success 200
{
"record": {
"sample": "Hello World"
},
"metadata": {
"id": "<BIN_ID>",
"private": true
}
}
Error 400, 401, 403
{
"message": "<ERROR_MESSAGE>"
}
Status Code | Error Message |
---|---|
400 Bad Request |
Invalid Bin Id provided |
404 Not Found |
Bin not found or it doesn't belong to your account |
403 Not Found |
Bins not associated to any user are now blocked. Contact the admin at https://jsonbin.io/contact for further info |
401 Unauthorised |
You need to pass X-Master-Key in the header to read a private bin |
401 Unauthorised |
X-Master-Key is invalid or the bin doesn't belong to your account |
401 Unauthorised |
Bin not associated to any user account |
400 Bad Request |
Bin version is invalid |
403 Forbidden |
Requests exhausted. Buy additional requests at https://jsonbin.io/pricing |
404 Not Found |
Bin version not found |