---
title: update-a-project-domain
product: vercel
url: /docs/rest-api/projects/update-a-project-domain
canonical_url: "https://vercel.com/docs/rest-api/projects/update-a-project-domain"
last_updated: 2026-09-14
type: reference
prerequisites:
  []
related:
  - /docs/rest-api
summary: Learn about update-a-project-domain on Vercel.
install_vercel_plugin: npx plugins add vercel/vercel-plugin
---

# Update a project domain

```http
PATCH /v9/projects/{idOrName}/domains/{domain}
```

Update a project domain's configuration, including the name, git branch and redirect of the domain.

## Authentication

**bearerToken**: HTTP bearer

## Path parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `idOrName` | string | Yes | The unique project identifier or the project name |
| `domain` | string | Yes | The project domain name |


## Query parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `teamId` | string | No | The Team identifier to perform the request on behalf of. |
| `slug` | string | No | The Team slug to perform the request on behalf of. |


## Request body

Required: Yes

Content-Type: `application/json`

```json
{
  "type": "object",
  "properties": {
    "gitBranch": {
      "type": "string",
      "description": "Git branch to link the project domain",
      "maxLength": 250,
      "nullable": true
    },
    "redirect": {
      "type": "string",
      "description": "Target destination domain for redirect",
      "nullable": true
    },
    "redirectStatusCode": {
      "type": "integer",
      "description": "Status code for domain redirect",
      "enum": [
        null,
        301,
        302,
        307,
        308
      ],
      "nullable": true
    }
  }
}
```

## Example request

### TypeScript

```typescript
const response = await fetch('https://api.vercel.com/v9/projects/idOrName/domains/domain?teamId=string&slug=string', {
  method: 'PATCH',
  headers: {
    'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "gitBranch": "null",
    "redirect": "foobar.com",
    "redirectStatusCode": "307"
  }),
});

const data = await response.json();
console.log(data);
```

### Next.js

```typescript
'use server';

export async function callEndpoint() {
  const response = await fetch('https://api.vercel.com/v9/projects/idOrName/domains/domain?teamId=string&slug=string', {
    method: 'PATCH',
    headers: {
      'Authorization': `Bearer ${process.env.VERCEL_ACCESS_TOKEN}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      "gitBranch": "null",
      "redirect": "foobar.com",
      "redirectStatusCode": "307"
    }),
    next: { revalidate: 3600 }
  });

  if (!response.ok) {
    throw new Error('Request failed');
  }

  return response.json();
}
```

### cURL

```bash
curl -X PATCH 'https://api.vercel.com/v9/projects/idOrName/domains/domain?teamId=string&slug=string' \
  -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -d "{
    \"gitBranch\": \"null\",
    \"redirect\": \"foobar.com\",
    \"redirectStatusCode\": \"307\"
  }"
```

## Example response

```json
{
  "name": "Example Name",
  "apexName": "Example Name",
  "projectId": "example_id",
  "redirect": "string",
  "redirectStatusCode": "301",
  "gitBranch": "string",
  "customEnvironmentId": "example_id",
  "updatedAt": "123",
  "createdAt": "123",
  "verified": "false",
  "verification": [
    {
      "type": "string",
      "domain": "string",
      "value": "string",
      "reason": "Customer requested refund"
    }
  ]
}
```

## Responses

### 200: The domain was updated successfuly

Content-Type: `application/json`

```json
{
  "type": "object",
  "required": [
    "apexName",
    "name",
    "projectId",
    "verified"
  ],
  "properties": {
    "name": {
      "type": "string"
    },
    "apexName": {
      "type": "string"
    },
    "projectId": {
      "type": "string"
    },
    "redirect": {
      "type": "string",
      "nullable": true
    },
    "redirectStatusCode": {
      "type": "number",
      "enum": [
        301,
        302,
        307,
        308,
        null
      ],
      "nullable": true
    },
    "gitBranch": {
      "type": "string",
      "nullable": true
    },
    "customEnvironmentId": {
      "type": "string",
      "nullable": true
    },
    "updatedAt": {
      "type": "number"
    },
    "createdAt": {
      "type": "number"
    },
    "verified": {
      "type": "boolean",
      "description": "`true` if the domain is verified for use with the project. If `false` it will not be used as an alias on this project until the challenge in `verification` is completed.",
      "enum": [
        false,
        true
      ]
    },
    "verification": {
      "type": "array",
      "description": "A list of verification challenges, one of which must be completed to verify the domain for use on the project. After the challenge is complete `POST /projects/:idOrName/domains/:domain/verify` to verify the domain. Possible challenges: - If `verification.type = TXT` the `verification.domain` will be checked for a TXT record matching `verification.value`.",
      "items": {
        "type": "object",
        "description": "A list of verification challenges, one of which must be completed to verify the domain for use on the project. After the challenge is complete `POST /projects/:idOrName/domains/:domain/verify` to verify the domain. Possible challenges: - If `verification.type = TXT` the `verification.domain` will be checked for a TXT record matching `verification.value`.",
        "required": [
          "domain",
          "reason",
          "type",
          "value"
        ],
        "properties": {
          "type": {
            "type": "string"
          },
          "domain": {
            "type": "string"
          },
          "value": {
            "type": "string"
          },
          "reason": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

### 400: One of the provided values in the request body is invalid.
One of the provided values in the request query is invalid.
The domain redirect is not valid

### 401: The request is not authorized.

### 403: You do not have permission to access this resource.

### 409: The project is currently being transferred

### 410: No description

---

## Related

- [projects endpoints](/docs/rest-api#projects)

- [REST API overview](/docs/rest-api)

- [OpenAPI spec](https://openapi.vercel.sh/) (machine-readable, all endpoints)

---

[View full sitemap](/docs/sitemap)
