POST
/
v1
/
{workspace}
/
schema
/
{schema_slug}
/
Upsert Schema
curl -X POST "https://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
    }
  }'
{
  "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"
    ]
  }
}
Create a new schema or update an existing one. You can optionally commit the schema changes immediately upon creation/update.

Authorizations

ServiceToken <token>
string
header
required

You can get Service Token from SuprSend dashboard -> Account Settings -> Service Tokens section.

Path Parameters

workspace
string
required

Workspace slug (staging, production, etc.)

schema_slug
string
required

Unique identifier of the schema

Query Parameters

commit
boolean
default:false

Set to true to commit the schema immediately after creation/update

commit_message
string

Commit message describing the changes (required when commit=true)

Body

application/json
name
string
required

Human-readable name of the schema

Example:

"Order Placed Event"

json_schema
object
required

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.

Example:
{
"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
string | null

Description of the schema. Can be used to describe which action this schema is linked to.

Example:

"Schema for order placement action"

Response

Successfully retrieved schema object

slug
string

Unique identifier for the schema

Example:

"new-order-placed"

name
string

Human-readable name of the schema

Example:

"Order Placed Event"

description
string | null

Description of the schema

Example:

"Schema for order placement action"

status
enum<string>

Status of returned schema. By default, draft version is returned. You can set mode=live to fetch the live schema.

Available options:
draft,
live
Example:

"draft"

hash
string

Git-like hash for version tracking

Example:

"382b707d4b1f8999a1xxxxxxxx"

json_schema
object | null

JSON schema passed in the request body.

created_at
string<date-time>

When the schema was created

Example:

"2025-08-27T09:30:57.945326Z"

updated_at
string<date-time>

When the schema was last updated

Example:

"2025-08-29T15:37:37.650177Z"

commit_result
object | null

Commit result when commit=true is passed in query parameter

Example:
{
"is_committed": false,
"errors": ["hash: no uncommitted changes found"]
}