---
# Generated by kapten-docs from the CLI's command tree. DO NOT EDIT.
title: "kapten applications"
description: "Deploy and run long-running applications."
sidebar:
  label: "applications"
---

Every command takes the [global flags](/cli/reference#global-flags).

## kapten applications create

Creates a long-running application in an environment, built from a GitHub repository or deployed from a container image.

```bash
kapten applications create <project-id> <environment-id> <body...> [flags]
```

| Argument | Description |
| --- | --- |
| `project-id` | The unique identifier for the project |
| `environment-id` | The unique identifier of the environment |
| `body...` | The request body, as shorthand or JSON. See [Request bodies](/cli/request-bodies). |

| Flag | Description |
| --- | --- |
| `--rsh-generate-body` | Print an example request body and exit |
| `--rsh-validate` | Validate the JSON request body against the OpenAPI schema before sending |

Request body fields, `*` for required:

```text
{
  configuration*: {
    arguments: [
      (string)
    ]
    cpu_limit_in_milli: (string) Maximum CPU allocated to the application. Unit is millicores (m).
    cpu_request_in_milli: (string) Requested CPU. Unit is millicores (m).
    entrypoint: (string) Application entrypoint.
    gpu_limit: (integer min:0) Optional GPU count.
    healthchecks*: {
      liveness_probe: {
        failure_threshold: (integer default:9)
        initial_delay_seconds: (integer default:30)
        period_seconds: (integer default:10)
        success_threshold: (integer default:1)
        timeout_seconds: (integer default:5)
        type: {
          exec: <...>
          grpc: <...>
          http: <...>
          tcp: <...>
        }
      }
      readiness_probe: {
        failure_threshold: (integer default:9)
        initial_delay_seconds: (integer default:30)
        period_seconds: (integer default:10)
        success_threshold: (integer default:1)
        timeout_seconds: (integer default:5)
        type: {
          exec: <...>
          grpc: <...>
          http: <...>
          tcp: <...>
        }
      }
    }
    max_running_instances: (integer min:1) Maximum number of running instances.
    min_running_instances: (integer min:1) Minimum number of running instances.
    ports: [
      {
        external_port: (integer min:1 max:65535) Optional exposed port, persisted for future exposure features.
        id: (string format:uuid) A universally unique identifier (UUID) string
        internal_port*: (integer min:1 max:65535) Listening port inside the application.
        is_default*: (boolean) Whether this is the default port for future domain routing.
        name*: (string) Human-readable port name.
        protocol*: (string enum:HTTP,GRPC,TCP,UDP) Application port protocol.
      }
    ]
    ram_limit_in_mib: (string) Maximum memory allocated to the application.
    ram_request_in_mib: (string) Requested memory.
    source*: oneOf{
      {
        image_name*: (string pattern:\S minLen:1) image name
        tag*: (string pattern:\S minLen:1) tag of the image container
        type*: (string enum:container) Container source discriminator.
      }
      {
        branch*: (string minLen:1)
        build_policy*: {
          context: <...>
          cpu_limit_in_milli*: <...>
          cpu_request_in_milli*: <...>
          ram_limit_in_mib*: <...>
          ram_request_in_mib*: <...>
          timeout_seconds: <...>
        }
        installation_id*: (string format:uuid) A universally unique identifier (UUID) string
        repository_id*: (string pattern:^[1-9][0-9]*$)
        trigger_policy: {
          automatic: <...>
          path_mode: <...>
          paths: <...>
        }
        type*: (string enum:github)
      }
    }
    storages: [
      {
        id: (string format:uuid) A universally unique identifier (UUID) string
        mount_path*: (string) Absolute path mounted into the application.
        name*: (string) Human-readable storage name.
        size_in_gib*: (integer min:1) Persistent volume size in GiB.
        storage_type*: (string) Kubernetes storage class name.
      }
    ]
  }
  description: (string)
  name*: (string pattern:\S minLen:1) Name of the application component.
}
```

Example:

```bash
kapten applications create <project-id> <environment-id> <input.json
```

## kapten applications deploy

Starts a deployment of the application.

```bash
kapten applications deploy <project-id> <environment-id> <application-id> [flags]
```

| Argument | Description |
| --- | --- |
| `project-id` | The unique identifier for the project |
| `environment-id` | The unique identifier of the environment |
| `application-id` | The unique identifier for the application |

Example:

```bash
kapten applications deploy <project-id> <environment-id> <application-id>
```

## kapten applications get

Returns an application.

```bash
kapten applications get <project-id> <environment-id> <application-id> [flags]
```

| Argument | Description |
| --- | --- |
| `project-id` | The unique identifier for the project |
| `environment-id` | The unique identifier of the environment |
| `application-id` | The unique identifier for the application |

Example:

```bash
kapten applications get <project-id> <environment-id> <application-id>
```

## kapten applications get-run

Returns one deployment run of the application.

```bash
kapten applications get-run <project-id> <environment-id> <application-id> <component-run-id> [flags]
```

| Argument | Description |
| --- | --- |
| `project-id` | The unique identifier for the project |
| `environment-id` | The unique identifier of the environment |
| `application-id` | The unique identifier for the application |
| `component-run-id` | The unique identifier for the component run |

Example:

```bash
kapten applications get-run <project-id> <environment-id> <application-id> <component-run-id>
```

## kapten applications list-runs

Returns the application's deployment runs, a page at a time.

```bash
kapten applications list-runs <project-id> <environment-id> <application-id> [flags]
```

| Argument | Description |
| --- | --- |
| `project-id` | The unique identifier for the project |
| `environment-id` | The unique identifier of the environment |
| `application-id` | The unique identifier for the application |

| Flag | Description |
| --- | --- |
| `--action string` | Filter component runs by action. |
| `--created-after string` | Filter component runs created at or after this timestamp. |
| `--created-before string` | Filter component runs created at or before this timestamp. |
| `--page-limit int` | Maximum number of records to return (default: 10) |
| `--page-number int` | Page number (default: 1) |
| `--status string` | Filter component runs by deployment status. |
| `--trigger string` | Filter component runs by trigger source. |

Example:

```bash
kapten applications list-runs <project-id> <environment-id> <application-id>
```

## kapten applications query-run-logs

Returns the deployment logs of one application run: what Kapten and the image build did while deploying it, and what its agent on the cluster did. For the application's own output, use the component logs.

Without `from` or `to`, the window spans the run, from its start to its end. Logs follow the retention of the log backend, so the logs of an old run may be gone, and runs from before run logs existed return an empty list.

```bash
kapten applications query-run-logs <project-id> <environment-id> <application-id> <component-run-id> <body...> [flags]
```

| Argument | Description |
| --- | --- |
| `project-id` | The unique identifier for the project |
| `environment-id` | The unique identifier of the environment |
| `application-id` | The unique identifier for the application |
| `component-run-id` | The unique identifier for the component run |
| `body...` | The request body, as shorthand or JSON. See [Request bodies](/cli/request-bodies). |

| Flag | Description |
| --- | --- |
| `--rsh-generate-body` | Print an example request body and exit |
| `--rsh-validate` | Validate the JSON request body against the OpenAPI schema before sending |

Request body fields, `*` for required:

```text
{
  from: (string format:date-time) Inclusive lower bound for the run log time range.
  levels: [
    (string)
  ]
  limit: (integer format:int32 default:200 min:1 max:1000) Maximum number of most recent raw backend records to query.
  source: [
    (string enum:control_plane,agent,builder)
  ]
  text: (string) Optional phrase to search in the log message.
  to: (string format:date-time) Inclusive upper bound for the run log time range.
  view: (string default:both enum:timeline,raw,both) Which run log projection to return.
}
```

Example:

```bash
kapten applications query-run-logs <project-id> <environment-id> <application-id> <component-run-id> 'limit: 200, source: [control_plane, agent, builder], view: timeline'
```

## kapten applications update

Updates an application. Fields left out keep their value.

```bash
kapten applications update <project-id> <environment-id> <application-id> <body...> [flags]
```

| Argument | Description |
| --- | --- |
| `project-id` | The unique identifier for the project |
| `environment-id` | The unique identifier of the environment |
| `application-id` | The unique identifier for the application |
| `body...` | The request body, as shorthand or JSON. See [Request bodies](/cli/request-bodies). |

| Flag | Description |
| --- | --- |
| `--rsh-generate-body` | Print an example request body and exit |
| `--rsh-validate` | Validate the JSON request body against the OpenAPI schema before sending |

Request body fields, `*` for required:

```text
{
  configuration: {
    arguments: [
      (string)
    ]
    cpu_limit_in_milli: (string) Updated CPU limit.
    cpu_request_in_milli: (string) Updated CPU request.
    entrypoint: (string) Updated application entrypoint.
    gpu_limit: (integer min:0) Updated GPU count.
    healthchecks: {
      liveness_probe: {
        failure_threshold: (integer default:9)
        initial_delay_seconds: (integer default:30)
        period_seconds: (integer default:10)
        success_threshold: (integer default:1)
        timeout_seconds: (integer default:5)
        type: {
          exec: <...>
          grpc: <...>
          http: <...>
          tcp: <...>
        }
      }
      readiness_probe: {
        failure_threshold: (integer default:9)
        initial_delay_seconds: (integer default:30)
        period_seconds: (integer default:10)
        success_threshold: (integer default:1)
        timeout_seconds: (integer default:5)
        type: {
          exec: <...>
          grpc: <...>
          http: <...>
          tcp: <...>
        }
      }
    }
    max_running_instances: (integer min:1) Updated maximum number of running instances.
    min_running_instances: (integer min:1) Updated minimum number of running instances.
    ports: [
      {
        external_port: (integer min:1 max:65535) Optional exposed port, persisted for future exposure features.
        id: (string format:uuid) A universally unique identifier (UUID) string
        internal_port*: (integer min:1 max:65535) Listening port inside the application.
        is_default*: (boolean) Whether this is the default port for future domain routing.
        name*: (string) Human-readable port name.
        protocol*: (string enum:HTTP,GRPC,TCP,UDP) Application port protocol.
      }
    ]
    ram_limit_in_mib: (string) Updated RAM limit.
    ram_request_in_mib: (string) Updated RAM request.
    source: oneOf{
      {
        image_name*: (string pattern:\S minLen:1) image name
        tag*: (string pattern:\S minLen:1) tag of the image container
        type*: (string enum:container) Container source discriminator.
      }
      {
        branch*: (string minLen:1)
        build_policy*: {
          context: <...>
          cpu_limit_in_milli*: <...>
          cpu_request_in_milli*: <...>
          ram_limit_in_mib*: <...>
          ram_request_in_mib*: <...>
          timeout_seconds: <...>
        }
        installation_id*: (string format:uuid) A universally unique identifier (UUID) string
        repository_id*: (string pattern:^[1-9][0-9]*$)
        trigger_policy: {
          automatic: <...>
          path_mode: <...>
          paths: <...>
        }
        type*: (string enum:github)
      }
    }
    storages: [
      {
        id: (string format:uuid) A universally unique identifier (UUID) string
        mount_path*: (string) Absolute path mounted into the application.
        name*: (string) Human-readable storage name.
        size_in_gib*: (integer min:1) Persistent volume size in GiB.
        storage_type*: (string) Kubernetes storage class name.
      }
    ]
  }
  description: (string) Updated application description.
  name: (string pattern:\S minLen:1) Updated application name.
}
```

Example:

```bash
kapten applications update <project-id> <environment-id> <application-id> <input.json
```
