Skip to content

Create a new domain

POST
/api/domains
curl --request POST \
--url https://smtp-app.kirim.email/api/domains \
--header 'Authorization: Basic <credentials>' \
--header 'Content-Type: application/json' \
--data '{ "domain": "example.com", "dkim_key_length": 1024 }'

Add a new domain to the authenticated user’s account

Domain configuration details for creating a new domain

object
domain
required

Domain name

string
Example
example.com
dkim_key_length
required

DKIM key length

integer
Allowed values: 1024 2048
Example
2048

Domain created successfully

Media typeapplication/json
object
success

Indicates if the request was successful

boolean
message

Human-readable success message

string
data

Created domain information

object
domain

The domain name that was successfully created

string
Example
{
"success": true,
"message": "Domain added successfully.",
"data": {
"domain": "example.com"
}
}

Unauthorized

Media typeapplication/json
object
error

Error type indicating authentication failure

string
message

Human-readable error message explaining the authentication issue

string
Example
{
"error": "Unauthorized",
"message": "Authorization header is required"
}

Conflict - Domain already exists

Media typeapplication/json
object
success
boolean
message
string
errors

Field-specific validation errors

object
domain
Array<string>
Example
{
"success": false,
"message": "This domain is already registered in our system. Please use a different domain.",
"errors": {
"domain": [
"This domain is already registered in our system. Please use a different domain."
]
}
}

Validation Error

Media typeapplication/json
object
success

Indicates the request failed due to validation errors

boolean
message

Human-readable error message

string
errors

Field-specific validation error messages organized by field name

object
Example
{
"success": false,
"message": "Validation failed."
}

Too Many Requests - Rate limit exceeded. Retry after the specified time.

Media typeapplication/json
object
success
boolean
message
string
Example
{
"success": false,
"message": "Too many attempts. Please try again later."
}
Retry-After
integer

Seconds until rate limit resets

X-RateLimit-Limit
integer

Maximum requests per minute

X-RateLimit-Remaining
integer

Remaining requests in current window

Server Error

Media typeapplication/json
object
success

Indicates the request failed due to a server error

boolean
message

Human-readable error message describing the server error

string
Example
{
"success": false,
"message": "An error occurred while processing the request."
}