> ## Documentation Index
> Fetch the complete documentation index at: https://docs.b3os.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Create or update workflow variable definition

` PUT /v1/workflows/{workflowId}/variables/{name} `

Create or update workflow variable definition

## Parameters

### ` workflowId ` (path, required)

Workflow ID

- ` value `: type ` string `

### ` name ` (path, required)

Variable name

- ` value `: type ` string `

## Request body (required)

Content type: ` application/json `

Variable definition

- ` value `: type ` unknown `

  - ` oneOf alternative 1 `: type ` object `

  - ` oneOf alternative 2 `: type ` object `

    - Required fields: ` lifetime `, ` type `

    - ` default `: type ` unknown `

    - ` description `: type ` string `

    - ` lifetime `: type ` string `

      - enum: ` ["persist","reset"] `

    - ` name `: type ` string `

    - ` type `: type ` string `

      - enum: ` ["number","text","boolean","list","object"] `

## Responses

### ` 200 ` — OK

Content type: ` application/json `

- ` value `: type ` object `

  - ` default `: type ` unknown `

  - ` description `: type ` string `

  - ` lifetime `: type ` string `

    - enum: ` ["persist","reset"] `

  - ` name `: type ` string `

  - ` type `: type ` string `

    - enum: ` ["number","text","boolean","list","object"] `

## Request examples

### cURL

```curl
curl -X PUT 'https://api.example.com/v1/workflows/string/variables/string' \
  -H 'Authorization: Bearer YOUR_API_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{}'
```

### JavaScript

```javascript
const response = await fetch('https://api.example.com/v1/workflows/string/variables/string', {
  method: 'PUT',
  headers: {
      "Authorization": "Bearer YOUR_API_TOKEN",
      "Content-Type": "application/json"
  },
  body: JSON.stringify({})
});

const data = await response.json();
console.log(data);
```

### Python

```python
import requests

headers = {
    'Authorization': 'Bearer YOUR_API_TOKEN'
}

response = requests.put('https://api.example.com/v1/workflows/string/variables/string', headers=headers, json={})
print(response.json())
```

### Go

```go
package main

import (
	"fmt"
	"io"
	"net/http"
	"strings"
)

func main() {
	body := strings.NewReader(`{}`)
	req, _ := http.NewRequest("PUT", "https://api.example.com/v1/workflows/string/variables/string", body)
	req.Header.Set("Authorization", "Bearer YOUR_API_TOKEN")
	req.Header.Set("Content-Type", "application/json")

	resp, _ := http.DefaultClient.Do(req)
	defer resp.Body.Close()
	result, _ := io.ReadAll(resp.Body)
	fmt.Println(string(result))
}
```