Update Collection Name API

Using the Update Collection Name API, you could update the name of your Collection which you've set previously.

Root

https://api.jsonbin.io/v3 

Route

/c/<COLLECTION_ID>/meta/name 

Request Type

PUT

Request Headers

Below are the list of Accepted Request Headers if you are trying to Update the Collection Name.

Request Header Value Required
X-Master-Key <API_KEY> Yes
X-Collection-Name My Collection 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-Collection-Name Required

X-Collection-Name is required to Name your Collection. You can set a name no more than 32 characters.

Code Samples

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

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

req.open("PUT", "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::Put.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 Status Code: 200
{
  "record": "<COLLECTION_ID>",
  "metadata": {
    "name": "My Collection"
  }
}
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
Invalid Collection Id provided

You'll encounter this error when you've passed incorrect Collection Id in the URL. Verify your Collection Id.

You need to pass X-Collection-Name header to set a name for the Schema Doc

Consider passing X-Collection-Name header to update the name of your collection.

X-Collection-Name cannot be blank

You'll encounter this error if the header is passed but no value is set for the Collection Name.

Name of the Collection cannot be above 32 characters

You cannot set a Collection name above 32 characters.

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.

Invalid X-Master-Key provided

You could encounter this error if the X-Master-Key you've passed is invalid. Pass a valid API Key and then try again 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.

You cannot create more than 10 collections. Please delete a Collection and try again.

Collections you could create are limited to 10. You'll encounter the above error if you are trying to create another collection.

Collection not found

Check if the Id is valid and belongs to your account. You'll encounter this error if the Collection you requested to remove the Schema Validation doc of does not exists.

Create a Free Account

Create an Account View Pricing