---
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`

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

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

---

[API](https://skmtc.net/vercel/apis/api.md) · [All operations](https://skmtc.net/vercel/apis/api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/vercel/api/versions/61d1ba3f6dac/schema)
