Delete Bins API

You can delete your Bins, including the ones in the Collection using Delete Bins API. Deleting these bins will also delete all it's associated versions from our servers completely.

Root

https://api.jsonbin.io/v3 

Route

Delete a specific Bin
/b/<BIN_ID> 

Request Type

DELETE

Request Headers

Below are the list of Accepted Request Headers if you are trying to Delete a JSON record.

Request Header Value Required
X-Master-Key <API_KEY> Yes
X-Access-Key <ACCESS_KEY> 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.

X-Access-Key Required

You can now update your private bins with X-Access-Key header too. Refer to the FAQs for more information on X-Access-Key. Make sure you've granted Bins Update Access Permission to the Access Key you'll be using. You can create Access Keys on API Keys page.

Code Samples

  • cURL
  • JavaScript (ES6)
  • Python 3
  • Ruby
curl -v\
  -H "X-Master-key: <YOUR_API_KEY>" \
  --request DELETE
    https://api.jsonbin.io/v3/b/<BIN_ID>
let req = new XMLHttpRequest();

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

req.open("DELETE", "https://api.jsonbin.io/v3/b/<BIN_ID>", true);
req.setRequestHeader("X-Master-Key", "<YOUR_API_KEY>");
req.send();
import requests
url = 'https://api.jsonbin.io/v3/b/<BIN_ID>'
headers = {
  'X-Master-Key': '<YOUR_API_KEY>'
}

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

uri = URI("https://api.jsonbin.io/v3/b/<BIN_ID>")
res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
  req = Net::HTTP::Delete.new(uri)
  req['X-Master-Key'] = '<YOUR_API_KEY>'

  http.request(req)
end

puts res.body

Request Response

Success Status Code: 200
{
  "metadata": {
    "id": "<BIN_ID>",
    "versionsDeleted": 0
  },
  "message": "Bin deleted successfully"
}
Error Status Code: 400, 401, 403
{
  "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
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

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.

X-Access-Key passed does not have permission to delete the bin.

Make sure you have granted Bins Delete permission to the Access Key before using it to delete bins.

Bin not found or it doesn't belong to your account

You are trying to access a bin which does not exists or it does not belong to your account. Verify the Bin Id and try again.

Requests exhausted. Buy additional requests at https://jsonbin.io/pricing

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

Bin not found or it doesn't belong to your account

Bin you are trying to Delete does not exists or it doesn't belong to your account. Please verify the Bin ID you have passed as well as the X-Master-Key or the X-Access-Key

Create a Free Account

Create an Account View Pricing