---
title: "create script"
method: POST
path: "/w/{workspace}/scripts/create"
tags: ["script"]
---

# create script

`POST /w/{workspace}/scripts/create`

Creates a new script when the path does not already exist.
Creates a new version of an existing script when called with the same path and the current `parent_hash`.

## Path parameters

- `workspace` string, required

## Request body

- NewScript
  - `path` string, required
  - `parent_hash` string
  - `auto_parent` boolean — When true, the backend resolves the parent to the current deployed head for this path within the transaction (ignoring parent_hash), instead of failing with a "lineage must be linear" error when the supplied parent_hash is stale.
  - `summary` string, required
  - `description` string
  - `content` string, required
  - `schema` object
  - `is_template` boolean
  - `lock` string
  - `language` 'python3' | 'deno' | 'go' | 'bash' | 'powershell' | 'postgresql' | 'mysql' | 'bigquery' | 'snowflake' | 'mssql' | 'oracledb' | 'graphql' | 'nativets' | 'bun' | 'php' | 'rust' | 'ansible' | 'csharp' | 'nu' | 'java' | 'ruby' | 'rlang' | 'duckdb' | 'bunnative' | 'dbt', required
  - `kind` 'script' | 'failure' | 'trigger' | 'command' | 'approval' | 'preprocessor'
  - `tag` string
  - `envs` string[]
  - `concurrent_limit` integer
  - `concurrency_time_window_s` integer
  - `cache_ttl` number
  - `cache_ignore_s3_path` boolean
  - `dedicated_worker` boolean
  - `ws_error_handler_muted` boolean
  - `priority` integer
  - `restart_unless_cancelled` boolean
  - `timeout` integer
  - `delete_after_secs` integer — If set, delete the job's args, result and logs after this many seconds following job completion
  - `deployment_message` string
  - `concurrency_key` string
  - `debounce_key` string
  - `debounce_delay_s` integer
  - `debounce_args_to_accumulate` string[]
  - `max_total_debouncing_time` integer
  - `max_total_debounces_amount` integer
  - `visible_to_runner_only` boolean
  - `auto_kind` string
  - `codebase` string
  - `has_preprocessor` boolean
  - `on_behalf_of_email` string
  - `on_behalf_of` string — Authorization identity to run as: u/{username}, g/{group}, or a bare email when the username is itself email-shaped. Supply this or on_behalf_of_email; when only the address is given it is resolved to the account it names, and an address naming nobody is rejected. A pair that disagrees is rejected.
  - `preserve_on_behalf_of` boolean — When true and the caller is a member of the 'wm_deployers' group, preserves the original on_behalf_of_email / on_behalf_of pair instead of overwriting it with the caller's own identity.
  - `assets` object[]
    - `path` string, required
    - `kind` 's3object' | 'resource' | 'ducklake' | 'datatable' | 'volume' | 'dbt', required
    - `access_type` 'r' | 'w' | 'rw'
    - `alt_access_type` 'r' | 'w' | 'rw'
  - `modules` object, nullable — Additional script modules keyed by relative file path
  - `labels` string[]
  - `skip_draft_deletion` boolean — When true (set by the CLI / git sync), deploying this script does not delete an existing user draft at the same path.

## Response `201`

script created

---

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