---
title: "Service CLI reference"
description: "Customer-hosted cloud features"
---

# Service CLI reference

#### Customer-hosted cloud features

:::note
Some features are only available on customer-hosted clouds. Reach out to [support@anyscale.com](mailto:support@anyscale.com) for info.
:::

## Service CLI

### `anyscale service list`

**Usage**

`anyscale service list [OPTIONS]`

List services.

**Options**

-   **`--service-id/--id`**: ID of the service to display.
-   **`--name/-n`**: Name of the service to display.
-   **`--cloud`**: The Anyscale Cloud of this workload; defaults to your org/workspace cloud.
-   **`--project`**: Named project to use; defaults to your org/workspace project.
-   **`--tag`**: This option can be repeated to filter by multiple tags. Tags with the same key are ORed, whereas tags with different keys are ANDed. Example: --tag team:mlops --tag team:infra --tag env:prod. Filters with team: (mlops OR infra) AND env:prod.
-   **`--created-by-me`**: List services created by me only.
-   **`--state/-s`**: Filter by service state (repeatable). Allowed: STARTING, RUNNING, UPDATING, ROLLING\_OUT, ROLLING\_BACK, UNHEALTHY, TERMINATING, TERMINATED, UNKNOWN, SYSTEM\_FAILURE
-   **`--include-archived`**: Include archived services.
-   **`--max-items`**: Max total items (only with --no-interactive).
-   **`--page-size`**: Items per page (max 50).
-   **`--interactive/--no-interactive`**: Use interactive paging.
-   **`--sort`**: Sort by FIELD (prefix with '-' for desc). Allowed: STATUS, NAME, CREATED\_AT
-   **`-v/--verbose`**: Include full config in JSON output.
-   **`-j/--json`**: Emit structured JSON to stdout.

#### Examples

::::tabs

:::tab[CLI]
```bash
$ anyscale service list --state running --sort -created_at
```
:::

::::

### `anyscale service deploy`

**Usage**

`anyscale service deploy [OPTIONS] [IMPORT_PATH] [ARGUMENTS]...`

Deploy or update a service.

**Options**

-   **`-f/--config-file`**: Path to a YAML config file to deploy. When deploying from a file, import path and arguments cannot be provided. Command-line flags will overwrite values read from the file.
-   **`-n/--name`**: Unique name for the service. When running in a workspace, this defaults to the workspace name.
-   **`--image-uri`**: Container image to use for the service. This cannot be changed when using --in-place and is exclusive with --containerfile. When running in a workspace, this defaults to the image of the workspace.
-   **`--registry-login-secret`**: Name or identifier of the secret containing credentials to authenticate to the docker registry hosting the image. This can only be used when 'image\_uri' is specified and the image is not hosted on Anyscale.
-   **`--containerfile`**: Path to a containerfile to build the image to use for the service. This cannot be changed when using --in-place and is exclusive with --image-uri.
-   **`--ray-version`**: The Ray version (X.Y.Z) to the image specified by --image-uri. This is only used when --image-uri is provided. If you don't specify a Ray version, Anyscale defaults to the latest Ray version available at the time of the Anyscale CLI/SDK release.
-   **`--compute-config`**: Named compute configuration to use for the service. This cannot be changed when using --in-place. When running in a workspace, this defaults to the compute configuration of the workspace.
-   **`-w/--working-dir`**: Path to a local directory or a remote URI to a .zip file (S3, GS, HTTP) that will be the working directory for the service. The files in the directory will be automatically uploaded to cloud storage. When running in a workspace, this defaults to the current working directory.
-   **`-e/--exclude`**: File pattern to exclude when uploading local directories. This argument can be specified multiple times and the patterns will be appended to the 'excludes' list in the config file (if any).
-   **`-r/--requirements`**: Path to a requirements.txt file containing dependencies for the service. Anyscale installs these dependencies on top of the image. If you deploy a service from a workspace, the default is to use the workspace dependencies, but specifying this option overrides them.
-   **`-i/--in-place`**: Perform an in-place upgrade without starting a new cluster. This can be used for faster iteration during development but is _not_ currently recommended for production deploys. This _cannot_ be used to change cluster-level options such as image and compute config (they will be ignored).
-   **`--canary-percent`**: The percentage of traffic to send to the canary version of the service (0-100). This can be used to manually shift traffic toward (or away from) the canary version. If not provided, traffic will be shifted incrementally toward the canary version until it reaches 100. Not supported when using --in-place. This is ignored when restarting a service or creating a new service.
-   **`--max-surge-percent`**: Amount of excess capacity allowed to be used while updating the service (0-100). Defaults to 100. Not supported when using --in-place.
-   **`--env`**: Environment variables to set for the service. The format is 'key=value'. This argument can be specified multiple times. When the same key is also specified in the config file, the value from the command-line flag will overwrite the value from the config file.
-   **`--py-module`**: Python modules to be available for import in the Ray workers. Each entry must be a path to a local directory.
-   **`--cloud`**: The Anyscale Cloud of this workload. If not provided, the organization default will be used (or, if running in a workspace, the cloud of the workspace).
-   **`--project`**: Named project to use for the service. If not provided, the default project for the cloud will be used (or, if running in a workspace, the project of the workspace).
-   **`--tag`**: Tag in key=value (or key:value) format. Repeat to add multiple.
-   **`--version-name`**: Unique name for the service version.
-   **`--connection`**: \[Beta\] Third-party connection to associate with the service (e.g., Databricks). Format: type=TYPE,name=NAME. Example: --connection type=databricks,name=my-conn. Can be repeated for multiple connections. This feature is in beta preview. Contact [Anyscale support](mailto:support@anyscale.com) to request enablement.

### `anyscale service status`

**Usage**

`anyscale service status [OPTIONS]`

Get the status of a service.

**Options**

-   **`-n/--name`**: Name of the service.
-   **`-f/--config-file`**: Path to a YAML config file to read the name from.
-   **`--cloud`**: The Anyscale Cloud of this workload. If not provided, the organization default will be used (or, if running in a workspace, the cloud of the workspace).
-   **`--project`**: Named project to use for the service. If not provided, the default project for the cloud will be used (or, if running in a workspace, the project of the workspace).
-   **`-j/--json`**: Output the status in a structured JSON format.
-   **`-v/--verbose`**: Include verbose details in the status.

### `anyscale service wait`

**Usage**

`anyscale service wait [OPTIONS]`

Wait for a service to enter a target state.

**Options**

-   **`-n/--name`**: Name of the service.
-   **`-f/--config-file`**: Path to a YAML config file to read the name from.
-   **`--cloud`**: The Anyscale Cloud of this workload. If not provided, the organization default will be used (or, if running in a workspace, the cloud of the workspace).
-   **`--project`**: Named project to use for the service. If not provided, the default project for the cloud will be used (or, if running in a workspace, the project of the workspace).
-   **`-s/--state`**: The ServiceState to wait for the service to reach. Defaults to RUNNING.
-   **`-t/--timeout-s`**: Timeout to wait for the service to reach the target state. Defaults to 600s (10min).

### `anyscale service rollback`

**Usage**

`anyscale service rollback [OPTIONS]`

Roll back a service.

**Options**

-   **`--service-id/--id`**: ID of service.
-   **`-n/--name`**: Name of service.
-   **`--project-id`**: Filter by project id.
-   **`--max-surge-percent`**: Max amount of excess capacity allocated during the rollback (0-100).

### `anyscale service terminate`

**Usage**

`anyscale service terminate [OPTIONS]`

Terminate a service.

**Options**

-   **`--service-id/--id`**: ID of service.
-   **`-n/--name`**: Name of service.
-   **`--project-id`**: Filter by project id.
-   **`-f/--config-file/--service-config-file`**: Path to a YAML config file to read the name from. `--service-config-file` is deprecated, use `-f` or `--config-file`.

### `anyscale service archive`

**Usage**

`anyscale service archive [OPTIONS]`

Archive a service.

**Options**

-   **`--service-id/--id`**: ID of service.
-   **`-n/--name`**: Name of the service.
-   **`--cloud`**: The Anyscale Cloud of this workload. If not provided, the organization default will be used.
-   **`--project`**: Named project to use for the service. If not provided, the default project for the cloud will be used (or, if running in a workspace, the project of the workspace).

#### Examples

::::tabs

:::tab[CLI]
```bash
$ anyscale service archive --name my_service
```
:::

::::

### `anyscale service delete`

**Usage**

`anyscale service delete [OPTIONS]`

Delete a service.

**Options**

-   **`--service-id/--id`**: ID of service.
-   **`-n/--name`**: Name of the service.
-   **`--cloud`**: The Anyscale Cloud of this workload. If not provided, the organization default will be used.
-   **`--project`**: Named project to use for the service. If not provided, the default project for the cloud will be used (or, if running in a workspace, the project of the workspace).

#### Examples

::::tabs

:::tab[CLI]
```bash
$ anyscale service delete --name my_service
```
:::

::::

### `anyscale service tags add`

**Usage**

`anyscale service tags add [OPTIONS]`

Add or update tags on a service.

**Options**

-   **`--service-id/--id`**: ID of the service.
-   **`--name/-n`**: Name of the service.
-   **`--cloud`**: Cloud name (for name resolution).
-   **`--project`**: Project name (for name resolution).
-   **`--tag`**: Tag in key=value (or key:value) format. Repeat to add multiple.

#### Examples

::::tabs

:::tab[CLI]
```bash
$ anyscale service tags add --name my-service --tag team=platform --tag env=prod
```
:::

::::

### `anyscale service tags remove`

**Usage**

`anyscale service tags remove [OPTIONS]`

Remove tags by key from a service.

**Options**

-   **`--service-id/--id`**: ID of the service.
-   **`--name/-n`**: Name of the service.
-   **`--cloud`**: Cloud name (for name resolution).
-   **`--project`**: Project name (for name resolution).
-   **`--key`**: Tag key to remove. Repeatable.

#### Examples

::::tabs

:::tab[CLI]
```bash
$ anyscale service tags remove --name my-service --key team --key env
```
:::

::::

### `anyscale service tags list`

**Usage**

`anyscale service tags list [OPTIONS]`

List tags for a service.

**Options**

-   **`--service-id/--id`**: ID of the service.
-   **`--name/-n`**: Name of the service.
-   **`--cloud`**: Cloud name (for name resolution).
-   **`--project`**: Project name (for name resolution).
-   **`--json`**: JSON output.

#### Examples

::::tabs

:::tab[CLI]
```bash
$ anyscale service tags list --name my-service --json
```
:::

::::

## Service models

### `ServiceConfig`

Configuration options for a service.

#### Fields

-   **`name` (str | None)**: Unique name of the service. When running inside a workspace, this defaults to the name of the workspace, else it is required.
-   **`image_uri` (str | None)**: URI of an existing image. Exclusive with `containerfile`.
-   **`containerfile` (str | None)**: The file path to a containerfile that will be built into an image before running the workload. Exclusive with `image_uri`.
-   **`compute_config` ([ComputeConfig](/reference/sdk/compute-config.md#computeconfig) | [MultiResourceComputeConfig](/reference/sdk/compute-config.md#multiresourcecomputeconfig) | Dict | str | None)**: The name of an existing registered compute config or an inlined ComputeConfig or MultiResourceComputeConfig object.
-   **`working_dir` (str | None)**: Directory that will be used as the working directory for the application. If a local directory is provided, it will be uploaded to cloud storage automatically. When running inside a workspace, this defaults to the current working directory ('.').
-   **`excludes` (List\[str\] | None)**: A list of file path globs that will be excluded when uploading local files for `working_dir`.
-   **`requirements` (str | List\[str\] | None)**: A list of pip requirements or a path to a `requirements.txt` file for the workload. Anyscale installs these dependencies on top of the image. If you run a workload from a workspace, the default is to use the workspace dependencies, but specifying this option overrides them.
-   **`env_vars` (Dict\[str, str\] | None)**: A dictionary of environment variables that will be set for the workload.
-   **`py_modules` (List\[str\] | None)**: A list of local directories or remote URIs that will be uploaded and added to the Python path.
-   **`py_executable` (str | None)**: Specifies the executable used for running the Ray workers. It can include arguments as well.
-   **`cloud` (str | None)**: The Anyscale Cloud to run this workload on. If not provided, the organization default will be used (or, if running in a workspace, the cloud of the workspace).
-   **`project` (str | None)**: The project for the workload. If not provided, the default project for the cloud will be used (or, if running in a workspace, the project of the workspace).
-   **`registry_login_secret` (str | None)**: A name or identifier of the secret containing credentials to authenticate to the docker registry hosting the image. This can only be used when 'image\_uri' is specified and the image is not hosted on Anyscale.
-   **`ray_version` (str | None)**: The Ray version (X.Y.Z) specified for this image specified by either an image URI or a containerfile. If you don't specify a Ray version, Anyscale defaults to the latest Ray version available at the time of the Anyscale CLI/SDK release.
-   **`connections` (List\[[ConnectionConfig](/reference/sdk/job.md#connectionconfig) | Dict\] | None)**: Connections to third-party integrations (e.g., Databricks) to associate with the workload. This feature is in beta preview. Contact [Anyscale support](mailto:support@anyscale.com) to request enablement.
-   **`applications` (List\[Dict\[str, Any\]\])**: List of Ray Serve applications to run. At least one application must be specified. For details, see the Ray Serve config file format documentation: [https://docs.ray.io/en/latest/serve/production-guide/config.html](https://docs.ray.io/en/latest/serve/production-guide/config.html)
-   **`version_name` (str | None)**: Unique name of the version.
-   **`query_auth_token_enabled` (bool)**: Whether or not queries to this service are gated behind an authentication token. If `True`, an auth token is generated the first time the service is deployed. You can find the token in the UI or by fetching the status of the service.
-   **`http_options` (Dict\[str, Any\] | None)**: HTTP options that will be passed to Ray Serve. See [https://docs.ray.io/en/latest/serve/production-guide/config.html](https://docs.ray.io/en/latest/serve/production-guide/config.html) for supported options.
-   **`grpc_options` (Dict\[str, Any\] | None)**: gRPC options that will be passed to Ray Serve. See [https://docs.ray.io/en/latest/serve/production-guide/config.html](https://docs.ray.io/en/latest/serve/production-guide/config.html) for supported options.
-   **`logging_config` (Dict\[str, Any\] | None)**: Logging options that will be passed to Ray Serve. See [https://docs.ray.io/en/latest/serve/production-guide/config.html](https://docs.ray.io/en/latest/serve/production-guide/config.html) for supported options.
-   **`ray_gcs_external_storage_config` ([RayGCSExternalStorageConfig](#raygcsexternalstorageconfig) | Dict | None)**: Configuration options for external storage for the Ray Global Control Store (GCS).
    -   Only available on [customer-hosted clouds](#customer-hosted-only).
-   **`tracing_config` ([TracingConfig](#tracingconfig) | Dict | None)**: Configuration options for tracing.
    -   Only available on [customer-hosted clouds](#customer-hosted-only).
-   **`tags` (Dict\[str, str\] | None)**: Tags to associate with the service.

#### Python Methods

```python
def __init__(self, **fields) -> ServiceConfig
    """Construct a model with the provided field values set."""

def options(self, **fields) -> ServiceConfig
    """Return a copy of the model with the provided field values overwritten."""

def to_dict(self) -> Dict[str, Any]
    """Return a dictionary representation of the model."""
```

#### Examples

::::tabs

:::tab[YAML]
```yaml
name: my-service
applications:
  - import_path: main:app
image_uri: anyscale/image/my-image:1 # (Optional) Exclusive with `containerfile`.
containerfile: /path/to/Dockerfile # (Optional) Exclusive with `image_uri`.
compute_config: my-compute-config:1 # (Optional) An inline dictionary can also be provided.
working_dir: /path/to/working_dir # (Optional) If a local directory is provided, it will be uploaded automatically.
excludes: # (Optional) List of files to exclude from being packaged up for the service.
  - .git
  - .env
  - .DS_Store
  - __pycache__
requirements: # (Optional) List of requirements files to install. Can also be a path to a requirements.txt.
  - emoji==1.2.0
  - numpy==1.19.5
env_vars: # (Optional) Dictionary of environment variables to set in the service.
  MY_ENV_VAR: my_value
  ANOTHER_ENV_VAR: another_value
py_modules: # (Optional) A list of local directories or remote URIs that will be added to the Python path.
  - /path/to/my_module
  - s3://my_bucket/my_module
cloud: anyscale-prod # (Optional) The name of the Anyscale Cloud.
project: my-project # (Optional) The name of the Anyscale Project.
query_auth_token_enabled: True # (Optional) Whether or not to gate this service behind an auth token.
http_options:
  request_timeout_s: 60 # (Optional) Timeout for HTTP requests in seconds. Default is no timeout.
  keep_alive_timeout_s: 60 # (Optional) Timeout for HTTP keep-alive connections in seconds. Default is 5 seconds.
grpc_options:
  port: 50051 # (Optional) Port to listen on for gRPC requests. Default is 9000.
  grpc_servicer_functions: # (Optional) List of functions to expose as gRPC servicers.
    - my_module:my_function
logging_config: # (Optional) Configuration options for logging.
  encoding: JSON # JSON or TEXT.
  log_level: INFO
  enable_access_log: true
tracing_config: # (Optional) Configuration options for tracing.
  enabled: true
  exporter_import_path: my_module:custom_tracing_exporter
  sampling_ratio: 1.0
tags:
  team: serving
  cost-center: eng
connections: # (Optional) List of third-party connections for credential injection.
  - type: databricks
    name: my-databricks-connection
```
:::

:::tab[Python]
```python
from anyscale.service.models import ServiceConfig

config = ServiceConfig(
    name="my-service",
    working_dir=".",
    applications=[{"import_path": "main:app"}],
    # An inline `ComputeConfig` can also be provided.
    compute_config="my-compute-config:1",
    # A containerfile path can also be provided.
    image_uri="anyscale/image/my-image:1",
)
```
:::

::::

### `RayGCSExternalStorageConfig`

Configuration options for external storage for the Ray Global Control Store (GCS).

When external storage is enabled for a service, it will be able to continue serving traffic if the head node goes down. Without external storage, the entire cluster will be restarted.

#### Fields

-   **`enabled` (bool)**: Enable or disable external storage. When `False`, the other fields are ignored.
-   **`address` (str | None)**: Address to connect to the redis instance at. Defaults to the cloud-wide configuration.
-   **`certificate_path` (str | None)**: Path to the TLS certificate file to use for authentication when using secure connections. Defaults to the cloud-wide configuration.

#### Python Methods

```python
def __init__(self, **fields) -> RayGCSExternalStorageConfig
    """Construct a model with the provided field values set."""

def options(self, **fields) -> RayGCSExternalStorageConfig
    """Return a copy of the model with the provided field values overwritten."""

def to_dict(self) -> Dict[str, Any]
    """Return a dictionary representation of the model."""
```

#### Examples

::::tabs

:::tab[YAML]
```yaml
name: my-service
applications:
  - import_path: main:app
ray_gcs_external_storage_config:
  enabled: true
  address: http://redis-address:8888
  certificate_path: /etc/ssl/certs/ca-certificates.crt
```
:::

:::tab[Python]
```python
from anyscale.service.models import ServiceConfig, RayGCSExternalStorageConfig

config = ServiceConfig(
    name="my-service",
    applications=[{"import_path": "main:app"}],
    ray_gcs_external_storage_config=RayGCSExternalStorageConfig(
        enabled=True,
        address="http://redis-address:8888",
        certificate_path="/etc/ssl/certs/ca-certificates.crt",
    ),
)
```
:::

::::

### `TracingConfig`

Configuration options for tracing.

Tracing provides a way to collect telemetry on requests that are handled by your Serve application. If tracing is enabled, you can instrument your Serve application and export traces to a specific backend by configuring the `exporter_import_path` option. This feature is currently experimental.

#### Fields

-   **`enabled` (bool)**: Flag to enable tracing. When `True` and no `exporter_import_path` is defined, then the default tracing exporter will be used to export traces to serve logs. When `False`, the other fields are ignored.
-   **`exporter_import_path` (str | None)**: Path to exporter function. Should be of the form "module.submodule\_1...submodule\_n.export\_tracing". This is equivalent to "from module.submodule\_1...submodule\_n import export\_tracing. Exporter function takes no arguments and returns List\[SpanProcessor\].
-   **`sampling_ratio` (float)**: Ratio of traces to record and export. Reducing the ratio can help with minimizing serving latency and storage overhead.

#### Python Methods

```python
def __init__(self, **fields) -> TracingConfig
    """Construct a model with the provided field values set."""

def options(self, **fields) -> TracingConfig
    """Return a copy of the model with the provided field values overwritten."""

def to_dict(self) -> Dict[str, Any]
    """Return a dictionary representation of the model."""
```

#### Examples

::::tabs

:::tab[YAML]
```yaml
name: my-service
applications:
  - import_path: main:app
tracing_config:
  enabled: true
  exporter_import_path: "my_module:custom_tracing_exporter"
  sampling_ratio: 1.0
```
:::

:::tab[Python]
```python
from anyscale.service.models import ServiceConfig, TracingConfig

config = ServiceConfig(
    name="my-service",
    applications=[{"import_path": "main:app"}],
    tracing_config=TracingConfig(
        enabled=True,
        exporter_import_path="my_module:custom_tracing_exporter",
        sampling_ratio=1.0,
    ),
)
```
:::

::::

### `ServiceStatus`

Current status of a service.

#### Fields

-   **`name` (str)**: Unique name of the service.
-   **`id` (str)**: Unique ID of the service (generated when the service is first deployed).
-   **`state` ([ServiceState](#servicestate) | str)**: Current state of the service.
-   **`query_url` (str)**: URL used to query the service.
-   **`creator` (str | None)**: Email of the user or entity that created the service.
-   **`query_auth_token` (str | None)**: Query auth token required to query the service (if any). Must be passed in as a header like: `Authorization: Bearer \<token\>`.
-   **`primary_version` ([ServiceVersionStatus](#serviceversionstatus) | Dict | None)**: Primary version of the service. During a rollout, this is the service version that was running prior to the deploy.
-   **`canary_version` ([ServiceVersionStatus](#serviceversionstatus) | Dict | None)**: Canary version of the service (the one that is being deployed). When there is no rollout ongoing, this will be `None`.
-   **`project` (str | None)**: Name of the project that this service belongs to.
-   **`versions` (List\[[ServiceVersionStatus](#serviceversionstatus)\] | None)**: All active versions of the service with their traffic weights.

#### Python Methods

```python
def to_dict(self) -> Dict[str, Any]
    """Return a dictionary representation of the model."""
```

#### Examples

::::tabs

:::tab[Python]
```python
import anyscale
from anyscale.service.models import ServiceStatus

status: ServiceStatus = anyscale.service.status("my-service")
```
:::

:::tab[CLI]
```bash
$ anyscale service status -n my-service
name: my-service
id: service2_uz6l8yhy2as5wrer3shzj6kh67
state: RUNNING
primary_version:
  id: 601bd56c4b
  state: RUNNING
  weight: 100
```
:::

::::

### `ServiceState`

Current state of a service.

#### Values

-   **`STARTING`**: The service is starting up.
-   **`RUNNING`**: The service is running and healthy.
-   **`UPDATING`**: One of the service versions or the networking stack is updating.
-   **`ROLLING_OUT`**: The service is rolling out to a new canary version.
-   **`ROLLING_BACK`**: The service is rolling back to the primary version.
-   **`UNHEALTHY`**: The service has become unhealthy due to an unexpected issue such as a node failure. In most cases these issues should automatically recover.
-   **`TERMINATING`**: The service is terminating.
-   **`TERMINATED`**: The service is terminated.
-   **`UNKNOWN`**: The CLI/SDK received an unexpected state from the API server. In most cases, this means you need to update the CLI.
-   **`SYSTEM_FAILURE`**: An unexpected error occurred in the Anyscale stack. Please reach out to customer support immediately.

### `ServiceVersionStatus`

Current status of a single version of a running service.

#### Fields

-   **`id` (str)**: Unique ID of the service _version_ (_not_ the service).
-   **`name` (str)**: Human-readable name of the service version.
-   **`state` ([ServiceVersionState](#serviceversionstate) | str)**: Current state of the service version.
-   **`weight` (int)**: Current canary weight of the service version. This is `100` if there is no ongoing rollout.
-   **`created_at` (datetime)**: Creation time of the service version.
-   **`config` ([ServiceConfig](#serviceconfig) | Dict)**: Configuration of this service version.

#### Python Methods

```python
def to_dict(self) -> Dict[str, Any]
    """Return a dictionary representation of the model."""
```

#### Examples

::::tabs

:::tab[Python]
```python
import anyscale
from anyscale.service.models import ServiceStatus, ServiceVersionStatus

status: ServiceStatus = anyscale.service.status("my-service")
primary_version_status: ServiceVersionStatus = status.primary_version
```
:::

:::tab[CLI]
```bash
$ anyscale service status -n my-service
name: my-service
id: service2_uz6l8yhy2as5wrer3shzj6kh67
state: RUNNING
primary_version:
  id: 601bd56c4b
  name: v1
  state: RUNNING
  weight: 100
  created_at: 2025-04-18 17:21:28.323174+00:00
```
:::

::::

### `ServiceVersionState`

Current state of a service version.

#### Values

-   **`STARTING`**: The service version is starting up.
-   **`UPDATING`**: The application(s) on the service version are updating due to a config deploy or update.
-   **`RUNNING`**: The service version is running and healthy.
-   **`UNHEALTHY`**: The service version has become unhealthy due to an unexpected issue such as a node failure. In most cases these issues should automatically recover.
-   **`TERMINATING`**: The service version is terminating.
-   **`TERMINATED`**: The service version is terminated.
-   **`UNKNOWN`**: The CLI/SDK received an unexpected state from the API server. In most cases, this means you need to update the CLI.
-   **`SYSTEM_FAILURE`**: An unexpected error occurred in the Anyscale stack. Please reach out to customer support immediately.

### `ServiceSortField`

Fields available for sorting services.

#### Values

-   **`STATUS`**: Sort by service status (active first by default).
-   **`NAME`**: Sort by service name.
-   **`CREATED_AT`**: Sort by creation timestamp.

### `ServiceSortOrder`

Enum for sort order directions.

#### Values

-   **`ASC`**: Sort in ascending order.
-   **`DESC`**: Sort in descending order.

---

Previous: [Service account](/reference/cli/service-account.md) | Next: [User group](/reference/cli/user-group.md)