Domains
Domains allow you to configure custom domains for your projects. You can add multiple domains, configure WWW redirects, and verify DNS settings. On this page, we will dive into the different domain endpoints you can use to manage project domains programmatically.
Domain configuration #
Each project can have multiple domains configured. The domain endpoints list a project’s domains with their SSL setup state, add and remove domains, set the primary domain and the WWW redirect, and check DNS.
WWW Redirect options #
- 0 integer
-
No redirect
- 1 integer
-
www to non-www
- 2 integer
-
non-www to www
/api/v1/projects/:id/check-nsCheck NS record #
This endpoint checks whether each of the project’s domains points at the project’s server and returns the project’s domains. is_active is 1 for a domain whose DNS points at the server and 0 otherwise.
The token needs the project:read permission.
curl https://app.depfloy.com/api/v1/projects/1/check-ns \
-H "Authorization: Bearer {API_KEY}" \
-H "Accept: application/json"[
{
"id": 136526,
"domain_name": "example.com",
"is_primary": 1,
"is_active": 1,
"source": "customer"
},
{
"id": 136527,
"domain_name": "www.example.com",
"is_primary": 0,
"is_active": 0,
"source": "customer"
}
]/api/v1/projects/:id/domainsList domains #
This endpoint returns the project’s domains, primary domain first. The token needs the project:read permission.
SSL setup #
When Depfloy sets up a certificate for a domain on its own (after the project is installed, or when you request certificates), each domain carries an ssl_setup object. It is null for a domain whose setup has not started.
- status string
-
queued,dns_pending,issuing_certificate,readyorfailed.dns_pendingmeans the domain does not point at the server yet; Depfloy checks again every five minutes for about an hour, then the setup moves tofailed. - reason string|null
-
Why the setup failed and what to change, for example
DNS has not reached the server. Point the domain to the server, then retry SSL setup.nullunlessstatusisfailed. - updated_at string|null
-
When the status last changed, ISO 8601 in UTC.
The state is kept until the next setup for the same domain, so you can read it at any time. When the domain’s certificate is deleted, ssl_setup is null again. To follow changes as they happen, see Realtime updates.
curl https://app.depfloy.com/api/v1/projects/1/domains \
-H "Authorization: Bearer {API_KEY}" \
-H "Accept: application/json"{
"status": "success",
"data": [
{
"id": 136526,
"domain_name": "shop.example.com",
"is_primary": 1,
"is_active": 0,
"source": "customer",
"created_at": "2026-11-19T10:00:00.000000Z",
"ssl_setup": {
"status": "failed",
"reason": "DNS has not reached the server. Point the domain to the server, then retry SSL setup.",
"updated_at": "2026-11-19T10:42:00+00:00"
}
},
{
"id": 136527,
"domain_name": "www.shop.example.com",
"is_primary": 0,
"is_active": 0,
"source": "customer",
"created_at": "2026-11-19T10:00:00.000000Z",
"ssl_setup": null
}
]
}/api/v1/projects/:id/domainsAdd domain #
This endpoint allows you to add a domain to a project.
Attributes for adding a domain #
- domain string
-
The domain name to add to the project.
curl -X POST https://app.depfloy.com/api/v1/projects/1/domains \
-H "Authorization: Bearer {API_KEY}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"domain": "example.com"
}'{
"status": "success",
"message": "Domain added successfully",
"domain": "example.com"
}/api/v1/projects/:id/domains/:domainId/primarySet primary domain #
This endpoint allows you to set a domain as the primary domain for a project by its ID.
curl -X PUT https://app.depfloy.com/api/v1/projects/1/domains/136526/primary \
-H "Authorization: Bearer {API_KEY}" \
-H "Accept: application/json" \
-H "Content-Type: application/json"{
"status": "success",
"message": "Primary domain updated successfully.",
"redirect_setting": 0
}/api/v1/projects/:id/domains/redirectUpdate WWW redirect #
This endpoint sets the project’s WWW redirect. With 1 the non-www domain becomes the primary domain, with 2 the www domain does. The token needs the project:update permission.
Required attributes #
- www_redirect integer
-
0 = no redirect, 1 = www to non-www, 2 = non-www to www
curl -X PUT https://app.depfloy.com/api/v1/projects/14532/domains/redirect \
-H "Authorization: Bearer {API_KEY}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"www_redirect": 2
}'{
"status": "success",
"message": "Redirect settings updated successfully.",
"domains": [
// the project's domains
]
}/api/v1/projects/:projectId/domains/:domainIdRemove domain #
This endpoint allows you to remove a domain from a project by its ID.
curl -X DELETE https://app.depfloy.com/api/v1/projects/14532/domains/136526 \
-H "Authorization: Bearer {API_KEY}" \
-H "Accept: application/json" \
-H "Content-Type: application/json"{
"status": "success",
"message": "Domain removed successfully",
}