- list - List all variables
- create - Create a variable
- retrieve - Get environment variable
- update - Update a variable
- delete - Delete environment variable
- usage - Retrieve a variable usage
Returns all environment variables for the current organization. Secret values are masked.
from novu_py import Novu
with Novu(
secret_key="YOUR_SECRET_KEY_HERE",
) as novu:
res = novu.environment_variables.list()
# Handle response
print(res)| Parameter | Type | Required | Description |
|---|---|---|---|
search |
Optional[str] | ➖ | Filter variables by key (case-insensitive partial match) |
idempotency_key |
Optional[str] | ➖ | A header for idempotency purposes |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.EnvironmentVariablesControllerListEnvironmentVariablesResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| models.ErrorDto | 414 | application/json |
| models.ErrorDto | 400, 401, 403, 404, 405, 409, 413, 415 | application/json |
| models.ValidationErrorDto | 422 | application/json |
| models.ErrorDto | 500 | application/json |
| models.APIError | 4XX, 5XX | */* |
Creates a new environment variable. Keys must be uppercase with underscores only (e.g. BASE_URL). Secret variables are encrypted at rest and masked in API responses.
from novu_py import Novu
with Novu(
secret_key="YOUR_SECRET_KEY_HERE",
) as novu:
res = novu.environment_variables.create(create_environment_variable_request_dto={
"key": "<key>",
})
# Handle response
print(res)| Parameter | Type | Required | Description |
|---|---|---|---|
create_environment_variable_request_dto |
models.CreateEnvironmentVariableRequestDto | ✔️ | N/A |
idempotency_key |
Optional[str] | ➖ | A header for idempotency purposes |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.EnvironmentVariablesControllerCreateEnvironmentVariableResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| models.ErrorDto | 414 | application/json |
| models.ErrorDto | 400, 401, 403, 404, 405, 413, 415 | application/json |
| models.ValidationErrorDto | 422 | application/json |
| models.ErrorDto | 500 | application/json |
| models.APIError | 4XX, 5XX | */* |
Returns a single environment variable by key. Secret values are masked.
from novu_py import Novu
with Novu(
secret_key="YOUR_SECRET_KEY_HERE",
) as novu:
res = novu.environment_variables.retrieve(variable_key="BASE_URL")
# Handle response
print(res)| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
variable_key |
str | ✔️ | The unique key of the environment variable (e.g. BASE_URL) | BASE_URL |
idempotency_key |
Optional[str] | ➖ | A header for idempotency purposes | |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.EnvironmentVariablesControllerGetEnvironmentVariableResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| models.ErrorDto | 414 | application/json |
| models.ErrorDto | 400, 401, 403, 405, 409, 413, 415 | application/json |
| models.ValidationErrorDto | 422 | application/json |
| models.ErrorDto | 500 | application/json |
| models.APIError | 4XX, 5XX | */* |
Updates an existing environment variable. Providing values merges them into the existing per-environment values by _environmentId; envs not present in the request keep their stored value. Submitting the masked secret placeholder (the value returned by read endpoints for secret variables) as a real value is rejected.
from novu_py import Novu
with Novu(
secret_key="YOUR_SECRET_KEY_HERE",
) as novu:
res = novu.environment_variables.update(variable_key="BASE_URL", update_environment_variable_request_dto={})
# Handle response
print(res)| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
variable_key |
str | ✔️ | The unique key of the environment variable (e.g. BASE_URL) | BASE_URL |
update_environment_variable_request_dto |
models.UpdateEnvironmentVariableRequestDto | ✔️ | N/A | |
idempotency_key |
Optional[str] | ➖ | A header for idempotency purposes | |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.EnvironmentVariablesControllerUpdateEnvironmentVariableResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| models.ErrorDto | 414 | application/json |
| models.ErrorDto | 400, 401, 403, 405, 409, 413, 415 | application/json |
| models.ValidationErrorDto | 422 | application/json |
| models.ErrorDto | 500 | application/json |
| models.APIError | 4XX, 5XX | */* |
Deletes an environment variable by key.
from novu_py import Novu
with Novu(
secret_key="YOUR_SECRET_KEY_HERE",
) as novu:
res = novu.environment_variables.delete(variable_key="BASE_URL")
# Handle response
print(res)| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
variable_key |
str | ✔️ | The unique key of the environment variable (e.g. BASE_URL) | BASE_URL |
idempotency_key |
Optional[str] | ➖ | A header for idempotency purposes | |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.EnvironmentVariablesControllerDeleteEnvironmentVariableResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| models.ErrorDto | 414 | application/json |
| models.ErrorDto | 400, 401, 403, 405, 409, 413, 415 | application/json |
| models.ValidationErrorDto | 422 | application/json |
| models.ErrorDto | 500 | application/json |
| models.APIError | 4XX, 5XX | */* |
Returns the workflows that reference this environment variable via {{env.KEY}} in their step controls. variableId is required.
from novu_py import Novu
with Novu(
secret_key="YOUR_SECRET_KEY_HERE",
) as novu:
res = novu.environment_variables.usage(variable_key="BASE_URL")
# Handle response
print(res)| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
variable_key |
str | ✔️ | The unique key of the environment variable (e.g. BASE_URL) | BASE_URL |
idempotency_key |
Optional[str] | ➖ | A header for idempotency purposes | |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.EnvironmentVariablesControllerGetEnvironmentVariableUsageResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| models.ErrorDto | 414 | application/json |
| models.ErrorDto | 400, 401, 403, 405, 409, 413, 415 | application/json |
| models.ValidationErrorDto | 422 | application/json |
| models.ErrorDto | 500 | application/json |
| models.APIError | 4XX, 5XX | */* |