---
title: "Create Script"
method: POST
path: "/operation/automation/scripts/{tenant_id}"
tags: ["Automation"]
---

# Create Script

`POST /operation/automation/scripts/{tenant_id}`

Creates a new script under the tenant. However the script will be accessible based on its scope. Global Scripts - All user will have access to Corestack's Marketplace Scripts (Can view and execute). Account - All users under that account will have access (Can view and execute). Only Account admins can update/delete. Tenant - Users with access to the specific tenant will have access scripts (Can view and execute). Tenant admins can update/delete. Private - User who created will only have access.

## Path parameters

- `tenant_id` string, required

## Request body

- CreateScriptRequest
  - `name` string, required — Name of the script and it should be unique.
  - `uri` string — Unique URI for script - eg: script/ansi/linux/lamp_install. If not provided, corestack will generate it automatically
  - `description` string — Detailed description about script
  - `category` string[], required — Script Category
  - `platform` string[], required — Platforms supported by script.
  - `operating_system` string[], required — OS supported by script
  - `config_type` 'ansible', required — Config type of the script. Create is supported for ansible type scripts alone for now
  - `scope` 'private' | 'account' | 'tenant', required — The scope of the script: Account scope - All users under that account will have access to view and execute Only Account admins can update/delete the scripts, Tenant Scope - Users with access to the specific tenant will have access to scripts who can describe or execute scripts. Tenant admins can only update/delete. Private Scope - User who created will only have access
  - `script_info` ScriptInfo[], required — script info
    - `name` string, required — Script Name as available in the path
    - `path_type` 'file' | 'git' | 'local' | 'repository' | 'url', required — Path type for script
    - `content` string — File content, if path type is specified as file
    - `path` string, required — Path of the script. ExamplesFor git path_type: https://github.com/ansible/test-playbooks.git,For url path_type: https://s3.amazonaws.com/ansible/test-playbooks.tar,For galaxy: https://galaxy.ansible.com/community/zabbix.
  - `dependencies` ScriptInfo[] — Details of the dependent scripts if any. For eg., A LAMP script will have apache, mysql, php as dependent scripts.This can be skipped if there are no dependent scripts or if the actual script takes care of installing all dependencies
    - `name` string, required — Script Name as available in the path
    - `path_type` 'file' | 'git' | 'local' | 'repository' | 'url', required — Path type for script
    - `content` string — File content, if path type is specified as file
    - `path` string, required — Path of the script. ExamplesFor git path_type: https://github.com/ansible/test-playbooks.git,For url path_type: https://s3.amazonaws.com/ansible/test-playbooks.tar,For galaxy: https://galaxy.ansible.com/community/zabbix.
  - `minimum_requirement` ScriptMinimumRequirements
    - `ram(MB)` number — Minimum RAM required(in MB) to install the script.
    - `cpu` integer — Minimum CPU core required(in MB) to install the script.
    - `disk(MB)` number — Minimum disk space required(in MB) to install the script.
  - `playbook_yaml` string — Playbook yaml path - mandatory for ansible scripts

## Response `201`

Created

- CreateScriptResponse
  - `script_id` string — Unique ID of the script

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `500` — Internal Server Error

---

[API](https://skmtc.dev/corestack/apis/corestack-external-api.md) · [All operations](https://skmtc.dev/corestack/apis/corestack-external-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/corestack/corestack-external-api/revisions/bf2cdf20826d/schema)
