---
title: "Create script"
method: POST
path: "/api/scripts/{handle}"
---

# Create script

`POST /api/scripts/{handle}`

## Request

- Base URL: `https://reduck.ai`
- URL: `https://reduck.ai/api/scripts/{handle}`
- Auth: one of:
  - HTTP bearer
  - API key in header `X-API-Key`

Create a script under an owner handle, together with its first version, in one call.

## Path parameters

- `handle` string, required: The owner a resource is addressed under: "@username" for a personal scope, or a bare slug for a project.

## Request body

- object
  - `host` string, required: The site the script automates, as a hostname.
  - `slug` string, required: The script's unique identifier within its host, unique per owner.
  - `name` string
  - `description` string, required
  - `visibility` 'private' | 'public'
  - `content` string, required
  - `language` 'typescript' | 'javascript'
  - `input_schema` object, required
  - `output_schema` object, required
  - `logged_in` boolean
  - `side_effects` 'none' | 'write', required: What running this version does to the site: `none` only reads, `write` acts on it. Declared by the author and never enforced, so treat it as a claim, not a guarantee.
  - `human_required` boolean
  - `draft` boolean: Leave the first version unpromoted, so the script starts with no current version.
  - `bypass_check` boolean: Skip the authoring-rules check a version goes live under. Only when a check refused this version and you judge the refusal wrong.

## Response `201`

Created

- object
  - `id` string, required
  - `host` string, required
  - `slug` string, required
  - `current_version_id` string, nullable, required: The version the script now runs, null when the first version was created as a draft.
  - `created_version_id` string, required: The version just created. While it stays a draft the script does not point at it.

## Other responses

- `400`: Invalid request
- `401`: Not authenticated
- `403`: You may not create scripts under that owner.
- `404`: Not found
- `409`: That owner already has a script on this host and slug, or a draft first version was asked for alongside `visibility: "public"`.

---

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