Skip to content
Docs

Generate a routing rule from natural language

POST/__remote/api.vercel.com/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.
/__remote/api.vercel.com/v1/projects/{projectId}/routes/generate
const response = await fetch('/__remote/api.vercel.com/v1/projects/projectId/routes/generate?teamId=string&slug=string', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"prompt": "string",
"currentRoute": {
"name": "Example Name",
"description": "string",
"pathCondition": {
"value": "string",
"syntax": "string"
},
"caseSensitive": "true",
"conditions": [
{
"field": "string",
"operator": "string",
"key": "string",
"value": "string",
"missing": "true"
}
],
"actions": [
{
"type": "string",
"subType": "string",
"dest": "string",
"status": "123",
"headers": [
{
"key": "string",
"value": "string",
"op": "string"
}
]
}
]
}
}),
});
const data = await response.json();
console.log(data);
Response
{
"error": "string",
"route": {
"actions": [
{
"dest": "string",
"headers": [
{
"key": "string",
"op": "append",
"value": "string"
}
],
"status": "123",
"subType": "response-headers",
"type": "modify"
}
],
"caseSensitive": "false",
"conditions": [
{
"field": "cookie",
"key": "string",
"missing": "false",
"operator": "contains",
"value": "string"
}
],
"description": "string",
"name": "Example Name",
"pathCondition": {
"syntax": "equals",
"value": "string"
}
}
}
AuthorizationbearerToken

Default authentication mechanism

projectIdstringRequired
teamIdstringOptional
The Team identifier to perform the request on behalf of.
slugstringOptional
The Team slug to perform the request on behalf of.
application/json
promptstringRequired
currentRouteobjectOptional
200Success
errorstringOptional
routeobjectOptional
400One of the provided values in the request body is invalid. One of the provided values in the request query is invalid.
401The request is not authorized.
403You do not have permission to access this resource.
404Error
408Error
410Error
500Error