https://backend.api.env0.com, and it authenticates with a remote backend token instead of HTTP Basic authentication.
Prerequisites
- The environment stores its state in the remote backend and has at least one state version.
- A remote backend token. Generate a token from a personal API key, or from an admin or user API key.
- The Read State permission on the environment. A read-only API key keeps it. See custom roles for the permission.
- The environment ID. See Finding the environment ID.
Download the current state
Two requests download the state. The first returns the ID of the current state version. The second downloads that version.1
Export the token
2
Get the current state version ID
id in the response is the state version ID. hosted-state-download-url is the full URL for the next request:attributes object can contain more fields, such as serial.3
Download the state file
application/json.Download state for many environments
To download the current state of several environments, repeat both requests for each environment ID. Get the IDs from List Environments.Endpoints
Both endpoints use theGET method and the base URL https://backend.api.env0.com.
Related pages
- State access control sets which environments can read state during env zero deployments. Requests with an API key use the key’s permissions instead.
- API access covers authentication for the rest of the REST API.