Create a site's first sending domain
Creates the site's first sending domain, by default mg. followed by the site's domain, and makes the site send through it. The domain then waits for its DNS records: add them at your DNS provider, or with the DNS endpoint when the domain is in a connected Cloudflare account, and verify. Try-it is off because the request creates a sending domain.
Path parameters
The id of a site row. A website's production site and each of its environments has its own id. Digits only. At least 1.
Body
The sending domain, equal to or under the site's domain or one of its other live domains. Left out, mg. followed by the site's domain. Up to 253 characters.
Fields
An address at the site's domain, one of its other live domains, or the sending domain. Without spaces, quotes or angle brackets. Up to 254 characters. Format: email.
Without quotes, angle brackets, backslashes or control characters. Up to 80 characters.
Returns
201 The sending domain is being set up. Follow operation.id until it completes.
Fields of the 201 answer
A site's email settings. The top-level fields describe the default sending domain.
Fields
Whether another sending domain can be added.
Fields
The sending domain a set-up creates when it names none.
Every sending domain of the site, the default first.
Fields of each item
Whether the site sends through this domain now.
Format: date-time.
Whether the DNS endpoint can write this domain's records.
Fields
Whether your company has a connected Cloudflare account.
When the records were last written in full. Format: date-time.
The Cloudflare zone the domain is in, or null when it is in none of the connected account's.
The domain of the sender addresses that go through it.
At least 1.
Format: date-time.
The last test email sent through this domain, or null.
The operation that set the domain up. At least 1.
Fields of each item
The record as written in Cloudflare by the DNS endpoint. Null when it was not.
What was found in DNS when it differs from value.
MX records only.
What the record is for, such as spf, dkim, mx, tracking or dmarc.
False for the records sending works without (mx, dmarc).
validuncheckedmismatchmissingThe record type, such as TXT, CNAME or MX.
Fields
The address the site's email comes from.
The name shown beside it.
The domain email is sent through, such as mg.harbourandfinch.example.com.
pending_dns: the domain exists and waits for its DNS records. preview: the site is not live, and its email is caught rather than sent.
previewnot_set_upcreatingpending_dnsverifiedfailedremovingWhy a test cannot be sent, when it cannot.
Format: date-time.
What went wrong with the last set-up or DNS write, in plain words.
Format: date-time.
Where the email of a site that is not live is caught. Null on a live site.
The email change that is running, or null.
Fields of each item
The record as written in Cloudflare by the DNS endpoint. Null when it was not.
What was found in DNS when it differs from value.
MX records only.
What the record is for, such as spf, dkim, mx, tracking or dmarc.
False for the records sending works without (mx, dmarc).
validuncheckedmismatchmissingThe record type, such as TXT, CNAME or MX.
The default sending domain, or null when none is set up.
pending_dns: the domain exists and waits for its DNS records. preview: the site is not live, and its email is caught rather than sent.
previewnot_set_upcreatingpending_dnsverifiedfailedremovingOn a live Magento 2 site with a sending domain, its stores' sender addresses and the sending domain each goes through, as last read on the site. Null otherwise, and until the first read has answered.
Fields
Format: date-time.
How many test emails can still be sent today.
Format: date-time.
A change the Control Panel is making or has made. A save or an action that starts work answers one in operation; read it again by id with GET / until status is completed or failed. Both answers have this shape; the few endpoints that answer a different one say so.
Fields
The cluster the operation runs on.
Why the operation failed, in plain words. Null unless status is failed.
A stable code for the failure.
True when the change applies without a maintenance window.
What the operation did differently on purpose. Empty when nothing.
Fields of each item
Who asked for the change.
Present on some site creations and copies.
Always null here. A one-time result is read once with the reveal endpoint.
nonependingavailableviewedWhat a retry needs first, if anything.
Who revealed a one-time result and when, when there was one.
siteclusterbatchThe website the operation belongs to. Null for a cluster's own operation.
Where a change is. completed and failed are final; every other status means the change is still running and blocks another change to the same site.
pendingcommittedrolling_outexecutingcompletedfailedThe key of the step the operation is at. Null once it has completed.
Fields of each item
One of done, current, todo, failed or skipped.
The kind of change, such as crons_change or redirects_change.
If it is refused
| Status | Reason | What to do |
|---|---|---|
401 | none | Send a valid token as Authorization: Bearer <token>. |
403 | company_unavailable | Your company is unavailable. |
403 | scope_required | Use a token with the scope named in scope. |
403 | two_factor_required | Turn on two-factor on your account, then send again. |
404 | feature_off | This feature is not on for your organisation yet. |
409 | busy | Another operation is running on the site. Wait for it to finish. |
409 | duplicate | The same thing already exists here. Use the existing one, or choose another name or value. |
409 | staff_managed | Corefinity staff manage this for the site. Contact support to change it. |
422 | invalid | Fix the field named in field; errors says why. |
429 | rate_limited | Wait for the seconds in Retry-After. |
502 | upstream_unavailable | A service the action depends on did not answer. Try again later. |
Reasons are listed by name in Errors and refusals.
The same task elsewhere
curl -X POST https://manage.corefinity.com/api/corestack/sites/1042/email \
-H "Authorization: Bearer $COREFINITY_TOKEN" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"sender": {
"address": "[email protected]",
"name": "Harbour & Finch"
}
}'use Illuminate\Support\Facades\Http;
$response = Http::withToken(env('COREFINITY_TOKEN'))
->acceptJson()
->post('https://manage.corefinity.com/api/corestack/sites/1042/email', [
'sender' => [
'address' => '[email protected]',
'name' => 'Harbour & Finch',
],
]);
$data = $response->json();const res = await fetch('https://manage.corefinity.com/api/corestack/sites/1042/email', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.COREFINITY_TOKEN}`,
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
sender: {
address: '[email protected]',
name: 'Harbour & Finch',
},
}),
});
// An answer with no body (204) has nothing to parse.
const text = await res.text();
const data = text && JSON.parse(text);import os
import requests
res = requests.post(
"https://manage.corefinity.com/api/corestack/sites/1042/email",
headers={
"Authorization": f"Bearer {os.environ['COREFINITY_TOKEN']}",
"Accept": "application/json",
},
json={
"sender": {
"address": "[email protected]",
"name": "Harbour & Finch",
},
},
)
data = res.json() if res.content else None{
"email": {
"add": {
"allowed": false,
"count": 1,
"default_prefix": "mg",
"max": 5,
"reason": "Set up the first sending domain before adding another."
},
"cloudflare": {
"can_write_records": true,
"connected": true,
"written_at": null,
"zone": {
"id": "example-zone-id",
"name": "harbourandfinch.example.com"
}
},
"default_domain": "mg.harbourandfinch.example.com",
"domains": [
{
"active": false,
"added_at": "2026-11-03T09:16:40Z",
"added_by": "Daniel Reyes",
"can_make_default": false,
"can_remove": false,
"can_rotate": false,
"can_test": false,
"cloudflare": {
"can_write_records": true,
"connected": true,
"written_at": null,
"zone": {
"id": "example-zone-id",
"name": "harbourandfinch.example.com"
}
},
"error": null,
"from_domain": "harbourandfinch.example.com",
"id": 3101,
"is_default": true,
"last_checked_at": null,
"last_test": null,
"make_default_reason": null,
"operation_id": 5120,
"records": [],
"remove_reason": null,
"sender": {
"address": "[email protected]",
"name": "Harbour & Finch"
},
"sending_domain": "mg.harbourandfinch.example.com",
"state": "creating",
"state_label": "Creating",
"test_reason": "Test emails can be sent once the sending domain is verified",
"verified_at": null
}
],
"error": null,
"last_checked_at": null,
"mailpit": null,
"operation": {
"id": 5120,
"scope": "site",
"status": "executing",
"status_label": "Creating the sending domain",
"summary": "Sending domain mg.harbourandfinch.example.com",
"to_version": null,
"type": "mail_setup",
"type_label": "Email sending"
},
"records": [],
"sender": {
"address": "[email protected]",
"name": "Harbour & Finch"
},
"sending_domain": "mg.harbourandfinch.example.com",
"state": "creating",
"state_label": "Creating",
"store_mapping": null,
"test": {
"last_sent_at": null,
"last_to": null,
"remaining_today": 20
},
"verified_at": null
},
"operation": {
"applied_at": "2026-11-03T09:16:40Z",
"can_retry": false,
"cluster": {
"id": 1017,
"name": "Northwind UK 1"
},
"committed_at": null,
"completed_at": null,
"created_at": "2026-11-03T09:16:40Z",
"environment": {
"env_id": "rs-northwind-harbourandfinch-example-com",
"hostname": "harbourandfinch-example-com.northwind.cfstack.example.net",
"id": 1042,
"name": "Production",
"role": "production",
"role_label": "Production",
"slug": "production"
},
"error": null,
"failure_reason": null,
"from_version": null,
"hot": false,
"id": 5120,
"install": null,
"label": "Sending domain created",
"notes": [],
"parent_operation_id": null,
"requested_by": {
"id": 2012,
"name": "Daniel Reyes"
},
"reset_target": null,
"result": null,
"result_state": "none",
"retried_by_operation_id": null,
"retries_operation_id": null,
"retry_requires": null,
"revealed": null,
"scope": "site",
"site": {
"domain": "harbourandfinch.example.com",
"id": 1042
},
"status": "executing",
"status_label": "Creating the sending domain",
"step": "domain",
"steps": [
{
"key": "domain",
"label": "Sending domain created",
"state": "current"
},
{
"key": "secret",
"label": "Credentials stored",
"state": "todo"
},
{
"key": "restart_pending",
"label": "Settings sent",
"state": "todo"
},
{
"key": "restarted",
"label": "Settings applied",
"state": "todo"
},
{
"key": "dns",
"label": "DNS records added",
"state": "todo"
},
{
"key": "verified",
"label": "Verified",
"state": "todo"
}
],
"subject": null,
"summary": "Sending domain mg.harbourandfinch.example.com",
"to_version": null,
"type": "mail_setup",
"type_label": "Email sending"
}
}{
"message": "Unauthenticated."
}{
"code": "company_unavailable",
"message": "Your company is unavailable.",
"reason": "company_unavailable"
}{
"code": "feature_off",
"message": "Not found.",
"reason": "feature_off"
}{
"code": "busy",
"message": "Another change to this site is in progress. Wait for it to finish.",
"reason": "busy"
}{
"code": "invalid",
"errors": {
"sender.address": [
"The sender must use this site's domain"
]
},
"field": "sender.address",
"message": "The sender must use this site's domain",
"reason": "invalid"
}{
"code": "rate_limited",
"message": "Too many requests. Try again in 60 seconds.",
"reason": "rate_limited",
"retry_after_seconds": 60
}{
"code": "upstream_unavailable",
"message": "Mailgun is busy. Try again in a minute.",
"reason": "upstream_unavailable"
}Try it is off for this endpointIt has not been cleared for the console. Copy the request and run it yourself when you are sure.