Skip to content
  • Auto
  • Light
  • Dark
Get Started
View as Markdown
Copy Markdown

Open in Claude
Open in ChatGPT

Create

client.vals.environmentVariables.create(stringvalID, EnvironmentVariableCreateParams { key, value, description } body, RequestOptionsoptions?): EnvironmentVariableCreateResponse { createdAt, description, key, updatedAt }
post/v2/vals/{val_id}/environment_variables

Create a new environment variable scoped to this project.

ParametersExpand Collapse
valID: string
body: EnvironmentVariableCreateParams { key, value, description }
key: string

Name or key of the environment variable, accessible via Deno.env or process.env

maxLength8192
value: string

Value of the environment variable.

maxLength8192
description?: string

Optional description of the environment variable

maxLength1024
ReturnsExpand Collapse
EnvironmentVariableCreateResponse { createdAt, description, key, updatedAt }

An environment variable

createdAt: string
description: string | null

Optional description of the environment variable

maxLength1024
key: string

Name or key of the environment variable, accessible via Deno.env or process.env

maxLength8192
updatedAt: string
import ValTown from "npm:@valtown/sdk";

const client = new ValTown();

const environmentVariable = await client.vals.environmentVariables.create(
  '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
  { key: 'key', value: 'value' },
);

console.log(environmentVariable.createdAt);
{
  "createdAt": "2019-12-27T18:11:19.117Z",
  "description": "description",
  "key": "key",
  "updatedAt": "2019-12-27T18:11:19.117Z"
}
Returns Examples
{
  "createdAt": "2019-12-27T18:11:19.117Z",
  "description": "description",
  "key": "key",
  "updatedAt": "2019-12-27T18:11:19.117Z"
}