# Create an app deployment

Launch stage: GA

`POST /api/2.0/apps/{app_name}/deployments`

Creates an app deployment for the app with the supplied name.

API scopes: apps

## Path parameters

- `app_name` (string, required)
  The name of the app.

## Request body

The app deployment configuration.
- `deployment_id` (string, optional)
  The unique id of the deployment.
  Example: `01ef0bda89f21f08a8351f41e4a9b948`
- `source_code_path` (string, optional)
  The workspace file system path of the source code used to create the app deployment. This is different from
   `deployment_artifacts.source_code_path`, which is the path used by the deployed app. The former refers
   to the original source code location of the app in the workspace during deployment creation, whereas
   the latter provides a system generated stable snapshotted source code path used by the deployment.
  Example: `/Workspace/user@test.com/my_custom_app`
- `git_source` (object, optional)
  Git repository to use as the source for the app deployment.
  - `branch` (string, optional)
    Git branch to checkout.
    Example: `main`
    Constraints: `<= 255 characters`
  - `tag` (string, optional)
    Git tag to checkout.
    Example: `v1.0.0`
    Constraints: `<= 255 characters`
  - `commit` (string, optional)
    Git commit SHA to checkout.
    Example: `abc123def456`
    Constraints: `<= 64 characters`
  - `source_code_path` (string, optional)
    Relative path to the app source code within the Git repository. If not specified, the root
     of the repository is used.
    Example: `my-app`
    Constraints: `<= 500 characters`
- `mode` (string, optional)
  The mode of which the deployment will manage the source code.
  Possible values:
  - `SNAPSHOT`
  - `AUTO_SYNC`
- `command` (array of string, optional)
  The command with which to run the app. This will override the command specified in the app.yaml file.
  Example: `python app.py`
- `env_vars` (array of object, optional)
  The environment variables to set in the app runtime environment. This will override the environment variables specified in the app.yaml file.
  - `name` (string, optional)
    The name of the environment variable.
    Example: `VOLUME_URI`
  - `value` (string, optional)
    The value for the environment variable.
    Example: `/Volumes/catalog-name/schema-name/dir-name`
  - `value_from` (string, optional)
    The name of an external Databricks resource that contains the value, such as a secret or a database table.
    Example: `volume`

## Returns

Returns the AppDeployment object.

## Response

```json
{
  "deployment_id": "01ef0bda89f21f08a8351f41e4a9b948",
  "source_code_path": "/Workspace/user@test.com/my_custom_app",
  "git_source": {
    "git_repository": {},
    "branch": "main",
    "tag": "v1.0.0",
    "commit": "abc123def456",
    "source_code_path": "my-app",
    "resolved_commit": "abc123def456789012345678901234567890abcd"
  },
  "mode": "SNAPSHOT",
  "deployment_artifacts": {
    "source_code_path": "/Workspace/Users/9627a015-e892-43f7-9085-eec3892da408/src/01ef1a1ed75d1964b62234a35efa61fc"
  },
  "status": {
    "state": "SUCCEEDED",
    "message": "Deployment is in progress."
  },
  "create_time": "string",
  "creator": "user@test.com",
  "update_time": "string",
  "command": [
    "python app.py"
  ],
  "env_vars": [
    {
      "name": "VOLUME_URI",
      "value": "/Volumes/catalog-name/schema-name/dir-name",
      "value_from": "volume"
    }
  ]
}
```

