---
title: "Generate a routing rule from natural language"
method: POST
path: "/v1/projects/{projectId}/routes/generate"
tags: ["project-routes"]
---

# Generate a routing rule from natural language

`POST /v1/projects/{projectId}/routes/generate`

## Request

- Base URL: `https://api.vercel.com`
- URL: `https://api.vercel.com/v1/projects/{projectId}/routes/generate`
- Auth: HTTP bearer

Generate a routing rule configuration from a natural language description. Returns a suggested route configuration that can be reviewed and saved.

## Path parameters

- `projectId` string, required

## Query parameters

- `teamId` string
- `slug` string

## Request body

- object
  - `prompt` string, required
  - `currentRoute` object
    - `name` string
    - `description` string
    - `pathCondition` object, required
      - `value` string
      - `syntax` string
    - `caseSensitive` boolean
    - `conditions` object[]
      - `field` string
      - `operator` string
      - `key` string
      - `value` string
      - `missing` boolean
    - `actions` object[], required
      - `type` string
      - `subType` string
      - `dest` string
      - `status` integer
      - `headers` object[]
        - `key` string
        - `value` string
        - `op` string

## Response `200`

- object
  - `error` string
  - `route` object
    - `actions` object[], required
      - `dest` string
      - `headers` object[]
        - `key` string, required
        - `op` 'append' | 'delete' | 'set', required
        - `value` string
      - `status` number
      - `subType` 'response-headers' | 'transform-request-header' | 'transform-request-query'
      - `type` 'modify' | 'redirect' | 'rewrite' | 'set-status', required
    - `caseSensitive` false | true
    - `conditions` object[]
      - `field` 'cookie' | 'header' | 'host' | 'query', required
      - `key` string
      - `missing` false | true, required
      - `operator` 'contains' | 'eq' | 'exists' | 're', required
      - `value` string
    - `description` string, required
    - `name` string, required
    - `pathCondition` object, required
      - `syntax` 'equals' | 'path-to-regexp' | 'regex', required
      - `value` string, required

## Other responses

- `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.
- `404`
- `408`
- `410`
- `500`

## Changes

- **2026-10-26** `6084adbbc608`: 2 info
  - added the new optional request property `currentRoute/caseSensitive`
  - added the optional property `route/caseSensitive` to the response with the `200` status
- **2026-09-30** `099fbe1f521c`: 1 info
  - added the non-success response with the status `404`
- **2026-07-21** `2ae10ee9d21c`: 1 info
  - added the non-success response with the status `410`
- **2026-06-11** `14b4658f819e`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/vercel/apis/vercel-api/changes/v1/projects/:projectId/routes/generate/post.md)

---

[API](https://skmtc.dev/vercel/apis/vercel-api.md) - [All operations](https://skmtc.dev/vercel/apis/vercel-api/llms.txt) - [OpenAPI document](https://skmtc.dev/vercel/apis/vercel-api/revisions/60686c0e1f6a?raw)
