Create an API key
const url = 'https://api.vaartix.com/api-keys';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"Production server","scope":"send","domainId":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
Example
Production serversend can only send emails. full can also read emails and manage domains and keys.
Limit the key to sending from one domain.
Responses
Section titled “Responses”The new key, including the secret token.
object
The first characters of the key, to recognise it., example: vx_live_pt7m
The API key. Shown only in this response.
Example
{ "scope": "send", "token": "vx_live_pt7m2k9xr4m1c8d3hq2kv9xr4m1c8d3"}validation_error: the request is invalid. The message says which field and why.
object
object
Stable, machine-readable error type.
Human-readable explanation, safe to show to developers.
Example
{ "error": { "type": "validation_error", "message": "to: \"priya@\" is not a valid email address." }}unauthorized: the API key is missing, invalid or revoked.
object
object
Stable, machine-readable error type.
Human-readable explanation, safe to show to developers.
Example
{ "error": { "type": "validation_error" }}forbidden: the key cannot do this, for example a send-only key on a management endpoint.
object
object
Stable, machine-readable error type.
Human-readable explanation, safe to show to developers.
Example
{ "error": { "type": "validation_error" }}