You can Create Private & Public bins using the Create API. By passing optional headers, you can also Create these bins inside a Collection.

Root
https://api.jsonbin.io/v3
Route
/b
Request Type
POST
Request Headers
Header Value Required
Content-Type application/json Yes
X-Master-Key <YOUR_API_KEY> Yes
X-Bin-Private false No
X-Bin-Name <BIN_NAME> No
X-Collection-Id <COLLECTION_ID> No
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.

X-Master-Key

X-Master-Key needs to be passed in-order to Create a bin. In-order to get the key, you need to sign-up and navigate to API Keys page.

X-Bin-Private

By default, bins are created as a Private record. In-order to set the bin as Public, you need to pass the above header with a value of false. These bins can be then Read without passing a X-Master-Key

X-Bin-Name

Creating a bin will generate a Random ID and the same will be shown on the Dashboard. Now this is not that helpful, so to make it easier to recognize your bins, you can name them by passing the above header. You can set a max of 128 character name for your Bin.

X-Collection-Id

Collections are great way to maintain a group of bins, else they stay unsorted. In-order to create a bin under a collection, you need to pass the above header and set the Collection Id as the value in which you would like to create that bin.

Basic Code Samples
curl -v\
  -H "Content-Type: application/json" \
  -H "X-Master-key: <YOUR_API_KEY>" \
  --request POST \
  --data '{"sample": "Hello World"}' \
    https://api.jsonbin.io/v3/b
let req = new XMLHttpRequest();

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

req.open("POST", "https://api.jsonbin.io/v3/b", true);
req.setRequestHeader("Content-Type", "application/json");
req.setRequestHeader("X-Master-Key", "<YOUR_API_KEY>");
req.send('{"sample": "Hello World"}');
import requests
url = 'https://api.jsonbin.io/v3/b'
headers = {
  'Content-Type': 'application/json',
  'X-Master-Key': '<YOUR_API_KEY>'
}
data = {"sample": "Hello World"}

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

uri = URI("https://api.jsonbin.io/v3/b")
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['X-Master-Key'] = '<YOUR_API_KEY>'

  req.body = {"sample": "Hello World"}.to_json
  http.request(req)
end

puts res.body
Request Response
Success
200
{
  "record": {
    "sample": "Hello World"
  },
  "metadata": {
    "id": "<BIN_ID>",
    "createdAt": "<DATE/TIME>",
    "private": <true/false>
  }
}
Error
400, 401, 403
{
  "message": "<ERROR_MESSAGE>"
}
Status Code Error Message
400 Bad Request
You need to pass Content-Type set to application/json
401 Unauthorized
You need to pass X-Master-Key in the header
400 Bad Request
Bin cannot be blank
400 Bad Request
X-Bin-Name cannot be blank or over 128 characters
400 Bad Request
Invalid X-Collection-Id provided
403 Forbidden
Free users cannot create a record over 500kb. Upgrade to Pro plan https://jsonbin.io/pricing to create records upto 1mb
403 Forbidden
Requests exhausted. Buy additional requests at https://jsonbin.io/pricing
400 Bad Request
Collection not found or the Collection does not belong to the X-Master-Key provided
400 Bad Request
Schema Doc Validation Mismatch: key:val
404 Not Found
Bin not found or it doesn't belong to your account