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/
Route
/c
Request Type
POST
Request Headers
Header Value Required
Content-Type application/json Yes
secret-key <YOUR_SECRET_KEY> Yes
Content-Type

Content-Type needs to be set to application/json. The request will result in an error in-case of a missing Content-Type header.

secret-key

secret-key is required to Create a Collection. You can find your secret-key on the API Keys page after signing-in.

Basic Code Samples
curl --header "Content-Type: application/json" \
       --request POST \
       --data '{"name": "Sample Collection"}' \
       https://api.jsonbin.io/c
let req = new XMLHttpRequest();

req.onreadystatechange = () => {
  if (req.readyState == XMLHttpRequest.DONE) {
    console.log(req.responseText);
  }
};

req.open("POST", "https://api.jsonbin.io/c", true);
req.setRequestHeader("Content-type", "application/json");
req.send('{"name": "Sample Collection"}');
import requests
url = 'https://api.jsonbin.io/c'
headers = {'Content-Type': 'application/json'}
data = {"name": "Sample Collection"}

req = requests.post(url, json=data, headers=headers)
print(req.text)
require 'net/http'
require 'json'

uri = URI("https://api.jsonbin.io/c")
res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
  req = Net::HTTP::Post.new(uri)
  req['Content-Type'] = 'application/json'

  req.body = {"name": "Sample Collection"}.to_json
  http.request(req)
end

puts res.body
Request Response
Success
200
{
  "success": true,
  "data": {
    "name": "Sample Collection"
  },
  "id":"<COLLECTION_ID>"
}
Error
401 / 422
{
  "message": "<ERROR_MESSAGE>",
  "success": false
}
Status Code Error Message
422 Unprocessible Entity
Expected content type - application/json

Fix: You need to pass Content-Type: application/json in the headers.

422 Unprocessible Entity
Name key cannot be blank.

Fix: Ensure that you provide some name to the collection.

422 Unprocessible Entity
Collection Name length should be more than 2 characters and less than 33 characters

Fix: Error message says it all :)

422 Unprocessible Entity
You need to provide a name.

Fix: You need to pass name key in the JSON Body of the Request with a Valid Name.

401 Unauthorized
Invalid secret key provided.

Fix: If you are trying to Create a Collection, ensure that the secret-key you are passing in the header is correct.

401 Unauthorized
Need to provide a secret-key to CREATE a Collection.

Fix: While Creating a Collection, you need to pass secret-key header to Create the Collection.