---
title: "Create a deployment rule"
method: POST
path: "/project/{projectId}/deploymentRule"
tags: ["Project Deployment Rule"]
---

# Create a deployment rule

`POST /project/{projectId}/deploymentRule`

## Request

- Base URL: `https://api.qovery.com`
- URL: `https://api.qovery.com/project/{projectId}/deploymentRule`
- Auth: one of:
  - API key in header `Authorization`
  - HTTP bearer
- TypeScript: <https://skmtc.dev/qovery/apis/qovery-api/docs/project/:projectId/deploymentRule/post.ts> (a function with typed inputs; its response is checked against the schema)

Create a deployment rule

## Path parameters

- `projectId` string, uuid, required

## Request body

- ProjectDeploymentRuleRequest
  - `name` string, required: name is case insensitive
  - `description` string, nullable
  - `mode` 'DEVELOPMENT' | 'PREVIEW' | 'PRODUCTION' | 'STAGING', required
  - `cluster_id` string, uuid, required
  - `auto_stop` boolean
  - `timezone` string, required
  - `start_time` string, date-time, required
  - `stop_time` string, date-time, required
  - `weekdays` WeekdayEnum[], required
  - `wildcard` string, required: wildcard pattern composed of '?' and/or '*' used to target new created environments

## Response `201`

Create deployment rule

- ProjectDeploymentRule
  - `id` string, uuid, required
  - `created_at` string, date-time, required
  - `updated_at` string, date-time
  - `name` string, required: name is case insensitive
  - `description` string, nullable
  - `mode` 'DEVELOPMENT' | 'PREVIEW' | 'PRODUCTION' | 'STAGING', required
  - `cluster_id` string, uuid, required
  - `auto_stop` boolean
  - `timezone` string, required
  - `start_time` string, date-time, required
  - `stop_time` string, date-time, required
  - `weekdays` WeekdayEnum[], required
  - `wildcard` string, required: wildcard pattern composed of '?' and/or '*' used to target new created environments
  - `priority_index` integer: used to select the first deployment rule to match new created environments

## Other responses

- `400`: Bad request
- `401`: Access token is missing or invalid
- `403`: Access forbidden
- `404`: Resource not found

---

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