Skip to content

Create an API key

POST
/api-keys
curl --request POST \
--url https://api.vaartix.com/api-keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "name": "Production server", "scope": "send", "domainId": "example" }'

The response contains the key once. Store it in a secret manager; Vaartix only keeps a hash.

Media typeapplication/json
object
name
required
string
>= 1 characters <= 60 characters

Example

Production server
scope

send can only send emails. full can also read emails and manage domains and keys.

string
default: send
Allowed values: send full
domainId

Limit the key to sending from one domain.

string | null

The new key, including the secret token.

Media typeapplication/json
object
id
string
name
string
prefix

The first characters of the key, to recognise it., example: vx_live_pt7m

string
scope
string
Allowed values: send full
domainId
string | null
lastUsedAt
string | null format: date-time
revokedAt
string | null format: date-time
createdAt
string format: date-time
token
required

The API key. Shown only in this response.

string

Example

{
"scope": "send",
"token": "vx_live_pt7m2k9xr4m1c8d3hq2kv9xr4m1c8d3"
}

validation_error: the request is invalid. The message says which field and why.

Media typeapplication/json
object
error
required
object
type
required

Stable, machine-readable error type.

string
Allowed values: validation_error unauthorized forbidden not_found conflict rate_limited daily_quota_exceeded domain_not_verified invalid_from_address account_paused idempotency_conflict bad_request internal_error
message
required

Human-readable explanation, safe to show to developers.

string

Example

{
"error": {
"type": "validation_error",
"message": "to: \"priya@\" is not a valid email address."
}
}

unauthorized: the API key is missing, invalid or revoked.

Media typeapplication/json
object
error
required
object
type
required

Stable, machine-readable error type.

string
Allowed values: validation_error unauthorized forbidden not_found conflict rate_limited daily_quota_exceeded domain_not_verified invalid_from_address account_paused idempotency_conflict bad_request internal_error
message
required

Human-readable explanation, safe to show to developers.

string

Example

{
"error": {
"type": "validation_error"
}
}

forbidden: the key cannot do this, for example a send-only key on a management endpoint.

Media typeapplication/json
object
error
required
object
type
required

Stable, machine-readable error type.

string
Allowed values: validation_error unauthorized forbidden not_found conflict rate_limited daily_quota_exceeded domain_not_verified invalid_from_address account_paused idempotency_conflict bad_request internal_error
message
required

Human-readable explanation, safe to show to developers.

string

Example

{
"error": {
"type": "validation_error"
}
}