> ## Documentation Index
> Fetch the complete documentation index at: https://enterprise-docs.dify.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Deployed Environments

> Call apps running in deployed environments, with the base URL, authentication, and errors specific to them

In [deployed environments](/en/3.13.x/use/deploy/overview), your app serves its API from a `v2` base URL, authenticated with keys scoped to the app and environment.

## Base URL

All deployed environments share one `v2` base URL: the standard Service API address with `/v2` in place of `/v1`. Find it on any deployed environment's **Backend Service API** card on the app's **Access Point** tab.

## Authentication

Generate an API key on the environment's card on the app's **Access Point** tab and send it as a Bearer token:

```bash theme={null}
curl https://api.example.com/v2/workflows/run \
  -H "Authorization: Bearer $DIFY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"inputs": {}, "response_mode": "blocking", "user": "user-123"}'
```

The base URL is the same for every environment, so the key alone determines which app and environment serve the request: to call `staging`, use a key generated for `staging`.

Generated API keys remain valid even if you undeploy the app from the environment: calls fail while it's undeployed, but once you deploy there again, the same keys still work.

## Supported Endpoints

Deployed environments serve only the following operations. Calling any other path on this base URL returns `404 not_found`.

* For Workflow apps:
  * [Run Workflow](/en/3.13.x/develop/api/deployed-environments/run-workflow)
  * [Stop Workflow Task](/en/3.13.x/develop/api/deployed-environments/stop-workflow-task)

* For Chatflow apps:
  * [Send Chat Message](/en/3.13.x/develop/api/deployed-environments/send-chat-message)
  * [Stop Chat Message Generation](/en/3.13.x/develop/api/deployed-environments/stop-chat-message-generation)
  * [List Conversations](/en/3.13.x/develop/api/deployed-environments/list-conversations)
  * [Delete Conversation](/en/3.13.x/develop/api/deployed-environments/delete-conversation)
  * [Rename Conversation](/en/3.13.x/develop/api/deployed-environments/rename-conversation)
  * [List Conversation Messages](/en/3.13.x/develop/api/deployed-environments/list-conversation-messages)
  * [List Conversation Variables](/en/3.13.x/develop/api/deployed-environments/list-conversation-variables)
  * [Update Conversation Variable](/en/3.13.x/develop/api/deployed-environments/update-conversation-variable)

* For both app types:
  * [Upload File](/en/3.13.x/develop/api/deployed-environments/upload-file)
  * [Download File](/en/3.13.x/develop/api/deployed-environments/download-file)

## Errors

Example HTTP error response:

```json theme={null}
{
  "code": "deployment_not_ready",
  "message": "deployment is in progress",
  "status": 503
}
```

Once a streaming response has started, errors arrive as `error` events in the stream instead. See the corresponding endpoint reference for their format.

Each operation's reference page lists its exact error codes. Across the group, three cases recur:

* Run and upload operations (workflow run and stop, chat send and stop, file upload) reject bad credentials and unavailable deployments with:

  | Error code | Status | Meaning |
  | :- | :- | :- |
  | `token_invalid` | 401 | The API key is missing, malformed, or unknown. |
  | `unauthorized` | 401 | The API key has been revoked. |
  | `forbidden` | 403 | API access is turned off for this environment in **Access Point**. |
  | `deployment_undeployed` | 503 | The app is undeployed from this environment. Deploy a version to resume serving. |
  | `deployment_not_ready` | 503 | A deployment is in progress. Retry shortly. |
  | `apprunner_not_deployed` | 503 | The environment is unavailable, for example because it's being deleted, isn't running, or can't be reached. Ask your platform administrator to check the environment. |
  | `service_not_ready` | 503 | The deployed version isn't ready to serve in this environment yet, for example while it's loading or being replaced. Retry shortly. |
  | `enterprise_unavailable` | 503 | A platform-side routing service is temporarily unavailable. Retry shortly. |

* Conversation management and file download return:

  * `401 unauthorized` for any invalid key.
  * `400 app_unavailable` whenever the app's API access is off or the app isn't deployed and available in this environment.

* A workflow run or chat request that exceeds the environment's maximum execution time (20 minutes by default) stops with `request_timeout`: HTTP 504 in blocking mode, or an `error` event with `status: 504` in a stream.

  See `enterprise.workflowMaxExecutionTimeSeconds` in [Deployed Environments (App Runner)](/en/3.13.x/deploy/advanced-configuration/environment-variables#app-runner) for the setting behind this limit.
