> For the complete documentation index, see [llms.txt](https://docs.stackai.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stackai.com/technical-reference/releases-and-environments/which-version-and-environment-a-run-uses.md).

# Which Version and Environment a Run Uses

The same project can run different saved versions or environments. Confirm both selections when comparing results across the builder, a published interface, and an API client.

![Match the input contract to the selected version](https://1957915746-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSQ1Sgy933krTyK0S4JpP%2Fuploads%2FCndjVOQXnJAPIGHrCPrS%2Fwhich-version-and-environment-a-run-uses.png?alt=media)

Replace 3 with the intended saved version and use its actual input schema. Authenticate against the correct deployment. Omitting project\_version runs the published version; -1 explicitly selects the draft.

<details>

<summary>Copy the example</summary>

```http
# Inspect the input contract for a saved version.
GET /v2/projects/{project_id}/io-schema?version=3

# Run that same saved version on the same deployment.
POST /v2/runs
Content-Type: application/json

{
  "project_id": "<project-id>",
  "project_version": 3,
  "input": {"<input-node-id>": "<input-value>"}
}
```

</details>

## Before you begin

The version and environment settings for the execution path you use.

## Key concepts

| Term              | Definition                                                                                                                                                 |
| ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| API version       | The request and response contract selected by an API route. It is separate from the saved workflow version you ask the API to run.                         |
| Published release | The selected project version made available through a published execution path. Confirm the active release after a publication or promotion action.        |
| Draft             | The editable project configuration before or apart from a selected published release. Saving a draft does not necessarily change what published users run. |

## Configuration options

| Option          | Purpose                                                                   | Behavior                                                                          |
| --------------- | ------------------------------------------------------------------------- | --------------------------------------------------------------------------------- |
| Project version | A specific saved configuration of a project.                              | Select it explicitly when a result must be reproducible.                          |
| Environment     | A named configuration context for variables, secrets, and deployment use. | Different environments can reach different services or use different credentials. |

## Select the version and environment for a run

1. Identify whether the request uses editable, published, or explicitly selected content.
2. Select the intended version and environment through the supported control or request field.
3. Inspect the resulting run and record its selection with the result.

You can reproduce the run using the intended configuration.

## Behavior and limitations

Version selector values are not interchangeable across API versions. On v2 runs, project\_version -1 selects editable content; on legacy inference, -1 selects the latest published version. Use the endpoint’s contract. A version number and an environment name describe different choices.

| Selection         | What to confirm                                                       |
| ----------------- | --------------------------------------------------------------------- |
| Editable workflow | The changes currently saved in the builder.                           |
| Published release | The version currently available through the published execution path. |
| Saved version     | The explicit historical version selected by the caller.               |
| Environment       | The variables, secrets, and access settings used for the run.         |

Record both version and environment when investigating differences. Changing one does not necessarily change the other.

## Related resources

[Saved Changes, Versions, and Published Releases](https://docs.stackai.com/technical-reference/releases-and-environments/saved-changes-versions-and-published-releases.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.stackai.com/technical-reference/releases-and-environments/which-version-and-environment-a-run-uses.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
