Bin Privacy API

Once you Create a record (which by default is Created as a Private Bin), using the Bin Privacy API, you can change this Permission from Public to Private and vice versa.




Request Type


Request Headers

Below are the list of Accepted Request Headers if you are trying to Modify the Permission of your JSON record.

Request Header Value Required
X-Master-Key <API_KEY> Yes
X-Bin-Private <true/false> Yes
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.


Use this flag to change the Privacy of your Bin. If you pass the value of false, the Bin will be made Public, or pass true to make the bin Private.

Code Samples

  • cURL
  • JavaScript (ES6)
  • Python 3
  • Ruby
curl -v\
-H "X-Master-key: <API_KEY>" \
-H "X-Bin-Private: true" \
--request PUT \
--data '{}' \<BIN_ID>/meta/privacy
let req = new XMLHttpRequest();

req.onreadystatechange = () => {
  if (req.readyState == XMLHttpRequest.DONE) {
};"PUT", "<BIN_ID>/meta/privacy", true);
req.setRequestHeader("X-Bin-Private", "true");
req.setRequestHeader("X-Master-Key", "<API_KEY>");
import requests
url = '<BIN_ID>/meta/privacy'
headers = {
  'X-Bin-Private': 'true',
  'X-Master-Key': '<YOUR_API_KEY>'
data = {}

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

uri = URI("<BIN_ID>/meta/privacy")
res = Net::HTTP.start(, uri.port, use_ssl: true) do |http|
  req =
  req['X-Bin-Private'] = 'true'
  req['X-Master-Key'] = '<YOUR_API_KEY>'

  req.body = {}.to_json

puts res.body

Request Response

Success Status Code: 200
  "record": "RECORD_ID",
  "metadata": {
    "private": true
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

  • 400 Bad Request
  • 401 Unauthorized
  • 403 Forbidden
  • 404 Not Found
You need to provide X-Bin-Private header to change the Bin privacy

This header is compulsory to toggle the privacy of your Bin. If you pass the value of false then your bin will be made public, or pass true which will turn the bin to a Private bin.

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.

You need to pass X-Master-Key in the header to update the visibility of the bin.

You'll encounter this error if you are not passing the X-Master-Key header which is required to authenticate your request while creating bins. In-order to fix this, pass the X-Master-Key header with a value of the API Key which you can find on the API Keys page.

Invalid X-Master-Key provided or the bin does not belong to your account

You could encounter this error if the X-Master-Key you've passed is invalid, or the Bin you are trying to access does exists but does not belong to your account.

Requests exhausted. Buy additional requests at

You'll encounter this error if you've consumed all the available requests. You can purchase additional requests.

Bin not found

Verify the Bin Id and ensure that the Bin belongs to your account.

Create a Free Account

Create an Account View Pricing