1. Packages
  2. Packages
  3. Vercel Provider
  4. API Docs
  5. ProjectRoute
Viewing docs for Vercel v5.4.1
published on Wednesday, Jul 22, 2026 by Pulumiverse
vercel logo
Viewing docs for Vercel v5.4.1
published on Wednesday, Jul 22, 2026 by Pulumiverse

    Provides a Project Route resource.

    This resource manages one live project-level routing rule for a Vercel project. Each mutation stages a new routing-rules version and promotes it immediately so Terraform state reflects production traffic behavior.

    Reads and imports intentionally target the live version and ignore unpublished staged drafts created outside Terraform.

    Position is applied when the rule is created or replaced. Use before and after with reference_route_id when you need deterministic ordering across multiple Terraform-managed rules.

    The Vercel API does not return placement metadata for an individual rule. Terraform preserves the configured position on normal reads, but imported routes start with no position in state.

    This resource refuses to mutate a project while it has an unpublished staged routing-rules version. Publish, restore, or discard the draft first.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as vercel from "@pulumiverse/vercel";
    
    const example = new vercel.Project("example", {name: "example-project"});
    const exampleProjectRoute = new vercel.ProjectRoute("example", {
        projectId: example.id,
        name: "redirect-legacy-docs",
        position: {
            placement: "start",
        },
        route: {
            src: "/docs/:path*",
            dest: "/guides/:path*",
            status: 308,
        },
    });
    const rewriteEuCampaign = new vercel.ProjectRoute("rewrite_eu_campaign", {
        projectId: example.id,
        name: "rewrite-eu-campaign",
        position: {
            placement: "after",
            referenceRouteId: exampleProjectRoute.id,
        },
        route: {
            src: "/promo",
            dest: "/campaigns/eu",
            has: [{
                type: "header",
                key: "x-region",
                value: "eu",
            }],
            missings: [{
                type: "cookie",
                key: "preview",
                value: "1",
            }],
        },
    });
    
    import pulumi
    import pulumiverse_vercel as vercel
    
    example = vercel.Project("example", name="example-project")
    example_project_route = vercel.ProjectRoute("example",
        project_id=example.id,
        name="redirect-legacy-docs",
        position={
            "placement": "start",
        },
        route={
            "src": "/docs/:path*",
            "dest": "/guides/:path*",
            "status": 308,
        })
    rewrite_eu_campaign = vercel.ProjectRoute("rewrite_eu_campaign",
        project_id=example.id,
        name="rewrite-eu-campaign",
        position={
            "placement": "after",
            "reference_route_id": example_project_route.id,
        },
        route={
            "src": "/promo",
            "dest": "/campaigns/eu",
            "has": [{
                "type": "header",
                "key": "x-region",
                "value": "eu",
            }],
            "missings": [{
                "type": "cookie",
                "key": "preview",
                "value": "1",
            }],
        })
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumiverse/pulumi-vercel/sdk/v5/go/vercel"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := vercel.NewProject(ctx, "example", &vercel.ProjectArgs{
    			Name: pulumi.String("example-project"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleProjectRoute, err := vercel.NewProjectRoute(ctx, "example", &vercel.ProjectRouteArgs{
    			ProjectId: example.ID(),
    			Name:      pulumi.String("redirect-legacy-docs"),
    			Position: &vercel.ProjectRoutePositionArgs{
    				Placement: pulumi.String("start"),
    			},
    			Route: &vercel.ProjectRouteRouteArgs{
    				Src:    pulumi.String("/docs/:path*"),
    				Dest:   pulumi.String("/guides/:path*"),
    				Status: pulumi.Int(308),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = vercel.NewProjectRoute(ctx, "rewrite_eu_campaign", &vercel.ProjectRouteArgs{
    			ProjectId: example.ID(),
    			Name:      pulumi.String("rewrite-eu-campaign"),
    			Position: &vercel.ProjectRoutePositionArgs{
    				Placement:        pulumi.String("after"),
    				ReferenceRouteId: exampleProjectRoute.ID(),
    			},
    			Route: &vercel.ProjectRouteRouteArgs{
    				Src:  pulumi.String("/promo"),
    				Dest: pulumi.String("/campaigns/eu"),
    				Has: vercel.ProjectRouteRouteHaArray{
    					&vercel.ProjectRouteRouteHaArgs{
    						Type:  pulumi.String("header"),
    						Key:   pulumi.String("x-region"),
    						Value: pulumi.String("eu"),
    					},
    				},
    				Missings: vercel.ProjectRouteRouteMissingArray{
    					&vercel.ProjectRouteRouteMissingArgs{
    						Type:  pulumi.String("cookie"),
    						Key:   pulumi.String("preview"),
    						Value: pulumi.String("1"),
    					},
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Vercel = Pulumiverse.Vercel;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Vercel.Project("example", new()
        {
            Name = "example-project",
        });
    
        var exampleProjectRoute = new Vercel.ProjectRoute("example", new()
        {
            ProjectId = example.Id,
            Name = "redirect-legacy-docs",
            Position = new Vercel.Inputs.ProjectRoutePositionArgs
            {
                Placement = "start",
            },
            Route = new Vercel.Inputs.ProjectRouteRouteArgs
            {
                Src = "/docs/:path*",
                Dest = "/guides/:path*",
                Status = 308,
            },
        });
    
        var rewriteEuCampaign = new Vercel.ProjectRoute("rewrite_eu_campaign", new()
        {
            ProjectId = example.Id,
            Name = "rewrite-eu-campaign",
            Position = new Vercel.Inputs.ProjectRoutePositionArgs
            {
                Placement = "after",
                ReferenceRouteId = exampleProjectRoute.Id,
            },
            Route = new Vercel.Inputs.ProjectRouteRouteArgs
            {
                Src = "/promo",
                Dest = "/campaigns/eu",
                Has = new[]
                {
                    new Vercel.Inputs.ProjectRouteRouteHaArgs
                    {
                        Type = "header",
                        Key = "x-region",
                        Value = "eu",
                    },
                },
                Missings = new[]
                {
                    new Vercel.Inputs.ProjectRouteRouteMissingArgs
                    {
                        Type = "cookie",
                        Key = "preview",
                        Value = "1",
                    },
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumiverse.vercel.Project;
    import com.pulumiverse.vercel.ProjectArgs;
    import com.pulumiverse.vercel.ProjectRoute;
    import com.pulumiverse.vercel.ProjectRouteArgs;
    import com.pulumi.vercel.inputs.ProjectRoutePositionArgs;
    import com.pulumi.vercel.inputs.ProjectRouteRouteArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var example = new Project("example", ProjectArgs.builder()
                .name("example-project")
                .build());
    
            var exampleProjectRoute = new ProjectRoute("exampleProjectRoute", ProjectRouteArgs.builder()
                .projectId(example.id())
                .name("redirect-legacy-docs")
                .position(ProjectRoutePositionArgs.builder()
                    .placement("start")
                    .build())
                .route(ProjectRouteRouteArgs.builder()
                    .src("/docs/:path*")
                    .dest("/guides/:path*")
                    .status(308)
                    .build())
                .build());
    
            var rewriteEuCampaign = new ProjectRoute("rewriteEuCampaign", ProjectRouteArgs.builder()
                .projectId(example.id())
                .name("rewrite-eu-campaign")
                .position(ProjectRoutePositionArgs.builder()
                    .placement("after")
                    .referenceRouteId(exampleProjectRoute.id())
                    .build())
                .route(ProjectRouteRouteArgs.builder()
                    .src("/promo")
                    .dest("/campaigns/eu")
                    .has(ProjectRouteRouteHaArgs.builder()
                        .type("header")
                        .key("x-region")
                        .value("eu")
                        .build())
                    .missings(ProjectRouteRouteMissingArgs.builder()
                        .type("cookie")
                        .key("preview")
                        .value("1")
                        .build())
                    .build())
                .build());
    
        }
    }
    
    resources:
      example:
        type: vercel:Project
        properties:
          name: example-project
      exampleProjectRoute:
        type: vercel:ProjectRoute
        name: example
        properties:
          projectId: ${example.id}
          name: redirect-legacy-docs
          position:
            placement: start
          route:
            src: /docs/:path*
            dest: /guides/:path*
            status: 308
      rewriteEuCampaign:
        type: vercel:ProjectRoute
        name: rewrite_eu_campaign
        properties:
          projectId: ${example.id}
          name: rewrite-eu-campaign
          position:
            placement: after
            referenceRouteId: ${exampleProjectRoute.id}
          route:
            src: /promo
            dest: /campaigns/eu
            has:
              - type: header
                key: x-region
                value: eu
            missings:
              - type: cookie
                key: preview
                value: '1'
    
    Example coming soon!
    

    Create ProjectRoute Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new ProjectRoute(name: string, args: ProjectRouteArgs, opts?: CustomResourceOptions);
    @overload
    def ProjectRoute(resource_name: str,
                     args: ProjectRouteArgs,
                     opts: Optional[ResourceOptions] = None)
    
    @overload
    def ProjectRoute(resource_name: str,
                     opts: Optional[ResourceOptions] = None,
                     project_id: Optional[str] = None,
                     route: Optional[ProjectRouteRouteArgs] = None,
                     description: Optional[str] = None,
                     enabled: Optional[bool] = None,
                     name: Optional[str] = None,
                     position: Optional[ProjectRoutePositionArgs] = None,
                     src_syntax: Optional[str] = None,
                     team_id: Optional[str] = None)
    func NewProjectRoute(ctx *Context, name string, args ProjectRouteArgs, opts ...ResourceOption) (*ProjectRoute, error)
    public ProjectRoute(string name, ProjectRouteArgs args, CustomResourceOptions? opts = null)
    public ProjectRoute(String name, ProjectRouteArgs args)
    public ProjectRoute(String name, ProjectRouteArgs args, CustomResourceOptions options)
    
    type: vercel:ProjectRoute
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    resource "vercel_project_route" "name" {
        # resource properties
    }

    Parameters

    name string
    The unique name of the resource.
    args ProjectRouteArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args ProjectRouteArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args ProjectRouteArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ProjectRouteArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ProjectRouteArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var projectRouteResource = new Vercel.ProjectRoute("projectRouteResource", new()
    {
        ProjectId = "string",
        Route = new Vercel.Inputs.ProjectRouteRouteArgs
        {
            Src = "string",
            CaseSensitive = false,
            Dest = "string",
            Has = new[]
            {
                new Vercel.Inputs.ProjectRouteRouteHaArgs
                {
                    Type = "string",
                    Key = "string",
                    Value = "string",
                },
            },
            Headers = 
            {
                { "string", "string" },
            },
            Missings = new[]
            {
                new Vercel.Inputs.ProjectRouteRouteMissingArgs
                {
                    Type = "string",
                    Key = "string",
                    Value = "string",
                },
            },
            RespectOriginCacheControl = false,
            Status = 0,
            Transforms = new[]
            {
                new Vercel.Inputs.ProjectRouteRouteTransformArgs
                {
                    Op = "string",
                    Type = "string",
                    Args = "string",
                    Envs = new[]
                    {
                        "string",
                    },
                    Target = "string",
                },
            },
        },
        Description = "string",
        Enabled = false,
        Name = "string",
        Position = new Vercel.Inputs.ProjectRoutePositionArgs
        {
            Placement = "string",
            ReferenceRouteId = "string",
        },
        SrcSyntax = "string",
        TeamId = "string",
    });
    
    example, err := vercel.NewProjectRoute(ctx, "projectRouteResource", &vercel.ProjectRouteArgs{
    	ProjectId: pulumi.String("string"),
    	Route: &vercel.ProjectRouteRouteArgs{
    		Src:           pulumi.String("string"),
    		CaseSensitive: pulumi.Bool(false),
    		Dest:          pulumi.String("string"),
    		Has: vercel.ProjectRouteRouteHaArray{
    			&vercel.ProjectRouteRouteHaArgs{
    				Type:  pulumi.String("string"),
    				Key:   pulumi.String("string"),
    				Value: pulumi.String("string"),
    			},
    		},
    		Headers: pulumi.StringMap{
    			"string": pulumi.String("string"),
    		},
    		Missings: vercel.ProjectRouteRouteMissingArray{
    			&vercel.ProjectRouteRouteMissingArgs{
    				Type:  pulumi.String("string"),
    				Key:   pulumi.String("string"),
    				Value: pulumi.String("string"),
    			},
    		},
    		RespectOriginCacheControl: pulumi.Bool(false),
    		Status:                    pulumi.Int(0),
    		Transforms: vercel.ProjectRouteRouteTransformArray{
    			&vercel.ProjectRouteRouteTransformArgs{
    				Op:   pulumi.String("string"),
    				Type: pulumi.String("string"),
    				Args: pulumi.String("string"),
    				Envs: pulumi.StringArray{
    					pulumi.String("string"),
    				},
    				Target: pulumi.String("string"),
    			},
    		},
    	},
    	Description: pulumi.String("string"),
    	Enabled:     pulumi.Bool(false),
    	Name:        pulumi.String("string"),
    	Position: &vercel.ProjectRoutePositionArgs{
    		Placement:        pulumi.String("string"),
    		ReferenceRouteId: pulumi.String("string"),
    	},
    	SrcSyntax: pulumi.String("string"),
    	TeamId:    pulumi.String("string"),
    })
    
    resource "vercel_project_route" "projectRouteResource" {
      lifecycle {
        create_before_destroy = true
      }
      project_id = "string"
      route = {
        src            = "string"
        case_sensitive = false
        dest           = "string"
        has = [{
          type  = "string"
          key   = "string"
          value = "string"
        }]
        headers = {
          "string" = "string"
        }
        missings = [{
          type  = "string"
          key   = "string"
          value = "string"
        }]
        respect_origin_cache_control = false
        status                       = 0
        transforms = [{
          op     = "string"
          type   = "string"
          args   = "string"
          envs   = ["string"]
          target = "string"
        }]
      }
      description = "string"
      enabled     = false
      name        = "string"
      position = {
        placement          = "string"
        reference_route_id = "string"
      }
      src_syntax = "string"
      team_id    = "string"
    }
    
    var projectRouteResource = new ProjectRoute("projectRouteResource", ProjectRouteArgs.builder()
        .projectId("string")
        .route(ProjectRouteRouteArgs.builder()
            .src("string")
            .caseSensitive(false)
            .dest("string")
            .has(ProjectRouteRouteHaArgs.builder()
                .type("string")
                .key("string")
                .value("string")
                .build())
            .headers(Map.of("string", "string"))
            .missings(ProjectRouteRouteMissingArgs.builder()
                .type("string")
                .key("string")
                .value("string")
                .build())
            .respectOriginCacheControl(false)
            .status(0)
            .transforms(ProjectRouteRouteTransformArgs.builder()
                .op("string")
                .type("string")
                .args("string")
                .envs("string")
                .target("string")
                .build())
            .build())
        .description("string")
        .enabled(false)
        .name("string")
        .position(ProjectRoutePositionArgs.builder()
            .placement("string")
            .referenceRouteId("string")
            .build())
        .srcSyntax("string")
        .teamId("string")
        .build());
    
    project_route_resource = vercel.ProjectRoute("projectRouteResource",
        project_id="string",
        route={
            "src": "string",
            "case_sensitive": False,
            "dest": "string",
            "has": [{
                "type": "string",
                "key": "string",
                "value": "string",
            }],
            "headers": {
                "string": "string",
            },
            "missings": [{
                "type": "string",
                "key": "string",
                "value": "string",
            }],
            "respect_origin_cache_control": False,
            "status": 0,
            "transforms": [{
                "op": "string",
                "type": "string",
                "args": "string",
                "envs": ["string"],
                "target": "string",
            }],
        },
        description="string",
        enabled=False,
        name="string",
        position={
            "placement": "string",
            "reference_route_id": "string",
        },
        src_syntax="string",
        team_id="string")
    
    const projectRouteResource = new vercel.ProjectRoute("projectRouteResource", {
        projectId: "string",
        route: {
            src: "string",
            caseSensitive: false,
            dest: "string",
            has: [{
                type: "string",
                key: "string",
                value: "string",
            }],
            headers: {
                string: "string",
            },
            missings: [{
                type: "string",
                key: "string",
                value: "string",
            }],
            respectOriginCacheControl: false,
            status: 0,
            transforms: [{
                op: "string",
                type: "string",
                args: "string",
                envs: ["string"],
                target: "string",
            }],
        },
        description: "string",
        enabled: false,
        name: "string",
        position: {
            placement: "string",
            referenceRouteId: "string",
        },
        srcSyntax: "string",
        teamId: "string",
    });
    
    type: vercel:ProjectRoute
    properties:
        description: string
        enabled: false
        name: string
        position:
            placement: string
            referenceRouteId: string
        projectId: string
        route:
            caseSensitive: false
            dest: string
            has:
                - key: string
                  type: string
                  value: string
            headers:
                string: string
            missings:
                - key: string
                  type: string
                  value: string
            respectOriginCacheControl: false
            src: string
            status: 0
            transforms:
                - args: string
                  envs:
                    - string
                  op: string
                  target: string
                  type: string
        srcSyntax: string
        teamId: string
    

    ProjectRoute Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The ProjectRoute resource accepts the following input properties:

    ProjectId string
    The ID of the project to manage a routing rule for.
    Route Pulumiverse.Vercel.Inputs.ProjectRouteRoute
    The routing rule definition.
    Description string
    An optional description of the rule.
    Enabled bool
    Whether the rule is enabled.
    Name string
    A human-readable name for the rule.
    Position Pulumiverse.Vercel.Inputs.ProjectRoutePosition
    Where to insert the rule when it is created or replaced. This metadata is not returned by the API, so imported routes do not infer it.
    SrcSyntax string
    The source pattern syntax. You can usually omit this and let Vercel infer it from route.src.
    TeamId string
    The ID of the team the project exists under. Required when configuring a team resource if a default team has not been set in the provider.
    ProjectId string
    The ID of the project to manage a routing rule for.
    Route ProjectRouteRouteArgs
    The routing rule definition.
    Description string
    An optional description of the rule.
    Enabled bool
    Whether the rule is enabled.
    Name string
    A human-readable name for the rule.
    Position ProjectRoutePositionArgs
    Where to insert the rule when it is created or replaced. This metadata is not returned by the API, so imported routes do not infer it.
    SrcSyntax string
    The source pattern syntax. You can usually omit this and let Vercel infer it from route.src.
    TeamId string
    The ID of the team the project exists under. Required when configuring a team resource if a default team has not been set in the provider.
    project_id string
    The ID of the project to manage a routing rule for.
    route object
    The routing rule definition.
    description string
    An optional description of the rule.
    enabled bool
    Whether the rule is enabled.
    name string
    A human-readable name for the rule.
    position object
    Where to insert the rule when it is created or replaced. This metadata is not returned by the API, so imported routes do not infer it.
    src_syntax string
    The source pattern syntax. You can usually omit this and let Vercel infer it from route.src.
    team_id string
    The ID of the team the project exists under. Required when configuring a team resource if a default team has not been set in the provider.
    projectId String
    The ID of the project to manage a routing rule for.
    route ProjectRouteRoute
    The routing rule definition.
    description String
    An optional description of the rule.
    enabled Boolean
    Whether the rule is enabled.
    name String
    A human-readable name for the rule.
    position ProjectRoutePosition
    Where to insert the rule when it is created or replaced. This metadata is not returned by the API, so imported routes do not infer it.
    srcSyntax String
    The source pattern syntax. You can usually omit this and let Vercel infer it from route.src.
    teamId String
    The ID of the team the project exists under. Required when configuring a team resource if a default team has not been set in the provider.
    projectId string
    The ID of the project to manage a routing rule for.
    route ProjectRouteRoute
    The routing rule definition.
    description string
    An optional description of the rule.
    enabled boolean
    Whether the rule is enabled.
    name string
    A human-readable name for the rule.
    position ProjectRoutePosition
    Where to insert the rule when it is created or replaced. This metadata is not returned by the API, so imported routes do not infer it.
    srcSyntax string
    The source pattern syntax. You can usually omit this and let Vercel infer it from route.src.
    teamId string
    The ID of the team the project exists under. Required when configuring a team resource if a default team has not been set in the provider.
    project_id str
    The ID of the project to manage a routing rule for.
    route ProjectRouteRouteArgs
    The routing rule definition.
    description str
    An optional description of the rule.
    enabled bool
    Whether the rule is enabled.
    name str
    A human-readable name for the rule.
    position ProjectRoutePositionArgs
    Where to insert the rule when it is created or replaced. This metadata is not returned by the API, so imported routes do not infer it.
    src_syntax str
    The source pattern syntax. You can usually omit this and let Vercel infer it from route.src.
    team_id str
    The ID of the team the project exists under. Required when configuring a team resource if a default team has not been set in the provider.
    projectId String
    The ID of the project to manage a routing rule for.
    route Property Map
    The routing rule definition.
    description String
    An optional description of the rule.
    enabled Boolean
    Whether the rule is enabled.
    name String
    A human-readable name for the rule.
    position Property Map
    Where to insert the rule when it is created or replaced. This metadata is not returned by the API, so imported routes do not infer it.
    srcSyntax String
    The source pattern syntax. You can usually omit this and let Vercel infer it from route.src.
    teamId String
    The ID of the team the project exists under. Required when configuring a team resource if a default team has not been set in the provider.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the ProjectRoute resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    RouteType string
    The computed route type returned by Vercel. One of rewrite, redirect, set_status, or transform.
    Id string
    The provider-assigned unique ID for this managed resource.
    RouteType string
    The computed route type returned by Vercel. One of rewrite, redirect, set_status, or transform.
    id string
    The provider-assigned unique ID for this managed resource.
    route_type string
    The computed route type returned by Vercel. One of rewrite, redirect, set_status, or transform.
    id String
    The provider-assigned unique ID for this managed resource.
    routeType String
    The computed route type returned by Vercel. One of rewrite, redirect, set_status, or transform.
    id string
    The provider-assigned unique ID for this managed resource.
    routeType string
    The computed route type returned by Vercel. One of rewrite, redirect, set_status, or transform.
    id str
    The provider-assigned unique ID for this managed resource.
    route_type str
    The computed route type returned by Vercel. One of rewrite, redirect, set_status, or transform.
    id String
    The provider-assigned unique ID for this managed resource.
    routeType String
    The computed route type returned by Vercel. One of rewrite, redirect, set_status, or transform.

    Look up Existing ProjectRoute Resource

    Get an existing ProjectRoute resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: ProjectRouteState, opts?: CustomResourceOptions): ProjectRoute
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            description: Optional[str] = None,
            enabled: Optional[bool] = None,
            name: Optional[str] = None,
            position: Optional[ProjectRoutePositionArgs] = None,
            project_id: Optional[str] = None,
            route: Optional[ProjectRouteRouteArgs] = None,
            route_type: Optional[str] = None,
            src_syntax: Optional[str] = None,
            team_id: Optional[str] = None) -> ProjectRoute
    func GetProjectRoute(ctx *Context, name string, id IDInput, state *ProjectRouteState, opts ...ResourceOption) (*ProjectRoute, error)
    public static ProjectRoute Get(string name, Input<string> id, ProjectRouteState? state, CustomResourceOptions? opts = null)
    public static ProjectRoute get(String name, Output<String> id, ProjectRouteState state, CustomResourceOptions options)
    resources:  _:    type: vercel:ProjectRoute    get:      id: ${id}
    import {
      to = vercel_project_route.example
      id = "${id}"
    }
    
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    Description string
    An optional description of the rule.
    Enabled bool
    Whether the rule is enabled.
    Name string
    A human-readable name for the rule.
    Position Pulumiverse.Vercel.Inputs.ProjectRoutePosition
    Where to insert the rule when it is created or replaced. This metadata is not returned by the API, so imported routes do not infer it.
    ProjectId string
    The ID of the project to manage a routing rule for.
    Route Pulumiverse.Vercel.Inputs.ProjectRouteRoute
    The routing rule definition.
    RouteType string
    The computed route type returned by Vercel. One of rewrite, redirect, set_status, or transform.
    SrcSyntax string
    The source pattern syntax. You can usually omit this and let Vercel infer it from route.src.
    TeamId string
    The ID of the team the project exists under. Required when configuring a team resource if a default team has not been set in the provider.
    Description string
    An optional description of the rule.
    Enabled bool
    Whether the rule is enabled.
    Name string
    A human-readable name for the rule.
    Position ProjectRoutePositionArgs
    Where to insert the rule when it is created or replaced. This metadata is not returned by the API, so imported routes do not infer it.
    ProjectId string
    The ID of the project to manage a routing rule for.
    Route ProjectRouteRouteArgs
    The routing rule definition.
    RouteType string
    The computed route type returned by Vercel. One of rewrite, redirect, set_status, or transform.
    SrcSyntax string
    The source pattern syntax. You can usually omit this and let Vercel infer it from route.src.
    TeamId string
    The ID of the team the project exists under. Required when configuring a team resource if a default team has not been set in the provider.
    description string
    An optional description of the rule.
    enabled bool
    Whether the rule is enabled.
    name string
    A human-readable name for the rule.
    position object
    Where to insert the rule when it is created or replaced. This metadata is not returned by the API, so imported routes do not infer it.
    project_id string
    The ID of the project to manage a routing rule for.
    route object
    The routing rule definition.
    route_type string
    The computed route type returned by Vercel. One of rewrite, redirect, set_status, or transform.
    src_syntax string
    The source pattern syntax. You can usually omit this and let Vercel infer it from route.src.
    team_id string
    The ID of the team the project exists under. Required when configuring a team resource if a default team has not been set in the provider.
    description String
    An optional description of the rule.
    enabled Boolean
    Whether the rule is enabled.
    name String
    A human-readable name for the rule.
    position ProjectRoutePosition
    Where to insert the rule when it is created or replaced. This metadata is not returned by the API, so imported routes do not infer it.
    projectId String
    The ID of the project to manage a routing rule for.
    route ProjectRouteRoute
    The routing rule definition.
    routeType String
    The computed route type returned by Vercel. One of rewrite, redirect, set_status, or transform.
    srcSyntax String
    The source pattern syntax. You can usually omit this and let Vercel infer it from route.src.
    teamId String
    The ID of the team the project exists under. Required when configuring a team resource if a default team has not been set in the provider.
    description string
    An optional description of the rule.
    enabled boolean
    Whether the rule is enabled.
    name string
    A human-readable name for the rule.
    position ProjectRoutePosition
    Where to insert the rule when it is created or replaced. This metadata is not returned by the API, so imported routes do not infer it.
    projectId string
    The ID of the project to manage a routing rule for.
    route ProjectRouteRoute
    The routing rule definition.
    routeType string
    The computed route type returned by Vercel. One of rewrite, redirect, set_status, or transform.
    srcSyntax string
    The source pattern syntax. You can usually omit this and let Vercel infer it from route.src.
    teamId string
    The ID of the team the project exists under. Required when configuring a team resource if a default team has not been set in the provider.
    description str
    An optional description of the rule.
    enabled bool
    Whether the rule is enabled.
    name str
    A human-readable name for the rule.
    position ProjectRoutePositionArgs
    Where to insert the rule when it is created or replaced. This metadata is not returned by the API, so imported routes do not infer it.
    project_id str
    The ID of the project to manage a routing rule for.
    route ProjectRouteRouteArgs
    The routing rule definition.
    route_type str
    The computed route type returned by Vercel. One of rewrite, redirect, set_status, or transform.
    src_syntax str
    The source pattern syntax. You can usually omit this and let Vercel infer it from route.src.
    team_id str
    The ID of the team the project exists under. Required when configuring a team resource if a default team has not been set in the provider.
    description String
    An optional description of the rule.
    enabled Boolean
    Whether the rule is enabled.
    name String
    A human-readable name for the rule.
    position Property Map
    Where to insert the rule when it is created or replaced. This metadata is not returned by the API, so imported routes do not infer it.
    projectId String
    The ID of the project to manage a routing rule for.
    route Property Map
    The routing rule definition.
    routeType String
    The computed route type returned by Vercel. One of rewrite, redirect, set_status, or transform.
    srcSyntax String
    The source pattern syntax. You can usually omit this and let Vercel infer it from route.src.
    teamId String
    The ID of the team the project exists under. Required when configuring a team resource if a default team has not been set in the provider.

    Supporting Types

    ProjectRoutePosition, ProjectRoutePositionArgs

    Placement string
    Where to place the rule. One of start, end, before, or after.
    ReferenceRouteId string
    The existing route ID to place this rule before or after.
    Placement string
    Where to place the rule. One of start, end, before, or after.
    ReferenceRouteId string
    The existing route ID to place this rule before or after.
    placement string
    Where to place the rule. One of start, end, before, or after.
    reference_route_id string
    The existing route ID to place this rule before or after.
    placement String
    Where to place the rule. One of start, end, before, or after.
    referenceRouteId String
    The existing route ID to place this rule before or after.
    placement string
    Where to place the rule. One of start, end, before, or after.
    referenceRouteId string
    The existing route ID to place this rule before or after.
    placement str
    Where to place the rule. One of start, end, before, or after.
    reference_route_id str
    The existing route ID to place this rule before or after.
    placement String
    Where to place the rule. One of start, end, before, or after.
    referenceRouteId String
    The existing route ID to place this rule before or after.

    ProjectRouteRoute, ProjectRouteRouteArgs

    Src string
    The source pattern to match.
    CaseSensitive bool
    Whether the src matcher is case-sensitive.
    Dest string
    The destination for rewrites or redirects.
    Has List<Pulumiverse.Vercel.Inputs.ProjectRouteRouteHa>
    Conditions that must be present for the rule to match.
    Headers Dictionary<string, string>
    Headers to set for the matched request.
    Missings List<Pulumiverse.Vercel.Inputs.ProjectRouteRouteMissing>
    Conditions that must be absent for the rule to match.
    RespectOriginCacheControl bool
    Whether the rule should respect cache control headers from the origin.
    Status int
    The HTTP status code to set for redirects or status-only rules.
    Transforms List<Pulumiverse.Vercel.Inputs.ProjectRouteRouteTransform>
    Transforms applied to the request or response when the rule matches.
    Src string
    The source pattern to match.
    CaseSensitive bool
    Whether the src matcher is case-sensitive.
    Dest string
    The destination for rewrites or redirects.
    Has []ProjectRouteRouteHa
    Conditions that must be present for the rule to match.
    Headers map[string]string
    Headers to set for the matched request.
    Missings []ProjectRouteRouteMissing
    Conditions that must be absent for the rule to match.
    RespectOriginCacheControl bool
    Whether the rule should respect cache control headers from the origin.
    Status int
    The HTTP status code to set for redirects or status-only rules.
    Transforms []ProjectRouteRouteTransform
    Transforms applied to the request or response when the rule matches.
    src string
    The source pattern to match.
    case_sensitive bool
    Whether the src matcher is case-sensitive.
    dest string
    The destination for rewrites or redirects.
    has list(object)
    Conditions that must be present for the rule to match.
    headers map(string)
    Headers to set for the matched request.
    missings list(object)
    Conditions that must be absent for the rule to match.
    respect_origin_cache_control bool
    Whether the rule should respect cache control headers from the origin.
    status number
    The HTTP status code to set for redirects or status-only rules.
    transforms list(object)
    Transforms applied to the request or response when the rule matches.
    src String
    The source pattern to match.
    caseSensitive Boolean
    Whether the src matcher is case-sensitive.
    dest String
    The destination for rewrites or redirects.
    has List<ProjectRouteRouteHa>
    Conditions that must be present for the rule to match.
    headers Map<String,String>
    Headers to set for the matched request.
    missings List<ProjectRouteRouteMissing>
    Conditions that must be absent for the rule to match.
    respectOriginCacheControl Boolean
    Whether the rule should respect cache control headers from the origin.
    status Integer
    The HTTP status code to set for redirects or status-only rules.
    transforms List<ProjectRouteRouteTransform>
    Transforms applied to the request or response when the rule matches.
    src string
    The source pattern to match.
    caseSensitive boolean
    Whether the src matcher is case-sensitive.
    dest string
    The destination for rewrites or redirects.
    has ProjectRouteRouteHa[]
    Conditions that must be present for the rule to match.
    headers {[key: string]: string}
    Headers to set for the matched request.
    missings ProjectRouteRouteMissing[]
    Conditions that must be absent for the rule to match.
    respectOriginCacheControl boolean
    Whether the rule should respect cache control headers from the origin.
    status number
    The HTTP status code to set for redirects or status-only rules.
    transforms ProjectRouteRouteTransform[]
    Transforms applied to the request or response when the rule matches.
    src str
    The source pattern to match.
    case_sensitive bool
    Whether the src matcher is case-sensitive.
    dest str
    The destination for rewrites or redirects.
    has Sequence[ProjectRouteRouteHa]
    Conditions that must be present for the rule to match.
    headers Mapping[str, str]
    Headers to set for the matched request.
    missings Sequence[ProjectRouteRouteMissing]
    Conditions that must be absent for the rule to match.
    respect_origin_cache_control bool
    Whether the rule should respect cache control headers from the origin.
    status int
    The HTTP status code to set for redirects or status-only rules.
    transforms Sequence[ProjectRouteRouteTransform]
    Transforms applied to the request or response when the rule matches.
    src String
    The source pattern to match.
    caseSensitive Boolean
    Whether the src matcher is case-sensitive.
    dest String
    The destination for rewrites or redirects.
    has List<Property Map>
    Conditions that must be present for the rule to match.
    headers Map<String>
    Headers to set for the matched request.
    missings List<Property Map>
    Conditions that must be absent for the rule to match.
    respectOriginCacheControl Boolean
    Whether the rule should respect cache control headers from the origin.
    status Number
    The HTTP status code to set for redirects or status-only rules.
    transforms List<Property Map>
    Transforms applied to the request or response when the rule matches.

    ProjectRouteRouteHa, ProjectRouteRouteHaArgs

    Type string
    The condition type. One of host, header, cookie, or query.
    Key string
    The key to match for header, cookie, or query conditions.
    Value string
    The value to match.
    Type string
    The condition type. One of host, header, cookie, or query.
    Key string
    The key to match for header, cookie, or query conditions.
    Value string
    The value to match.
    type string
    The condition type. One of host, header, cookie, or query.
    key string
    The key to match for header, cookie, or query conditions.
    value string
    The value to match.
    type String
    The condition type. One of host, header, cookie, or query.
    key String
    The key to match for header, cookie, or query conditions.
    value String
    The value to match.
    type string
    The condition type. One of host, header, cookie, or query.
    key string
    The key to match for header, cookie, or query conditions.
    value string
    The value to match.
    type str
    The condition type. One of host, header, cookie, or query.
    key str
    The key to match for header, cookie, or query conditions.
    value str
    The value to match.
    type String
    The condition type. One of host, header, cookie, or query.
    key String
    The key to match for header, cookie, or query conditions.
    value String
    The value to match.

    ProjectRouteRouteMissing, ProjectRouteRouteMissingArgs

    Type string
    The condition type. One of host, header, cookie, or query.
    Key string
    The key to match for header, cookie, or query conditions.
    Value string
    The value to match.
    Type string
    The condition type. One of host, header, cookie, or query.
    Key string
    The key to match for header, cookie, or query conditions.
    Value string
    The value to match.
    type string
    The condition type. One of host, header, cookie, or query.
    key string
    The key to match for header, cookie, or query conditions.
    value string
    The value to match.
    type String
    The condition type. One of host, header, cookie, or query.
    key String
    The key to match for header, cookie, or query conditions.
    value String
    The value to match.
    type string
    The condition type. One of host, header, cookie, or query.
    key string
    The key to match for header, cookie, or query conditions.
    value string
    The value to match.
    type str
    The condition type. One of host, header, cookie, or query.
    key str
    The key to match for header, cookie, or query conditions.
    value str
    The value to match.
    type String
    The condition type. One of host, header, cookie, or query.
    key String
    The key to match for header, cookie, or query conditions.
    value String
    The value to match.

    ProjectRouteRouteTransform, ProjectRouteRouteTransformArgs

    Op string
    The transform operation. One of append, set, or delete.
    Type string
    The transform target. One of request.headers, request.query, or response.headers.
    Args string
    A JSON document containing transform arguments. Prefer jsonencode(...) when setting this.
    Envs List<string>
    Environment names that gate this transform.
    Target string
    A JSON document describing the transform target. Prefer jsonencode(...) when setting this.
    Op string
    The transform operation. One of append, set, or delete.
    Type string
    The transform target. One of request.headers, request.query, or response.headers.
    Args string
    A JSON document containing transform arguments. Prefer jsonencode(...) when setting this.
    Envs []string
    Environment names that gate this transform.
    Target string
    A JSON document describing the transform target. Prefer jsonencode(...) when setting this.
    op string
    The transform operation. One of append, set, or delete.
    type string
    The transform target. One of request.headers, request.query, or response.headers.
    args string
    A JSON document containing transform arguments. Prefer jsonencode(...) when setting this.
    envs list(string)
    Environment names that gate this transform.
    target string
    A JSON document describing the transform target. Prefer jsonencode(...) when setting this.
    op String
    The transform operation. One of append, set, or delete.
    type String
    The transform target. One of request.headers, request.query, or response.headers.
    args String
    A JSON document containing transform arguments. Prefer jsonencode(...) when setting this.
    envs List<String>
    Environment names that gate this transform.
    target String
    A JSON document describing the transform target. Prefer jsonencode(...) when setting this.
    op string
    The transform operation. One of append, set, or delete.
    type string
    The transform target. One of request.headers, request.query, or response.headers.
    args string
    A JSON document containing transform arguments. Prefer jsonencode(...) when setting this.
    envs string[]
    Environment names that gate this transform.
    target string
    A JSON document describing the transform target. Prefer jsonencode(...) when setting this.
    op str
    The transform operation. One of append, set, or delete.
    type str
    The transform target. One of request.headers, request.query, or response.headers.
    args str
    A JSON document containing transform arguments. Prefer jsonencode(...) when setting this.
    envs Sequence[str]
    Environment names that gate this transform.
    target str
    A JSON document describing the transform target. Prefer jsonencode(...) when setting this.
    op String
    The transform operation. One of append, set, or delete.
    type String
    The transform target. One of request.headers, request.query, or response.headers.
    args String
    A JSON document containing transform arguments. Prefer jsonencode(...) when setting this.
    envs List<String>
    Environment names that gate this transform.
    target String
    A JSON document describing the transform target. Prefer jsonencode(...) when setting this.

    Import

    The pulumi import command can be used, for example:

    If importing with a team configured on the provider, use the project ID and route ID.

    • project_id can be found in the project settings tab in the Vercel UI.
    • route_id can be read from data.vercel_project_routes or the Vercel routing-rules API.
    $ pulumi import vercel:index/projectRoute:ProjectRoute example prj_xxxxxxxxxxxxxxxxxxxxxxxxxxxx/rt_xxxxxxxxxxxxxxxxxxxxxxxxxxxx
    

    Alternatively, you can import via the team_id, project_id, and route_id.

    • team_id can be found in the team settings tab in the Vercel UI.
    • project_id can be found in the project settings tab in the Vercel UI.
    • route_id can be read from data.vercel_project_routes or the Vercel routing-rules API.
    $ pulumi import vercel:index/projectRoute:ProjectRoute example team_xxxxxxxxxxxxxxxxxxxxxxxx/prj_xxxxxxxxxxxxxxxxxxxxxxxxxxxx/rt_xxxxxxxxxxxxxxxxxxxxxxxxxxxx
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    vercel pulumiverse/pulumi-vercel
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the vercel Terraform Provider.
    vercel logo
    Viewing docs for Vercel v5.4.1
    published on Wednesday, Jul 22, 2026 by Pulumiverse

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial