---
title: "Create Deployment"
method: POST
path: "/api/deployments/"
tags: ["Deployments"]
---

# Create Deployment

`POST /api/deployments/`

Gracefully creates a new deployment from the provided schema. If a deployment with
the same name and flow_id already exists, the deployment is updated.

If the deployment has an active schedule, flow runs will be scheduled.
When upserting, any scheduled runs from the existing deployment will be deleted.

## Headers

- `x-prefect-api-version` string

## Request body

- DeploymentCreate — Data used by the Prefect REST API to create a deployment.
  - `infra_overrides` object — Deprecated field. Use `job_variables` instead.
  - `name` string, required — The name of the deployment.
  - `flow_id` string, uuid, required — The ID of the flow associated with the deployment.
  - `is_schedule_active` boolean — Whether the schedule is active.
  - `paused` boolean — Whether or not the deployment is paused.
  - `schedules` DeploymentScheduleCreate[] — A list of schedules for the deployment.
    - `active` boolean — Whether or not the schedule is active.
    - `schedule` union, required — The schedule for the deployment.
      - IntervalSchedule — A schedule formed by adding `interval` increments to an `anchor_date`. If no `anchor_date` is supplied, the current UTC time is used. If a timezone-naive datetime is provided for `anchor_date`, it is assumed to be in the schedule's timezone (or UTC). Even if supplied with an IANA timezone, anchor dates are always stored as UTC offsets, so a `timezone` can be provided to determine localization behaviors like DST boundary handling. If none is provided it will be inferred from the anchor date. NOTE: If the `IntervalSchedule` `anchor_date` or `timezone` is provided in a DST-observing timezone, then the schedule will adjust itself appropriately. Intervals greater than 24 hours will follow DST conventions, while intervals of less than 24 hours will follow UTC intervals. For example, an hourly schedule will fire every UTC hour, even across DST boundaries. When clocks are set back, this will result in two runs that *appear* to both be scheduled for 1am local time, even though they are an hour apart in UTC time. For longer intervals, like a daily schedule, the interval schedule will adjust for DST boundaries so that the clock-hour remains constant. This means that a daily schedule that always fires at 9am will observe DST and continue to fire at 9am in the local time zone. Args: interval (datetime.timedelta): an interval to schedule on. anchor_date (DateTimeTZ, optional): an anchor date to schedule increments against; if not provided, the current timestamp will be used. timezone (str, optional): a valid timezone string.
        - `interval` number, required
        - `anchor_date` string, date-time
        - `timezone` string
      - CronSchedule — Cron schedule NOTE: If the timezone is a DST-observing one, then the schedule will adjust itself appropriately. Cron's rules for DST are based on schedule times, not intervals. This means that an hourly cron schedule will fire on every new schedule hour, not every elapsed hour; for example, when clocks are set back this will result in a two-hour pause as the schedule will fire *the first time* 1am is reached and *the first time* 2am is reached, 120 minutes later. Longer schedules, such as one that fires at 9am every morning, will automatically adjust for DST. Args: cron (str): a valid cron string timezone (str): a valid timezone string in IANA tzdata format (for example, America/New_York). day_or (bool, optional): Control how croniter handles `day` and `day_of_week` entries. Defaults to True, matching cron which connects those values using OR. If the switch is set to False, the values are connected using AND. This behaves like fcron and enables you to e.g. define a job that executes each 2nd friday of a month by setting the days of month and the weekday.
        - `cron` string, required
        - `timezone` string
        - `day_or` boolean — Control croniter behavior for handling day and day_of_week entries.
      - RRuleSchedule — RRule schedule, based on the iCalendar standard ([RFC 5545](https://datatracker.ietf.org/doc/html/rfc5545)) as implemented in `dateutils.rrule`. RRules are appropriate for any kind of calendar-date manipulation, including irregular intervals, repetition, exclusions, week day or day-of-month adjustments, and more. Note that as a calendar-oriented standard, `RRuleSchedules` are sensitive to to the initial timezone provided. A 9am daily schedule with a daylight saving time-aware start date will maintain a local 9am time through DST boundaries; a 9am daily schedule with a UTC start date will maintain a 9am UTC time. Args: rrule (str): a valid RRule string timezone (str, optional): a valid timezone string
        - `rrule` string, required
        - `timezone` string
    - `max_active_runs` integer — The maximum number of active runs for the schedule.
    - `max_scheduled_runs` integer — The maximum number of scheduled runs for the schedule.
    - `catchup` boolean — Whether or not a worker should catch up on Late runs for the schedule.
  - `enforce_parameter_schema` boolean — Whether or not the deployment should enforce the parameter schema.
  - `parameter_openapi_schema` object — The parameter schema of the flow, including defaults.
  - `parameters` object — Parameters for flow runs scheduled by the deployment.
  - `tags` string[] — A list of deployment tags.
  - `pull_steps` object[]
  - `manifest_path` string
  - `work_queue_name` string
  - `work_pool_name` string — The name of the deployment's work pool.
  - `storage_document_id` string, uuid
  - `infrastructure_document_id` string, uuid
  - `schedule` union — The schedule for the deployment.
    - IntervalSchedule — A schedule formed by adding `interval` increments to an `anchor_date`. If no `anchor_date` is supplied, the current UTC time is used. If a timezone-naive datetime is provided for `anchor_date`, it is assumed to be in the schedule's timezone (or UTC). Even if supplied with an IANA timezone, anchor dates are always stored as UTC offsets, so a `timezone` can be provided to determine localization behaviors like DST boundary handling. If none is provided it will be inferred from the anchor date. NOTE: If the `IntervalSchedule` `anchor_date` or `timezone` is provided in a DST-observing timezone, then the schedule will adjust itself appropriately. Intervals greater than 24 hours will follow DST conventions, while intervals of less than 24 hours will follow UTC intervals. For example, an hourly schedule will fire every UTC hour, even across DST boundaries. When clocks are set back, this will result in two runs that *appear* to both be scheduled for 1am local time, even though they are an hour apart in UTC time. For longer intervals, like a daily schedule, the interval schedule will adjust for DST boundaries so that the clock-hour remains constant. This means that a daily schedule that always fires at 9am will observe DST and continue to fire at 9am in the local time zone. Args: interval (datetime.timedelta): an interval to schedule on. anchor_date (DateTimeTZ, optional): an anchor date to schedule increments against; if not provided, the current timestamp will be used. timezone (str, optional): a valid timezone string.
      - `interval` number, required
      - `anchor_date` string, date-time
      - `timezone` string
    - CronSchedule — Cron schedule NOTE: If the timezone is a DST-observing one, then the schedule will adjust itself appropriately. Cron's rules for DST are based on schedule times, not intervals. This means that an hourly cron schedule will fire on every new schedule hour, not every elapsed hour; for example, when clocks are set back this will result in a two-hour pause as the schedule will fire *the first time* 1am is reached and *the first time* 2am is reached, 120 minutes later. Longer schedules, such as one that fires at 9am every morning, will automatically adjust for DST. Args: cron (str): a valid cron string timezone (str): a valid timezone string in IANA tzdata format (for example, America/New_York). day_or (bool, optional): Control how croniter handles `day` and `day_of_week` entries. Defaults to True, matching cron which connects those values using OR. If the switch is set to False, the values are connected using AND. This behaves like fcron and enables you to e.g. define a job that executes each 2nd friday of a month by setting the days of month and the weekday.
      - `cron` string, required
      - `timezone` string
      - `day_or` boolean — Control croniter behavior for handling day and day_of_week entries.
    - RRuleSchedule — RRule schedule, based on the iCalendar standard ([RFC 5545](https://datatracker.ietf.org/doc/html/rfc5545)) as implemented in `dateutils.rrule`. RRules are appropriate for any kind of calendar-date manipulation, including irregular intervals, repetition, exclusions, week day or day-of-month adjustments, and more. Note that as a calendar-oriented standard, `RRuleSchedules` are sensitive to to the initial timezone provided. A 9am daily schedule with a daylight saving time-aware start date will maintain a local 9am time through DST boundaries; a 9am daily schedule with a UTC start date will maintain a 9am UTC time. Args: rrule (str): a valid RRule string timezone (str, optional): a valid timezone string
      - `rrule` string, required
      - `timezone` string
  - `description` string
  - `path` string
  - `version` string
  - `entrypoint` string
  - `job_variables` object — Overrides for the flow's infrastructure configuration.

## Response `200`

Successful Response

- DeploymentResponse — A model mixin that handles the deprecated `infra_overrides` field. The `infra_overrides` field has been renamed to `job_variables`. This mixin maintains backwards compatibility with users of the `infra_overrides` field while presenting `job_variables` as the user-facing field. When we remove support for `infra_overrides`, we can remove this class as a parent of all schemas that use it, leaving them with only the `job_variables` field.
  - `id` string, uuid
  - `created` string, date-time
  - `updated` string, date-time
  - `infra_overrides` object — Deprecated field. Use `job_variables` instead.
  - `name` string, required — The name of the deployment.
  - `version` string — An optional version for the deployment.
  - `description` string — A description for the deployment.
  - `flow_id` string, uuid, required — The flow id associated with the deployment.
  - `schedule` union — A schedule for the deployment.
    - IntervalSchedule — A schedule formed by adding `interval` increments to an `anchor_date`. If no `anchor_date` is supplied, the current UTC time is used. If a timezone-naive datetime is provided for `anchor_date`, it is assumed to be in the schedule's timezone (or UTC). Even if supplied with an IANA timezone, anchor dates are always stored as UTC offsets, so a `timezone` can be provided to determine localization behaviors like DST boundary handling. If none is provided it will be inferred from the anchor date. NOTE: If the `IntervalSchedule` `anchor_date` or `timezone` is provided in a DST-observing timezone, then the schedule will adjust itself appropriately. Intervals greater than 24 hours will follow DST conventions, while intervals of less than 24 hours will follow UTC intervals. For example, an hourly schedule will fire every UTC hour, even across DST boundaries. When clocks are set back, this will result in two runs that *appear* to both be scheduled for 1am local time, even though they are an hour apart in UTC time. For longer intervals, like a daily schedule, the interval schedule will adjust for DST boundaries so that the clock-hour remains constant. This means that a daily schedule that always fires at 9am will observe DST and continue to fire at 9am in the local time zone. Args: interval (datetime.timedelta): an interval to schedule on. anchor_date (DateTimeTZ, optional): an anchor date to schedule increments against; if not provided, the current timestamp will be used. timezone (str, optional): a valid timezone string.
      - `interval` number, required
      - `anchor_date` string, date-time
      - `timezone` string
    - CronSchedule — Cron schedule NOTE: If the timezone is a DST-observing one, then the schedule will adjust itself appropriately. Cron's rules for DST are based on schedule times, not intervals. This means that an hourly cron schedule will fire on every new schedule hour, not every elapsed hour; for example, when clocks are set back this will result in a two-hour pause as the schedule will fire *the first time* 1am is reached and *the first time* 2am is reached, 120 minutes later. Longer schedules, such as one that fires at 9am every morning, will automatically adjust for DST. Args: cron (str): a valid cron string timezone (str): a valid timezone string in IANA tzdata format (for example, America/New_York). day_or (bool, optional): Control how croniter handles `day` and `day_of_week` entries. Defaults to True, matching cron which connects those values using OR. If the switch is set to False, the values are connected using AND. This behaves like fcron and enables you to e.g. define a job that executes each 2nd friday of a month by setting the days of month and the weekday.
      - `cron` string, required
      - `timezone` string
      - `day_or` boolean — Control croniter behavior for handling day and day_of_week entries.
    - RRuleSchedule — RRule schedule, based on the iCalendar standard ([RFC 5545](https://datatracker.ietf.org/doc/html/rfc5545)) as implemented in `dateutils.rrule`. RRules are appropriate for any kind of calendar-date manipulation, including irregular intervals, repetition, exclusions, week day or day-of-month adjustments, and more. Note that as a calendar-oriented standard, `RRuleSchedules` are sensitive to to the initial timezone provided. A 9am daily schedule with a daylight saving time-aware start date will maintain a local 9am time through DST boundaries; a 9am daily schedule with a UTC start date will maintain a 9am UTC time. Args: rrule (str): a valid RRule string timezone (str, optional): a valid timezone string
      - `rrule` string, required
      - `timezone` string
  - `is_schedule_active` boolean — Whether or not the deployment schedule is active.
  - `paused` boolean — Whether or not the deployment is paused.
  - `schedules` DeploymentSchedule[] — A list of schedules for the deployment.
    - `id` string, uuid
    - `created` string, date-time
    - `updated` string, date-time
    - `deployment_id` string, uuid — The deployment id associated with this schedule.
    - `schedule` union, required — The schedule for the deployment.
      - IntervalSchedule — A schedule formed by adding `interval` increments to an `anchor_date`. If no `anchor_date` is supplied, the current UTC time is used. If a timezone-naive datetime is provided for `anchor_date`, it is assumed to be in the schedule's timezone (or UTC). Even if supplied with an IANA timezone, anchor dates are always stored as UTC offsets, so a `timezone` can be provided to determine localization behaviors like DST boundary handling. If none is provided it will be inferred from the anchor date. NOTE: If the `IntervalSchedule` `anchor_date` or `timezone` is provided in a DST-observing timezone, then the schedule will adjust itself appropriately. Intervals greater than 24 hours will follow DST conventions, while intervals of less than 24 hours will follow UTC intervals. For example, an hourly schedule will fire every UTC hour, even across DST boundaries. When clocks are set back, this will result in two runs that *appear* to both be scheduled for 1am local time, even though they are an hour apart in UTC time. For longer intervals, like a daily schedule, the interval schedule will adjust for DST boundaries so that the clock-hour remains constant. This means that a daily schedule that always fires at 9am will observe DST and continue to fire at 9am in the local time zone. Args: interval (datetime.timedelta): an interval to schedule on. anchor_date (DateTimeTZ, optional): an anchor date to schedule increments against; if not provided, the current timestamp will be used. timezone (str, optional): a valid timezone string.
        - `interval` number, required
        - `anchor_date` string, date-time
        - `timezone` string
      - CronSchedule — Cron schedule NOTE: If the timezone is a DST-observing one, then the schedule will adjust itself appropriately. Cron's rules for DST are based on schedule times, not intervals. This means that an hourly cron schedule will fire on every new schedule hour, not every elapsed hour; for example, when clocks are set back this will result in a two-hour pause as the schedule will fire *the first time* 1am is reached and *the first time* 2am is reached, 120 minutes later. Longer schedules, such as one that fires at 9am every morning, will automatically adjust for DST. Args: cron (str): a valid cron string timezone (str): a valid timezone string in IANA tzdata format (for example, America/New_York). day_or (bool, optional): Control how croniter handles `day` and `day_of_week` entries. Defaults to True, matching cron which connects those values using OR. If the switch is set to False, the values are connected using AND. This behaves like fcron and enables you to e.g. define a job that executes each 2nd friday of a month by setting the days of month and the weekday.
        - `cron` string, required
        - `timezone` string
        - `day_or` boolean — Control croniter behavior for handling day and day_of_week entries.
      - RRuleSchedule — RRule schedule, based on the iCalendar standard ([RFC 5545](https://datatracker.ietf.org/doc/html/rfc5545)) as implemented in `dateutils.rrule`. RRules are appropriate for any kind of calendar-date manipulation, including irregular intervals, repetition, exclusions, week day or day-of-month adjustments, and more. Note that as a calendar-oriented standard, `RRuleSchedules` are sensitive to to the initial timezone provided. A 9am daily schedule with a daylight saving time-aware start date will maintain a local 9am time through DST boundaries; a 9am daily schedule with a UTC start date will maintain a 9am UTC time. Args: rrule (str): a valid RRule string timezone (str, optional): a valid timezone string
        - `rrule` string, required
        - `timezone` string
    - `active` boolean — Whether or not the schedule is active.
    - `max_active_runs` integer — The maximum number of active runs for the schedule.
    - `max_scheduled_runs` integer — The maximum number of scheduled runs for the schedule.
    - `catchup` boolean — Whether or not a worker should catch up on Late runs for the schedule.
  - `job_variables` object — Overrides to apply to the base infrastructure block at runtime.
  - `parameters` object — Parameters for flow runs scheduled by the deployment.
  - `tags` string[] — A list of tags for the deployment
  - `work_queue_name` string — The work queue for the deployment. If no work queue is set, work will not be scheduled.
  - `last_polled` string, date-time — The last time the deployment was polled for status updates.
  - `parameter_openapi_schema` object — The parameter schema of the flow, including defaults.
  - `path` string — The path to the working directory for the workflow, relative to remote storage or an absolute path.
  - `pull_steps` object[] — Pull steps for cloning and running this deployment.
  - `entrypoint` string — The path to the entrypoint for the workflow, relative to the `path`.
  - `manifest_path` string — The path to the flow's manifest file, relative to the chosen storage.
  - `storage_document_id` string, uuid — The block document defining storage used for this flow.
  - `infrastructure_document_id` string, uuid — The block document defining infrastructure to use for flow runs.
  - `created_by` CreatedBy
    - `id` string, uuid — The id of the creator of the object.
    - `type` string — The type of the creator of the object.
    - `display_value` string — The display value for the creator.
  - `updated_by` UpdatedBy
    - `id` string, uuid — The id of the updater of the object.
    - `type` string — The type of the updater of the object.
    - `display_value` string — The display value for the updater.
  - `work_pool_name` string — The name of the deployment's work pool.
  - `status` 'READY' | 'NOT_READY' — Enumeration of deployment statuses.
  - `enforce_parameter_schema` boolean — Whether or not the deployment should enforce the parameter schema.

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/prefecthq/apis/untitled-api-2.md) · [All operations](https://skmtc.net/prefecthq/apis/untitled-api-2/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/prefecthq/untitled-api-2/revisions/29ba6c4f8837/schema)
