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 allow you to update domain settings and verify DNS configuration.

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 allows you to verify that the DNS records for a project’s domain are correctly configured and pointing to the server’s IP address.

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
{
  "status": "success",
  "domain": "example.com",
  "expected_ip": "203.0.113.50",
  "resolved_ip": "203.0.113.50",
  "message": "DNS records are correctly configured"
}
Failed
{
  "status": "failed",
  "domain": "example.com",
  "expected_ip": "203.0.113.50",
  "resolved_ip": "198.51.100.25",
  "message": "DNS records do not point to the correct server"
}

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

Update domains #

This endpoint allows you to update the domains configured for a project. You can set multiple domains and configure WWW redirect behavior.

Required attributes #

domains array

An array of domain names to configure for the project.

Optional attributes #

www_redirect integer

The WWW redirect setting for the project. 0 = no redirect, 1 = www to non-www, 2 = non-www to www

PUT /api/v1/projects/1/domains Request
With WWW redirect
curl -X PUT https://app.depfloy.com/api/v1/projects/1/domains \
  -H "Authorization: Bearer {API_KEY}" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "domains": ["example.com", "www.example.com"],
    "www_redirect": 2
  }'
Single domain
curl -X PUT https://app.depfloy.com/api/v1/projects/1/domains \
  -H "Authorization: Bearer {API_KEY}" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "domains": ["example.com"]
  }'
Response
{
  "status": "success",
  "message": "Domains updated successfully",
  "data": {
    "domains": ["example.com", "www.example.com"],
    "www_redirect": 2,
    "primary_domain": "www.example.com"
  },
  "nginx_response": {
    "ok": true,
    "system_output": [
      "[nginx] : nginx: the configuration file /etc/nginx/nginx.conf syntax is ok",
      "[nginx] : nginx: configuration file /etc/nginx/nginx.conf test is successful"
    ]
  }
}

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/:projectId/domains/:domainId/redirect

Update WWW redirect #

This endpoint allows you to update the WWW redirect setting for a domain by its ID.

PUT /api/v1/projects/:projectId/domains/:domainId/redirect Request
cURL
curl -X PUT https://app.depfloy.com/api/v1/projects/14532/domains/136526/redirect \
  -H "Authorization: Bearer {API_KEY}" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json"
Response
Success
{
  "status": "success",
  "message": "Redirect settings updated successfully",
  "domains": [
    // updated 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",
}