---
title: "Save an agent-authored Raw script into Veilus Flow."
method: POST
path: "/v1/scripts"
---

# Save an agent-authored Raw script into Veilus Flow.

`POST /v1/scripts`

## Request

- Base URL: `http://127.0.0.1:10108`
- URL: `http://127.0.0.1:10108/v1/scripts`
- Auth: HTTP bearer

Saves a Raw TypeScript script into Veilus Flow, or replaces one this API saved before. The source is checked against the Raw script contract first; a script stays unapproved until the user approves it in the app.

## Request body

- object
  - `description` string
  - `name` string, required
  - `script_id` string, uuid: Script to replace; omit to create a new one
  - `source` string, required: Full TypeScript source

## Response `200`

Saved. An agent-written script stays unapproved until the user approves it.

- object
  - `approved` boolean, required
  - `scriptId` string, uuid, required
  - `version` string, required

## Other responses

- `400`: Empty name, the plan lacks Veilus Flow, or the source breaks the Raw script contract (one line per violation).
- `401`: No bearer token, or not a token this app issued. The body is empty: it never says which.
- `403`: Refused by the plan: it no longer includes the local API (checked on every request), or it does not allow this action (profile or schedule limit, parallel runs). A request whose Host header is not loopback is also 403, with an empty body.
- `404`: `script_id` names no script.
- `409`: `script_id` names a DSL script, or one the user wrote in the app; create a new script instead.
- `500`: Veilus failed: storage could not be read or written, or a task panicked. The message says what failed; retrying rarely helps.

---

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