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.

AUTH Authorization: Bearer {API_KEY} Create a token →

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


GET/api/v1/projects/:id/check-ns

Check 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.

GET /api/v1/projects/1/check-ns Request
cURL
curl https://app.depfloy.com/api/v1/projects/1/check-ns \
  -H "Authorization: Bearer {API_KEY}" \
  -H "Accept: application/json"
Response
Success
[
  {
    "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"
  }
]

GET/api/v1/projects/:id/domains

List 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, ready or failed. dns_pending means the domain does not point at the server yet; Depfloy checks again every five minutes for about an hour, then the setup moves to failed.

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. null unless status is failed.

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.

GET /api/v1/projects/1/domains Request
cURL
curl https://app.depfloy.com/api/v1/projects/1/domains \
  -H "Authorization: Bearer {API_KEY}" \
  -H "Accept: application/json"
Response
Success
{
  "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
    }
  ]
}

POST/api/v1/projects/:id/domains

Add 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.

POST /api/v1/projects/1/domains Request
cURL
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"
  }'
Response
Success
{
  "status": "success",
  "message": "Domain added successfully",
  "domain": "example.com"
}

PUT/api/v1/projects/:id/domains/:domainId/primary

Set primary domain #

This endpoint allows you to set a domain as the primary domain for a project by its ID.

PUT /api/v1/projects/:id/domains/:domainId/primary Request
cURL
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"
Response
Success
{
  "status": "success",
  "message": "Primary domain updated successfully.",
  "redirect_setting": 0
}

PUT/api/v1/projects/:id/domains/redirect

Update 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

PUT /api/v1/projects/14532/domains/redirect Request
cURL
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
  }'
Response
Success
{
  "status": "success",
  "message": "Redirect settings updated successfully.",
  "domains": [
    // the project's domains
  ]
}

DELETE/api/v1/projects/:projectId/domains/:domainId

Remove domain #

This endpoint allows you to remove a domain from a project by its ID.

DELETE /api/v1/projects/:projectId/domains/:domainId Request
cURL
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"
Response
Success
{
  "status": "success",
  "message": "Domain removed successfully",
}