---
title: "Create script"
method: POST
path: "/v1/scripts"
tags: ["Scripts"]
---

# Create script

`POST /v1/scripts`

Create a new script with optional files and metadata

## Headers

- `x-api-key` string, nullable — Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.

## Request body

- CreateScriptRequest
  - `workflow_id` string, nullable — Associated workflow ID
  - `run_id` string, nullable — Associated run ID
  - `files` ScriptFileCreate[], nullable — Array of files to include in the script
    - `path` string, required — File path relative to script root
    - `content` string, required — Base64 encoded file content
    - `encoding` 'base64' | 'utf-8' — Supported file content encodings.
    - `mime_type` string, nullable — MIME type (auto-detected if not provided)

## Response `200`

Successful Response

- CreateScriptResponse
  - `script_id` string, required — Unique script identifier
  - `version` integer, required — Script version number
  - `run_id` string, nullable — ID of the workflow run or task run that generated this script
  - `file_count` integer, required — Total number of files in the script
  - `file_tree` object, required — Hierarchical file tree structure
  - `created_at` string, date-time, required — Timestamp when the script was created

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/skyvern-ai/apis/skyvern-api-2.md) · [All operations](https://skmtc.net/skyvern-ai/apis/skyvern-api-2/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/skyvern-ai/skyvern-api-2/versions/29562c6e0364/schema)
