Variables
Set a variable
Set a variable.
PUT
/v1/variables/{name}TL;DR
| Question | Answer |
|---|---|
| What does it do? | Set a variable. |
| What does it need? | An API key or an OAuth access token. |
| What does it take? | A JSON body with the fields below, and name in the path. |
| What does it return? | Status 200 with a body of type Variable. |
| In the SDK? | flung.variables.set() |
| As an MCP tool? | set_variable |
| What can go wrong? | 401 Missing, unknown, revoked or expired API key; 422 The request failed validation; 429 Too many requests for this credential; wait for retry-after seconds. Every failure has the same error shape. |
Example
bash
curl -X PUT 'https://api.flung.dev/v1/variables/string' \ --header "Authorization: Bearer $FLUNG_API_KEY" \ --header 'Content-Type: application/json' \ --data '{ "value": "string"}'ts
import { Flung } from '@flung.dev/sdk'
const flung = new Flung({ apiKey: process.env.FLUNG_API_KEY! })const result = await flung.variables.set({ name: 'string', value: 'string',})js
const response = await fetch('https://api.flung.dev/v1/variables/string', { method: 'PUT', headers: { 'Authorization': `Bearer ${process.env.FLUNG_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ value: 'string', }),})if (!response.ok) throw new Error((await response.json()).error.message)const result = await response.json()A successful answer looks like this:
json
{ "name": "string", "value": "string", "updatedAt": "2026-11-01T09:00:00.000Z"}Path parameters
| Field | Type | Required | Description |
|---|---|---|---|
name | string | yes |
Request body
The body has the type an object, with the fields below.
| Field | Type | Required | Description |
|---|---|---|---|
value | string | yes | at most 2000 characters. |
Responses
| Status | Meaning | Body |
|---|---|---|
| 200 | The variable. | Variable |
| 401 | Missing, unknown, revoked or expired API key. | Error |
| 422 | The request failed validation. | Error |
| 429 | Too many requests for this credential; wait for retry-after seconds. | Error |
Response body
A 200 answer has the type Variable.
| Field | Type | Required | Description |
|---|---|---|---|
name | string | yes | |
value | string | yes | |
updatedAt | string | yes |
See also
| Doc | Why |
|---|---|
| API reference | Every endpoint |
| Schemas | Every request and response type |
| Errors | Every error code and what to do about it |
set_variable | The same operation as an MCP tool |