Read Bins API
The bins you store on JSONBin.io, either Uncategorized or in a Collection can be Read using the Read Bins API.
The API allows you to Read Public & Private Bins. Moreover, using this API, you could also Read Versions of a specific Bin.
Root
https://api.jsonbin.io/v3
Route
Read a specific Bin
/b/<BIN_ID>
Read a specific Bin Version
/b/<BIN_ID>/<BIN_VERSION>
Disable Meta Data using Query Parameter instead of X-Bin-Meta header
/b/<BIN_ID>?meta=false
Info You can use meta query parameter with any of the READ API path if you wish to disable the metadata of the header.
Read Latest Version of the Bin (without the need of specifying the exact version)
/b/<BIN_ID>/latest
Info Using /latest will always return the latest version of the bin.
Request Type
GET
Request Headers
Below are the list of Accepted Request Headers if you are trying to Read a JSON record.
Request Header | Value | Required |
---|---|---|
X-Master-Key | <API_KEY> | Yes |
X-Access-Key | <ACCESS_KEY> | Yes |
X-Bin-Meta | <true / false> | No |
X-JSON-Path | <JSON_ACCESSOR> | No |
X-Master-Key Required
X-Master-Key is nothing but your Core API Access Key. You will need this Key to access mostly any API end-point on JSONBin. You could find the key on the API Keys page.
X-Access-Key Required
You can now access your private records with X-Access-Key header too. Refer to the FAQs for more information on X-Access-Key. Make sure you've granted Bins Read Access Permission to the Access Key you'll be using. You can create Access Keys on API Keys page.
X-Bin-Meta Optional
You may pass X-Bin-Meta header with a value of false. Doing this will omit all the metadata of the bin and will simply return the data you have stored.
X-JSON-Path Optional
Using X-JSON-Path, you could access specific data from the bin instead of the entire bin. To access a particular data, you could use JSON accessors, like, for eg, users[0].firstName.
For in-depth documentation on suported JSONPath rules, refer to the JSON Path Documentation.
Request Query Parameters
Query Parameter | Value | Required |
---|---|---|
meta | <true/false> | No |
meta Optional
If your application or a tool doesn't allow you to set the header in the request, you can control the metadata using the meta query parameter.
You can disable bin meta by setting the query param to false.
Code Samples
curl -v\
-H "X-Master-key: <YOUR_API_KEY>" \
--request GET \
https://api.jsonbin.io/v3/b/<BIN_ID>/<BIN_VERSION | latest>
Request Response
Success Status Code: 200
With Meta Data
{
"record": {
"sample": "Hello World"
},
"metadata": {
"id": "<BIN_ID>",
"private": true
}
}
Without Meta Data (using X-Bin-Meta: false header) or meta=false query parameter
{
"sample": "Hello World"
}
Important If you've passed X-JSON-Path header, it will always return an array of elements under "records" key if the provided JSON Path expression matches any element(s) in the bin, or an empty array if none were matched.
Error Status Code: 400, 401, 403, 404
{
"message": "<Error Message>"
}
For more information on the error codes & errors you might possibly encounter, refer to the below section.
Error Reference
Invalid Bin Id provided
You'll encounter this error if the Bin Id you are trying to access is invalid. Hence, ensure that the Bin Id you are passing is valid.
Bin version is invalid
Bin version you are trying to access is not valid.
Invalid X-JSON-Path expression passed
You'll encounter this error if you've have passed incorrect JSON Path expression.