---
updatedAt: 2026-05-28T08:16:45.000Z
agentTools:
  projectIndex: https://docs.scalr.io/llms.txt
---

# List Variables

This endpoint returns a list of variables.

Cloud Credentials are exposed as Terraform ENV Variables if filters are specified.


# OpenAPI definition

```json
{
  "components": {
    "schemas": {
      "Variable": {
        "description": "A Variable describes the configuration and value of a variable in a workspace.\n\nIn Scalr there are \"terraform\" and \"environment\" variables.\n\n* Terraform variables define values to be passed into the corresponding Terraform input variable\n  that is defined in the Configuration Version to be used in a run. Scalr Terraform variables\n  are added to the `terraform.tfvars.json` file in the working directory of the workspace prior to any run.\n  The values passed in can be HCL structures if the `hcl` attribute is `true`.\n* Environment variables define shell variables that are added to the run time environment of a workspace\n  using `export VAR=value`. These variables can pass authentication parameters to providers\n  or any data required for local processing, such as via `local-exec` provisioners.",
        "properties": {
          "attributes": {
            "properties": {
              "category": {
                "description": "* `terraform` - Values to be passed to terraform input variables of the same name.\n* `env` - shell environment variables. They will be injected via `export` during a terraform run.",
                "enum": [
                  "terraform",
                  "shell",
                  "env"
                ],
                "type": "string"
              },
              "description": {
                "description": "Variable description.",
                "maxLength": 512,
                "nullable": true,
                "type": "string"
              },
              "final": {
                "default": false,
                "description": "Indicates whether the variable can be overridden on a lower down the Scalr organizational model.",
                "type": "boolean"
              },
              "hcl": {
                "default": false,
                "description": "Indicates whether the value of the variable is a string of HCL code.\nNot applicable to `env` category variables.",
                "type": "boolean"
              },
              "key": {
                "description": "Variable name. Must correspond to the name of a Terraform input variable in the configuration\nif category is terraform.",
                "maxLength": 128,
                "type": "string"
              },
              "sensitive": {
                "default": false,
                "description": "Indicates whether the value is sensitive. When set to `true` then the variable is not visible\nafter being written.",
                "type": "boolean"
              },
              "updated-at": {
                "description": "The variable last update timestamp.",
                "format": "date-time",
                "nullable": true,
                "readOnly": true,
                "type": "string"
              },
              "updated-by-email": {
                "description": "The email of the last user who updated this variable.",
                "nullable": true,
                "readOnly": true,
                "type": "string"
              },
              "value": {
                "default": "",
                "description": "Variable value. Not visible if sensitive: true is enabled",
                "maxLength": 65535,
                "nullable": true,
                "type": "string"
              }
            },
            "required": [
              "category",
              "key"
            ],
            "type": "object"
          },
          "id": {
            "readOnly": true,
            "type": "string"
          },
          "links": {
            "properties": {
              "self": {
                "readOnly": true,
                "type": "string"
              }
            },
            "readOnly": true,
            "type": "object"
          },
          "relationships": {
            "properties": {
              "account": {
                "description": "The account this variable belongs to",
                "properties": {
                  "data": {
                    "nullable": true,
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "type": {
                        "enum": [
                          "accounts",
                          ""
                        ],
                        "type": "string"
                      }
                    },
                    "required": [
                      "type",
                      "id"
                    ],
                    "type": "object"
                  }
                },
                "readOnly": true,
                "required": [
                  "data"
                ],
                "type": "object"
              },
              "environment": {
                "description": "The environment this variable belongs to",
                "properties": {
                  "data": {
                    "nullable": true,
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "type": {
                        "enum": [
                          "environments",
                          ""
                        ],
                        "type": "string"
                      }
                    },
                    "required": [
                      "type",
                      "id"
                    ],
                    "type": "object"
                  }
                },
                "required": [
                  "data"
                ],
                "type": "object"
              },
              "updated-by": {
                "description": "The user who updated this variable last time.",
                "properties": {
                  "data": {
                    "nullable": true,
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "type": {
                        "enum": [
                          "users",
                          ""
                        ],
                        "type": "string"
                      }
                    },
                    "required": [
                      "type",
                      "id"
                    ],
                    "type": "object"
                  }
                },
                "readOnly": true,
                "required": [
                  "data"
                ],
                "type": "object"
              },
              "workspace": {
                "description": "The workspace this variable belongs to.",
                "properties": {
                  "data": {
                    "nullable": true,
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "type": {
                        "enum": [
                          "workspaces",
                          ""
                        ],
                        "type": "string"
                      }
                    },
                    "required": [
                      "type",
                      "id"
                    ],
                    "type": "object"
                  }
                },
                "required": [
                  "data"
                ],
                "type": "object"
              }
            },
            "type": "object"
          },
          "type": {
            "enum": [
              "vars"
            ],
            "type": "string"
          }
        },
        "required": [
          "type",
          "attributes"
        ],
        "type": "object"
      },
      "VariableListingDocument": {
        "description": "JSON:API Document Listing\n\nsee: https://jsonapi.org/format/#document-structure",
        "properties": {
          "data": {
            "items": {
              "$ref": "#/components/schemas/Variable"
            },
            "type": "array"
          },
          "included": {
            "items": {
              "type": "object"
            },
            "readOnly": true,
            "type": "array"
          },
          "links": {
            "additionalProperties": {
              "type": "string"
            },
            "readOnly": true,
            "type": "object"
          },
          "meta": {
            "readOnly": true,
            "type": "object"
          }
        },
        "type": "object"
      }
    },
    "securitySchemes": {
      "API-Key": {
        "scheme": "bearer",
        "type": "http"
      }
    }
  },
  "info": {
    "description": "Scalr IACP API",
    "license": {
      "name": "Apache 2.0",
      "url": "https://www.apache.org/licenses/LICENSE-2.0"
    },
    "title": "Scalr IACP API",
    "version": "unversioned"
  },
  "openapi": "3.0.0",
  "paths": {
    "/vars": {
      "get": {
        "description": "This endpoint returns a list of variables.\n\nCloud Credentials are exposed as Terraform ENV Variables if filters are specified.\n",
        "operationId": "get_variables",
        "parameters": [
          {
            "description": "The ID of the environment to list variables for.",
            "in": "query",
            "name": "filter[environment]",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "The ID of the workspace to list variables for.",
            "in": "query",
            "name": "filter[workspace]",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "The variable category.",
            "in": "query",
            "name": "filter[category]",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "The variable key.",
            "in": "query",
            "name": "filter[key]",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "The ID(s) of variable(s).",
            "in": "query",
            "name": "filter[var]",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Page number",
            "in": "query",
            "name": "page[number]",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Page size",
            "in": "query",
            "name": "page[size]",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "The comma-separated list of relationship paths.",
            "explode": false,
            "in": "query",
            "name": "include",
            "required": false,
            "schema": {
              "items": {
                "enum": [
                  "updated-by"
                ],
                "type": "string"
              },
              "type": "array"
            }
          },
          {
            "description": "The comma-separated list of attributes.",
            "explode": false,
            "in": "query",
            "name": "sort",
            "required": false,
            "schema": {
              "items": {
                "enum": [
                  "category",
                  "key",
                  "updated-at"
                ],
                "type": "string"
              },
              "type": "array"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/vnd.api+json": {
                "examples": {
                  "default": {
                    "value": "{\n  \"data\": [\n    {\n      \"attributes\": {\n        \"category\": \"terraform\",\n        \"description\": \"The number of worker nodes in the Kubernetes cluster\",\n        \"final\": false,\n        \"hcl\": false,\n        \"key\": \"cluster_size\",\n        \"sensitive\": false,\n        \"value\": \"5\"\n      },\n      \"id\": \"var-t68dqo5sbje779g\",\n      \"links\": {\n        \"self\": \"https://my.scalr.io/api/iacp/v3/vars/var-t68dqo5sbje779g\"\n      },\n      \"relationships\": {\n        \"account\": {\n          \"data\": {\n            \"id\": \"acc-t2fcrq6h1v3nf0g\",\n            \"type\": \"accounts\"\n          }\n        },\n        \"environment\": {\n          \"data\": {\n            \"id\": \"env-sfuari395m7sck1\",\n            \"type\": \"environments\"\n          }\n        },\n        \"workspace\": {\n          \"data\": {\n            \"id\": \"ws-t68bpgu1vetpdh8\",\n            \"type\": \"workspaces\"\n          }\n        }\n      },\n      \"type\": \"vars\"\n    },\n    {\n      \"attributes\": {\n        \"category\": \"env\",\n        \"description\": null,\n        \"final\": false,\n        \"hcl\": false,\n        \"key\": \"AWS_ACCESS_KEY_ID\",\n        \"sensitive\": true,\n        \"value\": null\n      },\n      \"id\": \"var-scalr-aws-access-key-id\",\n      \"links\": {\n        \"self\": \"https://my.scalr.io/api/iacp/v3/vars/var-scalr-aws-access-key-id\"\n      },\n      \"relationships\": {\n        \"account\": null,\n        \"environment\": {\n          \"data\": {\n            \"id\": \"env-sfuari395m7sck1\",\n            \"type\": \"environments\"\n          }\n        },\n        \"workspace\": null\n      },\n      \"type\": \"vars\"\n    },\n    {\n      \"attributes\": {\n        \"category\": \"env\",\n        \"description\": null,\n        \"final\": false,\n        \"hcl\": false,\n        \"key\": \"AWS_SECRET_ACCESS_KEY\",\n        \"sensitive\": true,\n        \"value\": null\n      },\n      \"id\": \"var-scalr-aws-secret-access-key\",\n      \"links\": {\n        \"self\": \"https://my.scalr.io/api/iacp/v3/vars/var-scalr-aws-secret-access-key\"\n      },\n      \"relationships\": {\n        \"account\": null,\n        \"environment\": {\n          \"data\": {\n            \"id\": \"env-sfuari395m7sck1\",\n            \"type\": \"environments\"\n          }\n        },\n        \"workspace\": null\n      },\n      \"type\": \"vars\"\n    },\n    {\n      \"attributes\": {\n        \"category\": \"env\",\n        \"description\": null,\n        \"final\": false,\n        \"hcl\": false,\n        \"key\": \"GOOGLE_PROJECT\",\n        \"sensitive\": true,\n        \"value\": null\n      },\n      \"id\": \"var-scalr-google-project\",\n      \"links\": {\n        \"self\": \"https://my.scalr.io/api/iacp/v3/vars/var-scalr-google-project\"\n      },\n      \"relationships\": {\n        \"account\": null,\n        \"environment\": {\n          \"data\": {\n            \"id\": \"env-sfuari395m7sck1\",\n            \"type\": \"environments\"\n          }\n        },\n        \"workspace\": null\n      },\n      \"type\": \"vars\"\n    },\n    {\n      \"attributes\": {\n        \"category\": \"env\",\n        \"description\": null,\n        \"final\": false,\n        \"hcl\": false,\n        \"key\": \"GOOGLE_CREDENTIALS\",\n        \"sensitive\": true,\n        \"value\": null\n      },\n      \"id\": \"var-scalr-google-credentials\",\n      \"links\": {\n        \"self\": \"https://my.scalr.io/api/iacp/v3/vars/var-scalr-google-credentials\"\n      },\n      \"relationships\": {\n        \"account\": null,\n        \"environment\": {\n          \"data\": {\n            \"id\": \"env-sfuari395m7sck1\",\n            \"type\": \"environments\"\n          }\n        },\n        \"workspace\": null\n      },\n      \"type\": \"vars\"\n    }\n  ],\n  \"included\": null,\n  \"links\": {\n    \"first\": \"https://my.scalr.io/api/iacp/v3/vars?filter%5Bworkspace%5D=ws-t68bpgu1vetpdh8?page%5Bnumber%5D=1&page%5Bsize%5D=20\",\n    \"last\": \"https://my.scalr.io/api/iacp/v3/vars?filter%5Bworkspace%5D=ws-t68bpgu1vetpdh8?page%5Bnumber%5D=1&page%5Bsize%5D=20\",\n    \"next\": null,\n    \"prev\": null,\n    \"self\": \"https://my.scalr.io/api/iacp/v3/vars?filter%5Bworkspace%5D=ws-t68bpgu1vetpdh8?page%5Bnumber%5D=1&page%5Bsize%5D=20\"\n  },\n  \"meta\": {\n    \"pagination\": {\n      \"current-page\": 1,\n      \"next-page\": null,\n      \"prev-page\": null,\n      \"total-count\": 5,\n      \"total-pages\": 1\n    }\n  }\n}"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/VariableListingDocument"
                }
              }
            },
            "description": "Success."
          },
          "404": {
            "description": "Workspace filter not found, or user unauthorized to perform action."
          },
          "4XX": {
            "description": "Client error."
          },
          "5XX": {
            "description": "Server error."
          }
        },
        "summary": "List Variables",
        "tags": [
          "variables"
        ],
        "x-mcp-tool": true,
        "x-resource": "Variable",
        "x-service": "tf-api"
      }
    }
  },
  "security": [
    {
      "API-Key": []
    }
  ],
  "servers": [
    {
      "url": "https://{Domain}/api/iacp/v3",
      "variables": {
        "Domain": {
          "default": "example.scalr.io",
          "description": "Domain where Scalr is hosted"
        }
      }
    }
  ]
}
```

# Sibling pages

* [Create a Variable](https://docs.scalr.io/scalr/reference/create_variable.md)
* [Delete a Variable](https://docs.scalr.io/scalr/reference/delete_variable.md)
* [Get a Variable](https://docs.scalr.io/scalr/reference/get_variable.md)
* [Update a Variable](https://docs.scalr.io/scalr/reference/update_variable.md)