Create Schema Docs API

Collections are a powerful way to group your JSON records. Not only it helps with grouping the JSON records but you could also enable Schema Validation for the JSON records created in those specific collections.

If you are looking to Store a JSON record, then you need to use the Create Bins API.

Using the Create Schema Docs API, you could create JSON Validation Schema Docs which you could attach it with specific Collections using the Add A Schema API.




Request Type


Request Headers

Below are the list of Accepted Request Headers if you are trying to Create a Schema Doc.

Request Header Value Required
Content-Type application/json Yes
X-Master-Key <X-Master-Key> Yes
X-Schema-Doc-Name Sample Schema Doc Yes
Content-Type Required

Set the Content-Type header to application/json. This needs to be passed with every POST request you make on the Create Schema Doc Route. Failing to pass this in the Header will result in an error.

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-Schema-Doc-Name Required

Using the X-Schema-Doc-Name, you could set the name for the Schema Doc.

Code Samples

  • cURL
  • JavaScript (ES6)
  • Python 3
  • Ruby
curl -v\
    -H "Content-Type: application/json" \
    -H "X-Schema-Doc-Name: User Validation" \
    -H "X-Master-Key: <YOUR_API_KEY>" \
    --request POST \
let req = new XMLHttpRequest();

req.onreadystatechange = () => {
    if (req.readyState == XMLHttpRequest.DONE) {
};"POST", "", true);
req.setRequestHeader("Content-Type", "application/json");
req.setRequestHeader("X-Schema-Doc-Name", "User Validation");
req.setRequestHeader("X-Master-Key", "<YOUR_API_KEY>");
import requests
url = ''
headers = {
    'Content-Type': 'application/json',
    'X-Schema-Doc-Name': 'User Validation',
    'X-Master-Key': '<YOUR_API_KEY>'

req =, json=data, headers=headers)
require 'net/http'
require 'json'

uri = URI("")
res = Net::HTTP.start(, uri.port, use_ssl: true) do |http|
    req =
    req['Content-Type'] = 'application/json'
    req['X-Schema-Doc-Name'] = 'User Validation'
    req['X-Master-Key'] = '<YOUR_API_KEY>'
    req.body = {<SCHEMA_VALIDATION_JSON>}.to_json


puts res.body

Request Response

Success Status Code: 200
"metadata": {
    "id": "<SCHEMA_DOC_ID>",
    "name": "User Validation",
    "createdAt": <DATE / TIME>
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
You need to pass Content-Type set to application/json

You'll encounter this error if you are not passing the Content-Type header. Hence, pass the Content-Type header with a value of application/json.

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

You'll face this error if you are not passing X-Schema-Doc-Name header to set the name for the Schema Doc created.

X-Schema-Doc-Name cannot be blank

As the error message says, you need to pass a name for your Schema Doc.

Name of the Schema Doc cannot be above 32 characters

You'll face the above error if you have passed a long name for your Schema Doc which is above 32 characters.

Schema Doc cannot be empty

Make sure you send a valid Schema Doc JSON in the body. You'll face the above error if the Schema Doc is empty.

Invalid X-Master-Key provided

You'll encounter this error if you are not passing the X-Master-Key header which is required to authenticate your request while creating Schema Docs or you've passed an incorrect key. 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.

Please upgrade to our Pro plan in-order to create a Schema Validation Doc

Free users cannot create Schema Validation docs. Please upgrade to a Pro plan to create Schema Docs. Checkout our Pricing for more info.

You cannot create more than 10 Schema Validation docs. Please delete a Schema Doc and then try again.

You could create up to 10 Schema Validation Docs only.

Requests exhausted. Buy additional requests at

You'll face the above error if your requests are exhausted.

Create a Free Account

Create an Account View Pricing