---
title: "POST /v2/background-scripts/"
method: POST
path: "/v2/background-scripts/"
tags: ["blueprints_Background Scripts API"]
---

# POST /v2/background-scripts/

`POST /v2/background-scripts/`

Create a new background script

## Request body

- BlueprintsBackgroundScriptCreate
  - `name` string, required — Name of the background script
  - `script` string, required — The script content to be executed on devices
  - `interpreter` string — Interpreter used to run the script. Currently only 'powershell' is supported.
  - `always_run` boolean, required — Whether the script runs continuously. When true, frequency_in_mins must be null.
  - `frequency_in_mins` integer, nullable — Interval in minutes between script executions. Required when always_run is false, must be null when always_run is true.
  - `timeout_in_mins` integer — Maximum runtime in minutes before the script is terminated. Must be > 0. Defaults to 60 if omitted.
  - `description` string, nullable — Optional description for the background script. Max 300 characters.

## Response `201`

Success

- object
  - `content` BlueprintsBackgroundScriptRead
    - `id` string, uuid, required — Unique identifier for the background script
    - `name` string, required — Name of the background script
    - `interpreter` string, required — Interpreter used to run the script
    - `always_run` boolean, required — Whether the script runs continuously
    - `frequency_in_mins` integer, nullable — Interval in minutes between script executions
    - `timeout_in_mins` integer, required — Maximum runtime in minutes before the script is terminated.
    - `description` string — Description of the background script. Empty string if not set.
    - `created_at` string, date-time, required — When the background script was created
    - `updated_at` string, date-time, required — When the background script was last updated
    - `created_by` integer, required — User ID who created the background script
    - `updated_by` integer, required — User ID who last updated the background script
  - `message` string
  - `code` 201

## Other responses

- `400` — Bad Request
- `409` — Conflict - Background Script name already exists

---

[API](https://skmtc.net/esper/apis/esper-api-reference.md) · [All operations](https://skmtc.net/esper/apis/esper-api-reference/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/esper/esper-api-reference/revisions/e1f64cbb488e/schema)
