Using the CREATE API, you can Create Schema Docs.

Root
https://api.jsonbin.io/
Route
/s
Request Type
POST
Request Headers
Header Value Required
Content-Type application/json Yes
secret-key <YOUR_SECRET_KEY> Yes
name <YOUR_SCHEMA_DOC_NAME> Yes
Content-Type

Content-Type needs to be set to application/json. The request will result in an error in-case of a missing Content-Type header.

secret-key

secret-key is always required to create a Schema Doc.

name

In-order to set a name for the Schema Doc, you need to pass this header with a name. Character limit is more than 2 characters and less than equal to 32 characters.

Important

Not passing a $schema key in the body will be validated against Schema Draft 6.

Basic Code Samples
curl --header "Content-Type: application/json" \
     --header "name: Person Schema" \
     --header "secret-key: <YOUR_SECRET_KEY>" \
     --request POST \
     --data '{ "$id": "https://example.com/geographical-location.schema.json", "$schema": "http://json-schema.org/draft-07/schema#", "title": "Longitude and Latitude Values", "description": "A geographical coordinate.", "required": [ "latitude", "longitude" ], "type": "object", "properties": { "latitude": { "type": "number", "minimum": -90, "maximum": 90 }, "longitude": { "type": "number", "minimum": -180, "maximum": 180 } } }' \
        https://api.jsonbin.io/s
                    
let req = new XMLHttpRequest();

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

req.open("POST", "https://api.jsonbin.io/s", true);
req.setRequestHeader("Content-type", "application/json");
req.setRequestHeader("secret-key", "<YOUR_SECRET_KEY>");
req.send('{ "$id": "https://example.com/geographical-location.schema.json", "$schema": "http://json-schema.org/draft-07/schema#", "title": "Longitude and Latitude Values", "description": "A geographical coordinate.", "required": [ "latitude", "longitude" ], "type": "object", "properties": { "latitude": { "type": "number", "minimum": -90, "maximum": 90 }, "longitude": { "type": "number", "minimum": -180, "maximum": 180 } } }');
import requests
url = 'https://api.jsonbin.io/s'
headers = {'Content-Type': 'application/json'}
headers = {'secret-key': '<YOUR_SECRET_KEY>'}
data = { "$id": "https://example.com/geographical-location.schema.json", "$schema": "http://json-schema.org/draft-07/schema#", "title": "Longitude and Latitude Values", "description": "A geographical coordinate.", "required": [ "latitude", "longitude" ], "type": "object", "properties": { "latitude": { "type": "number", "minimum": -90, "maximum": 90 }, "longitude": { "type": "number", "minimum": -180, "maximum": 180 } } }

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

uri = URI("https://api.jsonbin.io/s")
res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
  req = Net::HTTP::Post.new(uri)
  req['Content-Type'] = 'application/json'
  req['secret-key'] = '<YOUR_SECRET_KEY>'

  req.body = { "$id": "https://example.com/geographical-location.schema.json", "$schema": "http://json-schema.org/draft-07/schema#", "title": "Longitude and Latitude Values", "description": "A geographical coordinate.", "required": [ "latitude", "longitude" ], "type": "object", "properties": { "latitude": { "type": "number", "minimum": -90, "maximum": 90 }, "longitude": { "type": "number", "minimum": -180, "maximum": 180 } } }.to_json
  http.request(req)
end

puts res.body
Request Response
Success
200
{
  "success":true,
  "data":{
    "$id": "https://example.com/geographical-location.schema.json",
    "$schema": "http://json-schema.org/draft-07/schema#",
    "title": "Longitude and Latitude Values",
    "description": "A geographical coordinate.",
    "required": [ "latitude", "longitude" ],
    "type": "object",
    "properties": {
      "latitude": {
        "type": "number",
        "minimum": -90,
        "maximum": 90
      },
      "longitude": {
        "type": "number",
        "minimum": -180,
        "maximum": 180
      }
    }
  },
  "id":"<SCHEMA_ID>"
}
Error
401, 422
Status Code Error Message
422 Unprocessible Entity
Expected content type - application/json

Fix: You need to pass Content-Type: application/json in the headers.

422 Unprocessible Entity
You need to provide a name for the Schema Document

Fix: You need to pass a name header for your Schema Doc. This header is required always.

422 Unprocessible Entity
Name key cannot be blank.

Fix: Ensure you add some value to the name header when Creating a Schema Doc.

422 Unprocessible Entity
Schema Doc Name length should be more than 2 characters and less than 33 characters

Fix: I think the above message is descriptive enough to help you how to fix.

422 Unprocessible Entity
Schema cannot be empty

Fix: Add some valid Schema to your Schema Doc for Validation.

422 Unprocessible Entity
Dynamic Errors (Schema Validation Related)

Fix: Ensure that the Schema Doc you are trying to store is Valid.

401 Unauthorized
Invalid secret key provided.

Fix: Ensure that you are passing a valid secret-key in the headers.

401 Unauthorized
Need to provide a secret-key to CREATE a Schema

Fix: Ensure that you are passing secret-key header when creating a Schema Doc.