---
title: stage-routing-rules
product: vercel
url: /docs/rest-api/project-routes/stage-routing-rules
canonical_url: "https://vercel.com/docs/rest-api/project-routes/stage-routing-rules"
last_updated: 2026-09-06
type: reference
prerequisites:
  []
related:
  - /docs/rest-api
summary: Learn about stage-routing-rules on Vercel.
install_vercel_plugin: npx plugins add vercel/vercel-plugin
---

# Stage routing rules

```http
PUT /v1/projects/{projectId}/routes
```

Stage routing rules for a project. Set `overwrite` to true to replace all existing rules, or omit it to merge with existing rules by ID. Returns the new staged version.

## Authentication

**bearerToken**: HTTP bearer

## Path parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `projectId` | string | Yes |  |


## 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: No

Content-Type: `application/json`

```json
{
  "type": "object",
  "properties": {
    "overwrite": {
      "type": "boolean"
    },
    "routes": {
      "type": "array",
      "default": [],
      "items": {
        "type": "object",
        "required": [
          "id",
          "name",
          "route"
        ],
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 256
          },
          "name": {
            "type": "string",
            "maxLength": 256
          },
          "description": {
            "type": "string",
            "maxLength": 1024
          },
          "enabled": {
            "type": "boolean"
          },
          "route": {
            "type": "object",
            "required": [
              "src"
            ]
          }
        }
      }
    }
  }
}
```

## Example request

### TypeScript

```typescript
const response = await fetch('https://api.vercel.com/v1/projects/projectId/routes?teamId=string&slug=string', {
  method: 'PUT',
  headers: {
    'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "overwrite": "true",
    "routes": [
      {
        "id": "icfg_1234567890",
        "name": "Example Name",
        "description": "string",
        "enabled": "true",
        "route": {
          "src": "string",
          "dest": "string",
          "headers": "value",
          "caseSensitive": "true",
          "status": "123",
          "has": [
            {}
          ],
          "missing": [
            {}
          ],
          "transforms": [
            {}
          ],
          "respectOriginCacheControl": "true"
        }
      }
    ]
  }),
});

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/v1/projects/projectId/routes?teamId=string&slug=string', {
    method: 'PUT',
    headers: {
      'Authorization': `Bearer ${process.env.VERCEL_ACCESS_TOKEN}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      "overwrite": "true",
      "routes": [
        {
          "id": "icfg_1234567890",
          "name": "Example Name",
          "description": "string",
          "enabled": "true",
          "route": {
            "src": "string",
            "dest": "string",
            "headers": "value",
            "caseSensitive": "true",
            "status": "123",
            "has": [
              {}
            ],
            "missing": [
              {}
            ],
            "transforms": [
              {}
            ],
            "respectOriginCacheControl": "true"
          }
        }
      ]
    }),
    next: { revalidate: 3600 }
  });

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

  return response.json();
}
```

### cURL

```bash
curl -X PUT 'https://api.vercel.com/v1/projects/projectId/routes?teamId=string&slug=string' \
  -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -d "{
    \"overwrite\": \"true\",
    \"routes\": [
      {
        \"id\": \"icfg_1234567890\",
        \"name\": \"Example Name\",
        \"description\": \"string\",
        \"enabled\": \"true\",
        \"route\": {
          \"src\": \"string\",
          \"dest\": \"string\",
          \"headers\": \"value\",
          \"caseSensitive\": \"true\",
          \"status\": \"123\",
          \"has\": [
            {}
          ],
          \"missing\": [
            {}
          ],
          \"transforms\": [
            {}
          ],
          \"respectOriginCacheControl\": \"true\"
        }
      }
    ]
  }"
```

## Example response

```json
{
  "version": {
    "id": "icfg_1234567890",
    "s3Key": "string",
    "lastModified": "123",
    "createdBy": "string",
    "isStaging": "false",
    "isLive": "false",
    "ruleCount": "123",
    "alias": "string"
  }
}
```

## Responses

### 200: No description

Content-Type: `application/json`

```json
{
  "type": "object",
  "required": [
    "version"
  ],
  "properties": {
    "version": {
      "type": "object",
      "description": "A version of routing rules stored in S3.",
      "required": [
        "createdBy",
        "id",
        "lastModified",
        "s3Key"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "Unique identifier for the version."
        },
        "s3Key": {
          "type": "string",
          "description": "The S3 key where the routing rules are stored."
        },
        "lastModified": {
          "type": "number",
          "description": "Timestamp of when this version was last modified."
        },
        "createdBy": {
          "type": "string",
          "description": "The user who created this version."
        },
        "isStaging": {
          "type": "boolean",
          "description": "Whether this version is staged and not yet promoted to production.",
          "enum": [
            false,
            true
          ]
        },
        "isLive": {
          "type": "boolean",
          "description": "Whether this version is currently live in production.",
          "enum": [
            false,
            true
          ]
        },
        "ruleCount": {
          "type": "number",
          "description": "The number of routing rules in this version."
        },
        "alias": {
          "type": "string",
          "description": "The staging alias for previewing this version."
        }
      }
    }
  }
}
```

### 400: One of the provided values in the request body is invalid.
One of the provided values in the request query is invalid.

### 401: The request is not authorized.

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

### 409: No description

### 410: No description

### 500: No description

---

## Related

- [project-routes endpoints](/docs/rest-api#project-routes)

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

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

---

[View full sitemap](/docs/sitemap)
