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

# Get a Variable

Show details of a specific variable.

For `sensitive: true` variables, their actual `value` is not exposed,
and `null` returned instead.


# 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"
      },
      "VariableDocument": {
        "description": "JSON:API Document.\n\nsee: https://jsonapi.org/format/#document-structure",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/Variable"
          },
          "included": {
            "items": {
              "type": "object"
            },
            "readOnly": true,
            "type": "array"
          },
          "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/{var}": {
      "get": {
        "description": "Show details of a specific variable.\n\nFor `sensitive: true` variables, their actual `value` is not exposed,\nand `null` returned instead.\n",
        "operationId": "get_variable",
        "parameters": [
          {
            "description": "The ID of the variable to show.",
            "example": "ws-t68bpgu1vetpdh8",
            "in": "path",
            "name": "var",
            "required": true,
            "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 value of the fields[resource-type] parameter is a comma-separated list that refers to the name of the fields to be returned for the resource. An empty value indicates that no fields should be returned.",
            "explode": true,
            "in": "query",
            "name": "fields",
            "required": false,
            "schema": {
              "properties": {
                "users": {
                  "description": "The comma-separated list of fields to return in response for User resource.",
                  "type": "string"
                },
                "vars": {
                  "description": "The comma-separated list of fields to return in response for Variable resource.",
                  "type": "string"
                }
              },
              "type": "object"
            },
            "style": "deepObject"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/vnd.api+json": {
                "schema": {
                  "$ref": "#/components/schemas/VariableDocument"
                }
              }
            },
            "description": "Success."
          },
          "404": {
            "description": "Variable not found, or user unauthorized to perform action."
          },
          "4XX": {
            "description": "Client error."
          },
          "5XX": {
            "description": "Server error."
          }
        },
        "summary": "Get a Variable",
        "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

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