Skip to content

Integrations_create

POST
/integrations
curl --request POST \
--url http://localhost:3000/api/integrations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "name": "example", "enabled": true, "isDefault": true, "maxPerSecond": 1, "maxPerDay": 1, "config": { "kind": "smtp", "host": "example", "port": 1, "username": "example", "password": "example", "from": "hello@example.com", "fromName": "example" }, "preset": "example", "params": { "additionalProperty": "example" } }'

Create a resource

Media typeapplication/json

Create an Integration. The provider and channel are derived from config.kind.

object
name
required
string
enabled
boolean
isDefault
boolean
maxPerSecond

Most messages per second (1 to 10 000); omit or null for no limit

integer format: int32
>= 1 <= 10000
maxPerDay

Most messages per rolling 24 hours (1 to 100 000 000); omit or null for no limit

integer format: int32
>= 1 <= 100000000
config
required
One of: discriminator: kind

SMTP credentials

object
kind
required
string
Allowed values: smtp
host
required
string
port
required
integer format: int32
username
string
nullable
password
string
nullable
from
required
string format: email
<= 320 characters
fromName
string
nullable
preset

Name of a Preset from presets_list to read provider callbacks (bounces, complaints) with

string
nullable
params

The Preset’s params, validated against its paramsSchema: read the schema first

object
key
additional properties

The request has succeeded and a new resource has been created as a result.

Media typeapplication/json

A sending-provider Integration. Credentials are write-only: the config is returned with secrets redacted.

object
id
required

Unique identifier

string format: int64
/^[0-9]{1,18}$/
name
required

Human-readable label

string
channel
required

Delivery channel

string
Allowed values: email sms
provider
required

Concrete provider

string
Allowed values: smtp ses
enabled
required

Whether this integration may be used for sending

boolean
isDefault
required

Whether this is the default provider for its channel

boolean
maxPerSecond
required

Send rate limit set on the Integration: most messages per second; null means none

integer format: int32
nullable
maxPerDay
required

Send rate limit set on the Integration: most messages per rolling 24 hours; null means none

integer format: int32
nullable
sendLimit
required

The Send rate limit as enforced and 24-hour usage

object
perSecond
required

Most messages per second

object
limit
required

The ceiling in messages; null means this window is not limited

integer format: int32
nullable
source
required

Where the ceiling comes from; null when there is none

string
Allowed values: manual provider
perDay
required

Most messages per rolling 24 hours

object
limit
required

The ceiling in messages; null means this window is not limited

integer format: int32
nullable
source
required

Where the ceiling comes from; null when there is none

string
Allowed values: manual provider
sentLast24h
required

Messages the provider accepted from this Integration in the last 24 hours

integer format: int32
warnings
required

Reasons to review the limit; empty when there is nothing to flag

Array<string>
Allowed values: unlimited providerQuotaUnavailable
config
required

Provider config (secrets redacted)

object
One of:

SMTP config without the password

object
kind
required
string
Allowed values: smtp
host
required
string
port
required
integer format: int32
username
string
nullable
from
required
string format: email
<= 320 characters
fromName
string
nullable
preset
required

The Preset this Integration’s provider callbacks are read with; null when it receives none

string
nullable
params
required

The Preset’s params as saved. A secret param (writeOnly in the Preset’s schema) is shown as ********, never its value

object
key
additional properties
secretsRetiring
required

Names of the secret params that are rotating: a retiring value is still accepted beside the current one

Array<string>
hookUrl
required

Where the provider posts this Integration’s callbacks: paste it into the provider. The key in it is an address, not the authentication (the Preset’s signature or secret is)

string
createdAt
required

Creation timestamp

string format: date-time
updatedAt
required

Last update timestamp

string format: date-time

Example

{
"channel": "email",
"provider": "smtp",
"sendLimit": {
"perSecond": {
"source": "manual"
},
"perDay": {
"source": "manual"
},
"warnings": [
"unlimited"
]
},
"config": {
"kind": "smtp"
}
}

RFC 7807 bad request 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 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 conflict 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 validation 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