*Cloud*

# The service object

A service is one app that runs in an environment: built from a GitHub repository or run from a container image, on one or more replicas, in one or more regions.

## Attributes

- `svc` (string): The service's id.
- `name` (string): Its name, unique in the environment.
- `env` (string): The environment it runs in.
- `source_kind` (string): repo (built from GitHub) or image (a container image).
- `dep` (string): Its latest deployment, or empty before the first.
- `dep_state` (string): That deployment's state: queued, building, starting, live, failed, superseded, rolled_back or cancelled.
- `cpu_millis` (number): CPU per replica in millicores (1000 = one core).
- `memory_mb` (number): Memory per replica in MB.
- `replicas` (number): Replicas in the project's region.
- `hostname` (string): Its generated public address.
- `group` (string): Its service group, or null.

## Example

```json
{
  "data": {
    "svc": "svc_01jdk3n2f4g6h8j0k2l4z6x8ca",
    "name": "api",
    "env": "env_01jdk3m9x5h2p8r4t6y1u3i0oa",
    "source_kind": "repo",
    "dep": "dep_01jdk4p7q9w1e3r5t7y9u1i3ob",
    "dep_state": "live",
    "cpu_millis": 1000,
    "memory_mb": 1024,
    "replicas": 2,
    "hostname": "api-x8ca.in.dispracloud.app",
    "group": "grp_01jdk5e2r4t6y8u0i2o4p6a8sd"
  }
}
```

## Endpoints

- `POST` [Add a custom domain](https://docs.dispralabs.com/api/add-a-custom-domain.md)
- `POST` [Add a region](https://docs.dispralabs.com/api/add-a-region.md)
- `POST` [Attach a volume](https://docs.dispralabs.com/api/attach-a-volume.md)
- `POST` [Cancel a deployment](https://docs.dispralabs.com/api/cancel-a-deployment.md)
- `PATCH` [Change an endpoint's port](https://docs.dispralabs.com/api/change-an-endpoint-s-port.md)
- `GET` [Check a file on the branch](https://docs.dispralabs.com/api/check-a-file-on-the-branch.md)
- `GET` [Check an address name](https://docs.dispralabs.com/api/check-an-address-name.md)
- `POST` [Create a deployment](https://docs.dispralabs.com/api/create-a-deployment.md)
- `POST` [Create a service](https://docs.dispralabs.com/api/create-a-service.md)
- `POST` [Create an endpoint](https://docs.dispralabs.com/api/create-an-endpoint.md)
- `DELETE` [Delete a service](https://docs.dispralabs.com/api/delete-a-service.md)
- `DELETE` [Delete a service variable](https://docs.dispralabs.com/api/delete-a-service-variable.md)
- `DELETE` [Delete an endpoint](https://docs.dispralabs.com/api/delete-an-endpoint.md)
- `DELETE` [Detach a volume](https://docs.dispralabs.com/api/detach-a-volume.md)
- `GET` [Get a deployment](https://docs.dispralabs.com/api/get-a-deployment.md)
- `GET` [Get a service](https://docs.dispralabs.com/api/get-a-service.md)
- `GET` [Get service metrics](https://docs.dispralabs.com/api/get-service-metrics.md)
- `GET` [Get service settings](https://docs.dispralabs.com/api/get-service-settings.md)
- `GET` [Get the image's port](https://docs.dispralabs.com/api/get-the-image-s-port.md)
- `GET` [List deployments](https://docs.dispralabs.com/api/list-deployments.md)
- `GET` [List endpoints](https://docs.dispralabs.com/api/list-endpoints.md)
- `GET` [List logs](https://docs.dispralabs.com/api/list-logs.md)
- `GET` [List recent commits](https://docs.dispralabs.com/api/list-recent-commits.md)
- `GET` [List service regions](https://docs.dispralabs.com/api/list-service-regions.md)
- `GET` [List service variables](https://docs.dispralabs.com/api/list-service-variables.md)
- `GET` [List services](https://docs.dispralabs.com/api/list-services.md)
- `PUT` [Move a service to a group](https://docs.dispralabs.com/api/move-a-service-to-a-group.md)
- `POST` [Open a shell](https://docs.dispralabs.com/api/open-a-shell.md)
- `POST` [Preview a custom domain](https://docs.dispralabs.com/api/preview-a-custom-domain.md)
- `POST` [Regenerate an endpoint](https://docs.dispralabs.com/api/regenerate-an-endpoint.md)
- `DELETE` [Remove a region](https://docs.dispralabs.com/api/remove-a-region.md)
- `POST` [Restart a service](https://docs.dispralabs.com/api/restart-a-service.md)
- `POST` [Reveal a service variable](https://docs.dispralabs.com/api/reveal-a-service-variable.md)
- `POST` [Reveal all service variables](https://docs.dispralabs.com/api/reveal-all-service-variables.md)
- `PATCH` [Set a region's replicas](https://docs.dispralabs.com/api/set-a-region-s-replicas.md)
- `PUT` [Set a service variable](https://docs.dispralabs.com/api/set-a-service-variable.md)
- `PUT` [Set service limits](https://docs.dispralabs.com/api/set-service-limits.md)
- `POST` [Start a service](https://docs.dispralabs.com/api/start-a-service.md)
- `POST` [Stop a service](https://docs.dispralabs.com/api/stop-a-service.md)
- `GET` [Stream a service's logs](https://docs.dispralabs.com/api/stream-a-service-s-logs.md)
- `POST` [Test a health check](https://docs.dispralabs.com/api/test-a-health-check.md)
- `PATCH` [Update service settings](https://docs.dispralabs.com/api/update-service-settings.md)
- `POST` [Validate variables text](https://docs.dispralabs.com/api/validate-variables-text.md)
