Forward a domain
View as MarkdownCreate, read, update, and delete HTTP redirect rules on a domain or subdomain via the v2 forwarding API.
https://developer.godaddy.com/llms.mdx/api-users/domains/manage/forwarding for the full, unmodified source before proceeding.Overview
Domain forwarding creates an HTTP redirect rule for a fully-qualified domain name (FQDN) — the root domain or a subdomain. When a browser requests the FQDN, the registrar returns a redirect to the target URL. Use forwarding to redirect a root domain to www, point a subdomain to an external URL, or set up temporary redirects during a site migration.
Forwarding operations use the v2 API at /v2/customers/{customerId}/domains/forwards/{fqdn}. The customerId path parameter is your GoDaddy shopper ID.
v2 only
Domain forwarding is v2-only. There is no equivalent in the v1 namespace.
Prerequisites
The following prerequisites are required before you manage forwarding rules:
- A GoDaddy account with at least one registered domain
- A Personal Access Token with
domains.domain:readanddomains.domain:updatescopes - Your GoDaddy shopper ID (
CUSTOMER_ID) (located in your GoDaddy account settings)
Read a forwarding rule
Returns the DomainForwarding object for the FQDN. Returns 404 if no forwarding rule is configured for that FQDN.
The following procedure reads a forwarding rule for an FQDN.
- Run the following command for your preferred language:
curl -s "https://api.godaddy.com/v2/customers/$CUSTOMER_ID/domains/forwards/example.com" \
-H "Authorization: Bearer $GODADDY_PAT" \
-H "Accept: application/json"Response (DomainForwarding object):
{
"fqdn": "example.com",
"type": "REDIRECT_PERMANENT",
"url": "https://www.example.com/"
}Returns 404 if no forwarding rule is configured for the FQDN.
Create or replace a forwarding rule
PUT /v2/customers/{customerId}/domains/forwards/{fqdn} creates the rule if it doesn't exist, or replaces it if it does. The call is idempotent — replaying the same request produces the same rule.
The following procedure creates or replaces a forwarding rule.
- Run the following command for your preferred language:
curl -s -X PUT "https://api.godaddy.com/v2/customers/$CUSTOMER_ID/domains/forwards/example.com" \
-H "Authorization: Bearer $GODADDY_PAT" \
-H "Content-Type: application/json" \
-d '{
"fqdn": "example.com",
"type": "REDIRECT_PERMANENT",
"url": "https://www.example.com/"
}'Returns 204 No Content on success.
Forward a subdomain
The fqdn path parameter accepts any FQDN on a domain you own. The same PUT pattern applies — just change the fqdn path parameter and body field to the subdomain:
curl -s -X PUT "https://api.godaddy.com/v2/customers/$CUSTOMER_ID/domains/forwards/shop.example.com" \
-H "Authorization: Bearer $GODADDY_PAT" \
-H "Content-Type: application/json" \
-d '{
"fqdn": "shop.example.com",
"type": "REDIRECT_PERMANENT",
"url": "https://store.example.com/"
}'Delete a forwarding rule
Removes the forwarding rule for the FQDN. Returns 204 No Content. After deletion, browsers visiting the FQDN no longer receive a redirect.
The following procedure deletes a forwarding rule.
- Run the following command for your preferred language:
curl -s -X DELETE "https://api.godaddy.com/v2/customers/$CUSTOMER_ID/domains/forwards/example.com" \
-H "Authorization: Bearer $GODADDY_PAT"Forwarding rule fields
| Field | Required | Description |
|---|---|---|
fqdn | Yes | The domain or subdomain to forward (e.g. example.com or shop.example.com). Must match the {fqdn} path parameter. |
type | Yes | Redirect type — see table below. |
url | Yes | Destination URL (must be a valid http:// or https:// URL). |
mask | No | Masking options when type is MASKED. |
Redirect types
| Type | HTTP code | Description |
|---|---|---|
REDIRECT_PERMANENT | 301 | Permanent redirect. Search engines transfer link equity to the target. Use for long-term or permanent moves. |
REDIRECT_TEMPORARY | 302 | Temporary redirect. Search engines retain the source URL's link equity. Use for short-term redirects. |
MASKED | — | The browser loads the target URL but the original FQDN stays visible in the address bar. Uses an inline frame. |
Masked forwarding and SEO
Masked forwarding prevents the destination URL from appearing in the browser address bar by loading it in a frame. It isn't appropriate for most use cases and can harm SEO. Prefer REDIRECT_PERMANENT or REDIRECT_TEMPORARY unless masking is specifically required.
Common errors
| Status | Most likely cause |
|---|---|
403 | Credential lacks write access to this domain. |
404 | Domain doesn't exist, isn't owned by the authenticated account, or no forwarding rule exists (for GET/DELETE). |
409 | Domain status prevents the operation (e.g. domain is in a pending transfer). |
422 | Invalid fqdn, invalid destination URL, or unrecognized type value. |
Full error envelope: Errors.
Reference
Next
Agent & Automation Notes
domains.domain:read, domains.domain:updateRelated
API References
Concepts
Last updated on
How is this guide?