Using the COLLECTIONS CREATE API, you can CREATE Collections to group the records which later, can be fetched usin the Query Builder.
Root
https://api.jsonbin.io/v3
Route
/c
Request Type
POST
Request Headers
Header | Value | Required |
X-Master-Key | <YOUR_SECRET_KEY> | Yes |
X-Collection-Name | My Collection | Yes |
X-Master-Key
X-Master-Key is required to Create a Collection. You can find your X-Master-Key on the API Keys page after signing-in.
X-Collection-Name
X-Collection-Name is required to Name your Collection. You can set a name no more than 32 characters.
Basic Code Samples
curl -v\
-H "X-Collection-Name: My Collection" \
-H "X-Master-key: <YOUR_API_KEY>" \
--request POST \
https://api.jsonbin.io/v3/c
let req = new XMLHttpRequest();
req.onreadystatechange = () => {
if (req.readyState == XMLHttpRequest.DONE) {
console.log(req.responseText);
}
};
req.open("POST", "https://api.jsonbin.io/v3/c", true);
req.setRequestHeader("X-Collection-Name", "My Collection");
req.setRequestHeader("X-Master-Key", "<YOUR_API_KEY>");
req.send();
import requests
url = 'https://api.jsonbin.io/v3/c'
headers = {
'X-Collection-Name': 'My Collection',
'X-Master-Key': '<YOUR_API_KEY>'
}
data = {}
req = requests.post(url, json=data, headers=headers)
print(req.text)
require 'net/http'
require 'json'
uri = URI("https://api.jsonbin.io/v3/c")
res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
req = Net::HTTP::Post.new(uri)
req['X-Collection-Name'] = 'My Collection'
req['X-Master-Key'] = '<YOUR_API_KEY>'
http.request(req)
end
puts res.body
Request Response
Success 200
{
"record": "5ffac64e3fc0f1641870e48c",
"metadata": {
"createdAt": "<DATE/TIME>",
"name": <true/false>
}
}
Error 400, 401, 403
{
"message": "<ERROR_MESSAGE>"
}
Status Code | Error Message |
---|---|
401 Unauthorized |
You need to pass X-Master-Key in the header |
401 Unauthorized |
Invalid X-Master-Key provided |
400 Bad Request |
You need to pass X-Collection-Name header to set a name for the Schema Doc |
400 Bad Request |
Name of the Collection cannot be above 32 characters |
400 Bad Request |
Invalid X-Collection-Id provided |
403 Forbidden |
You cannot create more than 10 collections. Please delete a Collection and try again. |
403 Forbidden |
You cannot create more than 1 collection in Free Trial. Consider upgrading to the Pro plan to create upto 10 collections. |
403 Forbidden |
Requests exhausted. Buy additional requests at https://jsonbin.io/pricing |