# Create a project variable

Source: https://www.jawsdeploy.net/rest-api/project-variable-create | Section: Project Variables

Create a project-scoped variable.

`POST /api/project/variable`

Creates a variable that lives only on this project. Use `variableType = Text` for plain text and `Secret` for secrets.

## Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `projectId` | body | string | yes | ID of the project. |
| `name` | body | string | yes | Variable name. |
| `description` | body | string | no | Optional description. |
| `variableType` | body | string | no | See below. |

### Variable types

`variableType` accepts `Text`, `Secret`, `Script`, `Number`, `Boolean`, `Date`, `Map`, and `Json`. `Text` is used when the field is omitted.

## Errors

| Status | Meaning |
|---|---|
| 400 | Invalid `projectId`, invalid `variableType`, or validation failure. |
| 401 | Missing or invalid Basic auth credentials, or the service account lacks the required role. |

Example request:

```
POST /api/project/variable

{ "projectId": "prj_abc123", "name": "FeatureFlag.Beta", "variableType": "Text" }
```

Example response:

```
{ "variableId": "v_xyz" }
```

