2017-03-21 22:24:29 +01:00
---
2017-03-21 22:50:17 +01:00
layout: "api"
page_title: "State API"
sidebar_current: "docs-enterprise-api-states"
description: |-
State represents the status of your infrastructure at the last time Terraform was run.
2017-03-21 22:24:29 +01:00
---
# State API
2017-03-21 22:50:17 +01:00
State represents the status of your infrastructure at the last time Terraform was run. States can be pushed to Terraform Enterprise from Terraform's CLI after an apply is done locally, or state is automatically stored if the apply is done in Terraform Enterprise.
2017-03-21 22:24:29 +01:00
### State Attributes
2017-03-23 00:23:08 +01:00
< table class = "apidocs" >
2017-03-21 22:24:29 +01:00
< tr >
< th > Attribute< / th >
< th > Description< / th >
< th > Required< / th >
< / tr >
< tr >
< td > < code > username< / code > < / td >
< td > If supplied, only return states belonging to the organization with this username.< / td >
< td > No< / td >
< / tr >
< / table >
### Actions
2017-03-23 19:03:36 +01:00
The following actions can be performed on this resource.
2017-03-21 22:24:29 +01:00
< dl >
< dt > Get a list of states accessible to a user< / dt >
< dd > GET /api/v1/terraform/state< / dd >
< / dl >
### Examples
#### Getting a list of Terraform states
$ curl %{ATLAS_URL}/api/v1/terraform/state \
-H "X-Atlas-Token: $ATLAS_TOKEN"
#### Getting a list of Terraform states for an organization
$ curl %{ATLAS_URL}/api/v1/terraform/state?username=acme_inc \
-H "X-Atlas-Token: $ATLAS_TOKEN"
#### Getting second page of list of Terraform states
$ curl %{ATLAS_URL}/api/v1/terraform/state?page=2 \
-H "X-Atlas-Token: $ATLAS_TOKEN"