Create/Update Schema
Upset draft version of a JSON schema. Creates a new schema if it doesn’t exist.
curl -X POST "https://management-api.suprsend.com/v1/{workspace}/schema/{schema_slug}/?commit=true&commit_message=Initial%20schema%20creation" \
--header 'Authorization: ServiceToken <token>' \
--header 'Content-Type: application/json' \
--data '{
"name": "Order Placed Event",
"description": "Schema for order placement action",
"json_schema": {
"type": "object",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"required": ["order_id", "amount"],
"properties": {
"order_id": {
"type": "string"
},
"amount": {
"type": "string"
}
},
"additionalProperties": true
}
}'import requests
url = "https://management-api.suprsend.com/v1/{workspace}/schema/{schema_slug}/"
payload = {
"name": "Order Placed Event",
"description": "Schema for order placement action",
"json_schema": {
"type": "object",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"required": ["order_id", "amount"],
"properties": {
"order_id": { "type": "string" },
"amount": { "type": "string" }
},
"additionalProperties": True
}
}
headers = {
"ServiceToken <token>": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'ServiceToken <token>': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Order Placed Event',
description: 'Schema for order placement action',
json_schema: {
type: 'object',
$schema: 'https://json-schema.org/draft/2020-12/schema',
required: ['order_id', 'amount'],
properties: {order_id: {type: 'string'}, amount: {type: 'string'}},
additionalProperties: true
}
})
};
fetch('https://management-api.suprsend.com/v1/{workspace}/schema/{schema_slug}/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://management-api.suprsend.com/v1/{workspace}/schema/{schema_slug}/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Order Placed Event',
'description' => 'Schema for order placement action',
'json_schema' => [
'type' => 'object',
'$schema' => 'https://json-schema.org/draft/2020-12/schema',
'required' => [
'order_id',
'amount'
],
'properties' => [
'order_id' => [
'type' => 'string'
],
'amount' => [
'type' => 'string'
]
],
'additionalProperties' => true
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"ServiceToken <token>: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://management-api.suprsend.com/v1/{workspace}/schema/{schema_slug}/"
payload := strings.NewReader("{\n \"name\": \"Order Placed Event\",\n \"description\": \"Schema for order placement action\",\n \"json_schema\": {\n \"type\": \"object\",\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"required\": [\n \"order_id\",\n \"amount\"\n ],\n \"properties\": {\n \"order_id\": {\n \"type\": \"string\"\n },\n \"amount\": {\n \"type\": \"string\"\n }\n },\n \"additionalProperties\": true\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("ServiceToken <token>", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://management-api.suprsend.com/v1/{workspace}/schema/{schema_slug}/")
.header("ServiceToken <token>", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Order Placed Event\",\n \"description\": \"Schema for order placement action\",\n \"json_schema\": {\n \"type\": \"object\",\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"required\": [\n \"order_id\",\n \"amount\"\n ],\n \"properties\": {\n \"order_id\": {\n \"type\": \"string\"\n },\n \"amount\": {\n \"type\": \"string\"\n }\n },\n \"additionalProperties\": true\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://management-api.suprsend.com/v1/{workspace}/schema/{schema_slug}/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["ServiceToken <token>"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Order Placed Event\",\n \"description\": \"Schema for order placement action\",\n \"json_schema\": {\n \"type\": \"object\",\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"required\": [\n \"order_id\",\n \"amount\"\n ],\n \"properties\": {\n \"order_id\": {\n \"type\": \"string\"\n },\n \"amount\": {\n \"type\": \"string\"\n }\n },\n \"additionalProperties\": true\n }\n}"
response = http.request(request)
puts response.read_body{
"slug": "new-order-placed",
"name": "Order Placed Event",
"description": "Schema for order placement action",
"status": "draft",
"hash": "382b707d4b1f8999a1xxxxxxxx",
"json_schema": {
"type": "object",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"required": [
"order_id",
"amount"
],
"properties": {
"order_id": {
"type": "string"
},
"amount": {
"type": "string"
}
},
"additionalProperties": true
},
"created_at": "2025-08-27T09:30:57.945326Z",
"updated_at": "2025-08-29T15:37:37.650177Z",
"commit_result": {
"is_committed": false,
"errors": [
"hash: no uncommitted changes found"
]
}
}{
"code": 400,
"error_code": "error",
"type": "ValidationError",
"message": "{\"json_schema\": [\"Schema looks like JSON data, not a JSON Schema. Include keywords like '$schema', 'type', 'properties', or '$defs'.\"]}",
"detail": {
"json_schema": [
"Schema looks like JSON data, not a JSON Schema. Include keywords like '$schema', 'type', 'properties', or '$defs'."
]
}
}{
"code": 401,
"error_code": "authentication_failed",
"type": "AuthenticationFailed",
"message": "Invalid service token.",
"detail": "Invalid service token."
}{
"code": 404,
"error_code": "not_found",
"type": "NotFound",
"message": "workspace 'staging4' not found",
"detail": "workspace 'staging4' not found"
}Authorizations
You can get Service Token from SuprSend dashboard -> Account Settings -> Service Tokens section.
Path Parameters
Workspace slug (staging, production, etc.)
Unique identifier of the schema
Query Parameters
Set to true to commit the schema immediately after creation/update
Commit message describing the changes (required when commit=true)
Body
Human-readable name of the schema
"Order Placed Event"
Structure of the workflow or event payload. Follows standard json schema specification. You can link this schema to a workflow or event to validate their input payload in API response. Same schema can be linked to multiple workflows and events.
{
"type": "object",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"required": ["order_id", "amount"],
"properties": {
"order_id": { "type": "string" },
"amount": { "type": "string" }
},
"additionalProperties": true
}
Description of the schema. Can be used to describe which action this schema is linked to.
"Schema for order placement action"
Response
Successfully retrieved schema object
Unique identifier for the schema
"new-order-placed"
Human-readable name of the schema
"Order Placed Event"
Description of the schema
"Schema for order placement action"
Status of returned schema. By default, draft version is returned. You can set mode=live to fetch the live schema.
draft, live "draft"
Git-like hash for version tracking
"382b707d4b1f8999a1xxxxxxxx"
JSON schema passed in the request body.
When the schema was created
"2025-08-27T09:30:57.945326Z"
When the schema was last updated
"2025-08-29T15:37:37.650177Z"
Commit result when commit=true is passed in query parameter
Show child attributes
Show child attributes
{
"is_committed": false,
"errors": ["hash: no uncommitted changes found"]
}
Was this page helpful?
curl -X POST "https://management-api.suprsend.com/v1/{workspace}/schema/{schema_slug}/?commit=true&commit_message=Initial%20schema%20creation" \
--header 'Authorization: ServiceToken <token>' \
--header 'Content-Type: application/json' \
--data '{
"name": "Order Placed Event",
"description": "Schema for order placement action",
"json_schema": {
"type": "object",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"required": ["order_id", "amount"],
"properties": {
"order_id": {
"type": "string"
},
"amount": {
"type": "string"
}
},
"additionalProperties": true
}
}'import requests
url = "https://management-api.suprsend.com/v1/{workspace}/schema/{schema_slug}/"
payload = {
"name": "Order Placed Event",
"description": "Schema for order placement action",
"json_schema": {
"type": "object",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"required": ["order_id", "amount"],
"properties": {
"order_id": { "type": "string" },
"amount": { "type": "string" }
},
"additionalProperties": True
}
}
headers = {
"ServiceToken <token>": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'ServiceToken <token>': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Order Placed Event',
description: 'Schema for order placement action',
json_schema: {
type: 'object',
$schema: 'https://json-schema.org/draft/2020-12/schema',
required: ['order_id', 'amount'],
properties: {order_id: {type: 'string'}, amount: {type: 'string'}},
additionalProperties: true
}
})
};
fetch('https://management-api.suprsend.com/v1/{workspace}/schema/{schema_slug}/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://management-api.suprsend.com/v1/{workspace}/schema/{schema_slug}/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Order Placed Event',
'description' => 'Schema for order placement action',
'json_schema' => [
'type' => 'object',
'$schema' => 'https://json-schema.org/draft/2020-12/schema',
'required' => [
'order_id',
'amount'
],
'properties' => [
'order_id' => [
'type' => 'string'
],
'amount' => [
'type' => 'string'
]
],
'additionalProperties' => true
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"ServiceToken <token>: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://management-api.suprsend.com/v1/{workspace}/schema/{schema_slug}/"
payload := strings.NewReader("{\n \"name\": \"Order Placed Event\",\n \"description\": \"Schema for order placement action\",\n \"json_schema\": {\n \"type\": \"object\",\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"required\": [\n \"order_id\",\n \"amount\"\n ],\n \"properties\": {\n \"order_id\": {\n \"type\": \"string\"\n },\n \"amount\": {\n \"type\": \"string\"\n }\n },\n \"additionalProperties\": true\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("ServiceToken <token>", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://management-api.suprsend.com/v1/{workspace}/schema/{schema_slug}/")
.header("ServiceToken <token>", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Order Placed Event\",\n \"description\": \"Schema for order placement action\",\n \"json_schema\": {\n \"type\": \"object\",\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"required\": [\n \"order_id\",\n \"amount\"\n ],\n \"properties\": {\n \"order_id\": {\n \"type\": \"string\"\n },\n \"amount\": {\n \"type\": \"string\"\n }\n },\n \"additionalProperties\": true\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://management-api.suprsend.com/v1/{workspace}/schema/{schema_slug}/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["ServiceToken <token>"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Order Placed Event\",\n \"description\": \"Schema for order placement action\",\n \"json_schema\": {\n \"type\": \"object\",\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"required\": [\n \"order_id\",\n \"amount\"\n ],\n \"properties\": {\n \"order_id\": {\n \"type\": \"string\"\n },\n \"amount\": {\n \"type\": \"string\"\n }\n },\n \"additionalProperties\": true\n }\n}"
response = http.request(request)
puts response.read_body{
"slug": "new-order-placed",
"name": "Order Placed Event",
"description": "Schema for order placement action",
"status": "draft",
"hash": "382b707d4b1f8999a1xxxxxxxx",
"json_schema": {
"type": "object",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"required": [
"order_id",
"amount"
],
"properties": {
"order_id": {
"type": "string"
},
"amount": {
"type": "string"
}
},
"additionalProperties": true
},
"created_at": "2025-08-27T09:30:57.945326Z",
"updated_at": "2025-08-29T15:37:37.650177Z",
"commit_result": {
"is_committed": false,
"errors": [
"hash: no uncommitted changes found"
]
}
}{
"code": 400,
"error_code": "error",
"type": "ValidationError",
"message": "{\"json_schema\": [\"Schema looks like JSON data, not a JSON Schema. Include keywords like '$schema', 'type', 'properties', or '$defs'.\"]}",
"detail": {
"json_schema": [
"Schema looks like JSON data, not a JSON Schema. Include keywords like '$schema', 'type', 'properties', or '$defs'."
]
}
}{
"code": 401,
"error_code": "authentication_failed",
"type": "AuthenticationFailed",
"message": "Invalid service token.",
"detail": "Invalid service token."
}{
"code": 404,
"error_code": "not_found",
"type": "NotFound",
"message": "workspace 'staging4' not found",
"detail": "workspace 'staging4' not found"
}