Update Project Domain
Changes the project subdomain on the Zenifra platform.
This operation applies only to HTTP projects with exposure: "public". Private projects do not have a public domain; change the project exposure to public before configuring a subdomain or custom domains.
Required permissions
The minimum scope to change a subdomain or custom domains is project.domain.update on project:<project-id>. An owner session has full access; assistant, member, and organization API Keys need this grant.
PATCH /v1/project/:id/domainRate limit: 10 requests per minute (counted per source IP).
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | Project ID |
Headers
| Header | Required | Description |
|---|---|---|
x-api-key or Authorization | Yes | Organization API Key or user token |
x-organization-id | With a user token | Active project organization. Not needed with an organization API key |
Content-Type: application/json | Yes | Required because the request has a JSON body |
Body
| Field | Type | Required | Description |
|---|---|---|---|
domain | string | Yes | New subdomain (3–54 characters, lowercase letters, numbers, and internal hyphens) |
Example
{
"domain": "my-subdomain"
}Response
{
"status": "success",
"message": "updated with success"
}Errors
| Status | When it happens |
|---|---|
400 | Missing or invalid domain (length, characters, hyphen at the start/end, or a reserved name) |
403 | The project plan does not allow a custom subdomain |
404 | Project not found |
409 | The project is private (project is not publicly exposed) or the requested subdomain is already in use (DOMAIN_UNAVAILABLE) |
409 | PROJECT_STATE_CONFLICT: the project is not running, stopped, or failing, or does not have a public route yet (for example, a Git project before its first build) |
409 | PROJECT_OPERATION_IN_PROGRESS: another domain, exposure, or lifecycle operation is in progress for the project; wait and try again |
422 | PROJECT_OPERATION_NOT_SUPPORTED: the project is not an HTTP application |
500 | The change could not be applied; the previous address is kept and you can try again |
Sending the subdomain the project already uses returns 200 without changing anything.
Custom domains
Sets the project's list of custom domains.
PATCH /v1/project/:id/custom-domainsAccepts a user session or an organization API Key and requires project.domain.update on project:<project-id>. Rate limit: 10 requests per minute (counted per source IP).
The body is the complete list
custom_domains replaces the project's whole list. Any domain left out of the list is removed and stops responding. To add a domain, send the current domains plus the new one; read the current list first with GET /v1/project/:id/custom-domains. Each call accepts at most one new domain.
Body
| Field | Type | Required | Description |
|---|---|---|---|
custom_domains | array of strings | Yes | Complete list of the project's domains (maximum 20). Domains not in the list are removed |
{
"custom_domains": ["example.com", "www.example.com"]
}Each call can add at most one new domain (only one custom domain can be added at a time); removing several at once is allowed. Zenifra's own domains are rejected.
Response
{
"status": "success",
"message": "custom domains updated with success",
"custom_domains": ["example.com", "www.example.com"],
"custom_domain_setup": [
{
"hostname": "www.example.com",
"kind": "subdomain",
"status": "pending",
"ssl_status": "pending_validation",
"certificate": "waiting_dns",
"dns_records": [
{
"type": "CNAME",
"name": "www.example.com",
"value": "my-app.clients.zenifra.com",
"purpose": "routing",
"found": [],
"verdict": "missing"
}
],
"verification_issues": []
}
]
}custom_domain_setup contains only the domain added in this call, in the same format as the read endpoint. The validation TXT records may take a few seconds to appear; call the GET right after to get the full list of records.
Errors
| Status | When it happens |
|---|---|
400 | Invalid body, reserved domain, or more than one new domain in the same call |
404 | Project not found |
409 | The project is private (project is not publicly exposed), or the domain is already in use by another project (DOMAIN_UNAVAILABLE) |
409 | PROJECT_STATE_CONFLICT: the application does not have a public route yet (for example, a Git project before its first build) |
409 | PROJECT_OPERATION_IN_PROGRESS: another domain, exposure, or lifecycle operation is in progress for the project |
422 | PROJECT_OPERATION_NOT_SUPPORTED: the project is not an HTTP application |
500 | The list could not be applied (failed to update custom domains); check the list with the GET and try again |
Read custom domains
Lists the project's custom domains with the DNS records each one needs, what was already found in DNS, and the HTTPS certificate progress.
GET /v1/project/:id/custom-domainsAccepts a user session or an organization API Key and requires project.read on project:<project-id>. Rate limit: 30 requests per minute (counted per source IP).
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | Project ID |
Headers
| Header | Required | Description |
|---|---|---|
x-api-key or Authorization | Yes | Organization API Key or user token |
x-organization-id | With a user token | Active project organization. Not needed with an organization API key |
Response
{
"status": "success",
"custom_domain_setup": [
{
"hostname": "example.com",
"kind": "apex",
"status": "active",
"ssl_status": "active",
"certificate": "active",
"dns_records": [
{
"type": "A",
"name": "@",
"value": "203.0.113.10",
"purpose": "routing",
"found": ["203.0.113.10"],
"verdict": "ok"
}
],
"verification_issues": []
},
{
"hostname": "www.example.com",
"kind": "subdomain",
"status": "pending",
"ssl_status": "pending_validation",
"certificate": "waiting_dns",
"dns_records": [
{
"type": "CNAME",
"name": "www.example.com",
"value": "my-app.clients.zenifra.com",
"purpose": "routing",
"found": ["my-app.clients.zenifra.com"],
"verdict": "ok"
},
{
"type": "TXT",
"name": "_acme-challenge.www.example.com",
"value": "kX3v9QpL2mN8rT4wY7zB1cD6fH0jK5sU",
"purpose": "certificate_validation",
"found": [],
"verdict": "missing"
}
],
"verification_issues": []
}
]
}A project without custom domains returns 200 with "custom_domain_setup": []. The sample values above are fictitious: always use the ones the API returns for your project.
Domain fields
| Field | Description |
|---|---|
hostname | The custom domain |
kind | subdomain (such as www.example.com) or apex (root domain, such as example.com) |
certificate | HTTPS certificate progress. This is the field to check whether the domain is ready (see the table below) |
status | Domain validation state, such as pending or active. Informational |
ssl_status | Detailed certificate state, such as pending_validation or active. Informational |
dns_records | DNS records the domain needs at your DNS provider |
verification_issues | Problems found during validation; empty when there are none |
certificate | Meaning |
|---|---|
active | Certificate issued; the domain already answers over HTTPS |
issuing | All DNS records are correct; the certificate is being issued |
waiting_dns | A record in dns_records still needs to be created or fixed |
blocked_by_access_restriction | Access to the application is restricted to an IP list, which prevents issuance. Allow access from any IP in Network access |
DNS record fields
| Field | Description |
|---|---|
type | CNAME, A, AAAA, or TXT |
name | Record name. @ means the root domain itself |
value | Value to create. null when the record must be deleted (verdict: "remove") or when there is no value to show yet |
purpose | routing (sends traffic to the application), domain_validation (proves you own the domain), or certificate_validation (allows the certificate to be issued) |
found | Values currently found in public DNS for that name. [] when it does not exist; null when the DNS lookup failed at that moment |
verdict | ok (correct record), missing (create the record with value), remove (delete the record with the value in found), or unknown (could not be checked now; read again) |
Subdomains get a CNAME plus the validation TXT records; the same name may have more than one TXT, and all of them must be created. A root domain gets an A record on @; A or AAAA records other than the expected one show up with verdict: "remove".
verification_issues | What to do |
|---|---|
cname_required | The domain's CNAME does not point to the expected value. Fix the CNAME record |
verification_failed | Domain validation failed. Check every record in dns_records |
apex_readd_required | Root domain added before automatic setup. Remove the domain from the list and add it again to get the A record |
Errors
| Status | When it happens |
|---|---|
400 | Invalid project id |
401 | Missing or invalid credential |
403 | The credential does not have project.read on the project |
404 | Project not found (project not exists) |
429 | Rate limit exceeded |
502 | The domain status could not be read right now (failed to get custom domains setup); try again |
Automate domain setup
To add domains from a script without deleting the existing ones:
- Read the current list with
GET /v1/project/:id/custom-domainsand keep thehostnamevalues fromcustom_domain_setup. - Add one domain with
PATCH /v1/project/:id/custom-domains, sending the current list plus the new domain. One new domain per call. - Get the DNS records with the
GETand pick the item whosehostnameis the new domain. If theTXTrecords are not there yet, repeat theGETafter a few seconds. - Create the records at your DNS provider: every item in
dns_recordswithverdict: "missing", using exactly itstype,name, andvalue. Delete the ones withverdict: "remove". - Repeat the
GET(for example, every 30 seconds, within the limit of 30 per minute) untilcertificateisactive. While it iswaiting_dns, check the records whoseverdictis notok.
Do not remove and re-add the same domain to get the records again. Each new registration changes the
TXTvalues, and the records already created at your provider stop being valid. Use theGET.
# 1. Current list
curl -s "https://api.zenifra.com/v1/project/507f1f77bcf86cd799439011/custom-domains" \
-H "x-api-key: your-api-key"
# 2. Current list + new domain
curl -X PATCH "https://api.zenifra.com/v1/project/507f1f77bcf86cd799439011/custom-domains" \
-H "x-api-key: your-api-key" \
-H "Content-Type: application/json" \
-d '{"custom_domains": ["example.com", "www.example.com"]}'
# 3 and 5. DNS records and certificate progress
curl -s "https://api.zenifra.com/v1/project/507f1f77bcf86cd799439011/custom-domains" \
-H "x-api-key: your-api-key"To set up the records in the Console, see Custom domains.
Examples
curl -X PATCH "https://api.zenifra.com/v1/project/507f1f77bcf86cd799439011/domain" \
-H "x-api-key: your-api-key" \
-H "x-organization-id: your-organization-id" \
-H "Content-Type: application/json" \
-d '{"domain": "my-subdomain"}'Python
import requests
API_KEY = "your-api-key"
ORGANIZATION_ID = "your-organization-id"
PROJECT_ID = "507f1f77bcf86cd799439011"
response = requests.patch(
f"https://api.zenifra.com/v1/project/{PROJECT_ID}/domain",
headers={"x-api-key": API_KEY, "x-organization-id": ORGANIZATION_ID},
json={"domain": "my-subdomain"}
)
print(response.json())Domain Rules
- Minimum of 3 characters
- Maximum of 54 characters
- Lowercase letters, numbers, and internal hyphens only
- Cannot start or end with hyphen
- Reserved platform names are rejected with
400, such asadmin,ai,api,app,auth,clients,console,docs,mail,managed,mcp,status, andwww; automatic naming also skips them - The requested subdomain is reserved exactly as provided; if it is already in use, the API returns
409instead of silently renaming it - The resulting Zenifra default domain uses the
clients.zenifra.comzone - Private HTTP projects (
exposure: "private") do not receive a subdomain and cannot update a public domain
Last updated on
Storage
Increase your project's storage via the Zenifra API, from 1 to 250 GB, and read current usage in bytes, with contract rules, the legacy Free plan, and errors.
Application network access
Restrict through the Zenifra API which IP ranges can reach a public HTTP application, using allow and block lists in IPv4 CIDR notation with per-list limits.