Skip to content

EmailSchema_get

GET
/emails/schema
curl --request GET \
--url http://localhost:3000/api/emails/schema \
--header 'Authorization: Bearer <token>'

Read the schema of the editor’s document: the node and mark types, the attributes each takes and the values allowed. The structure comes from the editor itself; the attribute types and allowed values are the rules the server checks, so a document that follows this is not refused. Write the document as doc on a Template, Broadcast or Automation email step.

The request has succeeded.

Media typeapplication/json

The editor’s document format: what an agent writes as doc

object
editorVersion
required

Version of the editor whose export code renders a document

string
nodes
required

Node types by name. A document is {"type":"doc","content":[...nodes]}

object
key
additional properties

One node or mark type of the editor’s document

object
content

The content expression: which child nodes the node holds; absent for a leaf and for a mark

string
group

The group a node belongs to (block, inline); absent for a mark

string
attrs
required

The attributes the type accepts, by name. Any other attribute is refused.

object
key
additional properties

One attribute of a node or mark in the editor’s document

object
default

The value the editor gives the attribute when the document omits it

type
required

The kind of value: string, integer, url, css, alignment …

string
allowed

The only values accepted, when the attribute is a closed set

Array<string>
rule
required

The rule the server checks, in words: required or optional, range, form of the value

string
marks
required

Mark types by name (bold, link …), put in a text node’s marks

object
key
additional properties

One node or mark type of the editor’s document

object
content

The content expression: which child nodes the node holds; absent for a leaf and for a mark

string
group

The group a node belongs to (block, inline); absent for a mark

string
attrs
required

The attributes the type accepts, by name. Any other attribute is refused.

object
key
additional properties

One attribute of a node or mark in the editor’s document

object
default

The value the editor gives the attribute when the document omits it

type
required

The kind of value: string, integer, url, css, alignment …

string
allowed

The only values accepted, when the attribute is a closed set

Array<string>
rule
required

The rule the server checks, in words: required or optional, range, form of the value

string
rules
required

Rules that hold across the document, in words

Array<string>
example
required

A valid document to start from

object
key
additional properties

Example generated

{
"editorVersion": "example",
"nodes": {
"additionalProperty": {
"content": "example",
"group": "example",
"attrs": {
"additionalProperty": {
"default": "example",
"type": "example",
"allowed": [
"example"
],
"rule": "example"
}
}
}
},
"marks": {
"additionalProperty": {
"content": "example",
"group": "example",
"attrs": {
"additionalProperty": {
"default": "example",
"type": "example",
"allowed": [
"example"
],
"rule": "example"
}
}
}
},
"rules": [
"example"
],
"example": {
"additionalProperty": "example"
}
}

RFC 7807 unauthorized response

Media typeapplication/problem+json

RFC 7807 Problem Details

object
code

Why the request was refused, when the client should act on it

string
Allowed values: second_factor_required email_verification_required signup_closed
type

A URI reference that identifies the problem type

string
title

A short, human-readable summary of the problem type

string
status

HTTP status code

integer format: int32
detail

A human-readable explanation specific to this occurrence

string
instance

A URI reference that identifies the specific occurrence

string
errors

Validation errors grouped by field

object
key
additional properties
Array<string>
form

Form-level validation error

string
fields

Field validation errors

object
key
additional properties
string
retryAfter

Seconds to wait before retrying; set on a 429 so a client that only sees the body can show the wait

integer format: int32
debug

Why a 500 happened, sent only by a development server (SPHERICON_ENV=development)

object
error
required

The error that failed the request, or the panic value

string
stack

The goroutine stack of a panic; absent for an error a handler returned

string
requestId

The request id the server log carries for this request

string
method
required

The HTTP method of the failed request

string
path
required

The path of the failed request

string

Example

{
"code": "second_factor_required"
}

RFC 7807 too many requests response: a rate limit was exceeded (ADR 0025)

Media typeapplication/problem+json

RFC 7807 Problem Details

object
code

Why the request was refused, when the client should act on it

string
Allowed values: second_factor_required email_verification_required signup_closed
type

A URI reference that identifies the problem type

string
title

A short, human-readable summary of the problem type

string
status

HTTP status code

integer format: int32
detail

A human-readable explanation specific to this occurrence

string
instance

A URI reference that identifies the specific occurrence

string
errors

Validation errors grouped by field

object
key
additional properties
Array<string>
form

Form-level validation error

string
fields

Field validation errors

object
key
additional properties
string
retryAfter

Seconds to wait before retrying; set on a 429 so a client that only sees the body can show the wait

integer format: int32
debug

Why a 500 happened, sent only by a development server (SPHERICON_ENV=development)

object
error
required

The error that failed the request, or the panic value

string
stack

The goroutine stack of a panic; absent for an error a handler returned

string
requestId

The request id the server log carries for this request

string
method
required

The HTTP method of the failed request

string
path
required

The path of the failed request

string

Example

{
"code": "second_factor_required"
}
Retry-After
required
integer format: int32

Seconds to wait before retrying

X-RateLimit-Limit
required
integer format: int32

The request budget of the window that was exceeded

X-RateLimit-Remaining
required
integer format: int32

Requests left in the current window

X-RateLimit-Reset
required
integer format: int64

Unix time at which the window resets