# Create a script module

Source: https://www.jawsdeploy.net/rest-api/script-modules-create | Section: Script Modules

Add a new script module to a workspace.

`POST /api/script-module`

Creates a script module containing PowerShell (or other supported) functions that projects can import into steps.

## Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `workspaceId` | body | string | yes | ID of the workspace. |
| `name` | body | string | yes | Module name. |
| `description` | body | string | no | Optional description. |
| `script` | body | string | yes | Module script body. |
| `scriptLanguage` | body | string | no | `powershell` (default), etc. |

## Errors

| Status | Meaning |
|---|---|
| 400 | Invalid `workspaceId` or validation failure. |
| 401 | Missing or invalid Basic auth credentials, or the service account lacks the required role. |

Example request:

```
POST /api/script-module

{ "workspaceId": "ws_abc", "name": "AuthHelpers", "script": "function Get-Token { ... }" }
```

Example response:

```
{ "scriptModuleId": "sm_1" }
```

