How to forward a domain
View as MarkdownCreate, read, update, and delete HTTP redirect rules on a domain or subdomain via the v2 forwarding API.
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 a UUID (not the numeric shopper ID). Go to Find your customer ID for the lookup that returns it.
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 customer ID (
CUSTOMER_ID), which the next section explains how to find
Find your customer ID
The customerId path parameter is a UUID. It isn't the numeric shopper ID that your GoDaddy account settings display, and passing the shopper ID where a customerId belongs returns 403.
GET /v1/shoppers/{shopperId} returns the UUID when you ask for it through the includes query parameter. The following procedure retrieves it.
- Send the request:
curl -s "https://api.godaddy.com/v1/shoppers/$GODADDY_SHOPPER_ID?includes=customerId" \
-H "Authorization: Bearer $GODADDY_PAT" \
-H "Accept: application/json"Read customerId from the response:
{
"shopperId": "123456789",
"customerId": "1e8a4b2c-7f3d-4c91-b60e-2f5d8c9a1b34",
"email": "dev@example.com",
"nameFirst": "Ada",
"nameLast": "Lovelace",
"marketId": "en-US"
}The UUID doesn't change for the life of the account. Resolve it once and store it instead of looking it up per request. Go to Shoppers for the full operation reference.
Find your customer ID
The customerId path parameter is a UUID. It isn't the numeric shopper ID that your GoDaddy account settings display, and passing the shopper ID where a customerId belongs returns 403.
GET /v1/shoppers/{shopperId} returns the UUID when you ask for it through the includes query parameter. The following procedure retrieves it.
- Send the request:
curl -s "https://api.godaddy.com/v1/shoppers/$GODADDY_SHOPPER_ID?includes=customerId" \
-H "Authorization: Bearer $GODADDY_PAT" \
-H "Accept: application/json"Read customerId from the response:
{
"shopperId": "123456789",
"customerId": "1e8a4b2c-7f3d-4c91-b60e-2f5d8c9a1b34",
"email": "dev@example.com",
"nameFirst": "Ada",
"nameLast": "Lovelace",
"marketId": "en-US"
}The UUID doesn't change for the life of the account. Resolve it once and store it instead of looking it up per request. Go to Shoppers for the full operation reference.
Export the UUID as CUSTOMER_ID before running the examples in the following sections.
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, or customerId holds a numeric shopper ID instead of the account UUID. |
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?