Create Collections API
Group JSON bins using the Collections API. You could later fetch these bins using the Collections Fetch Bins API.
Moreover, you could also use Collections to validate your JSON records using Schema Doc Validation.
You could attach a Schema doc to validate the JSON records before you add them to your Collection.
Root
https://api.jsonbin.io/v3
Route
/c
Request Type
POST
Request Headers
Below are the list of Accepted Request Headers if you are trying to Create a Collection.
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 a required header which sets the Collection Name. You cannot set a name more than 32 characters.
Code Samples
curl -v\
-H "X-Collection-Name: My Collection" \
-H "X-Master-key: <YOUR_API_KEY>" \
--request POST \
https://api.jsonbin.io/v3/c
Request Response
Success Status Code: 200
{
"record": "<RECORD_ID>",
"metadata": {
"createdAt": "<DATE/TIME>",
"name": "<true/false>"
}
}
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
You need to pass X-Collection-Name header to set a name for the Schema Doc
X-Collection-Name header is compulsory to Create a Collection. Hence, pass the header to fix this issue.
Name of the Collection cannot be above 32 characters
When you set the name of the collection using X-Collection-Name, it should not be longer than 32 characters.
Invalid X-Collection-Id provided
Check if the X-Collection-Id is valid and belongs to your account.