# ServiceInstance

> A service as it runs in one environment (base settings merged with that environment's overrides).

A service as it runs in one environment (base settings merged with that environment's overrides).

## Fields

| Field | Type | Description |
| --- | --- | --- |
| `service_id` * | string |  |
| `environment_id` * | string |  |
| `name` * | string |  |
| `kind` | `web`, `private`, `worker`, `cron` |  |
| `status` * | [ServiceStatus](/docs/api/objects/service-status/) |  |
| `status_text` | string |  |
| `effective` * | [ServiceConfig](/docs/api/objects/service-config/) |  |
| `overrides` | [ServiceConfig](/docs/api/objects/service-config/) |  |
| `current_deployment` | [Deployment](/docs/api/objects/deployment/) or any or null |  |
| `urls` | object |  |
| `replicas` | object |  |
| `last_error` | object or null |  |
| `cost_today` | [Money](/docs/api/objects/money/) |  |
| `updated_at` | string (date-time) |  |

\* always present

## Example

```json
{
  "service_id": "string",
  "environment_id": "string",
  "name": "string",
  "kind": "web",
  "status": "no_deployment",
  "status_text": "Live. 2 of 2 copies healthy.",
  "effective": {
    "source": {
      "kind": "git",
      "repo": "string",
      "root": "apps/web",
      "watch": [
        "apps/web/**",
        "packages/ui/**",
        "pnpm-lock.yaml"
      ],
      "image": "ghcr.io/acme/api:1.4.2",
      "registry_credentials_secret": "string"
    },
    "build": {
      "builder": "railpack",
      "dockerfile": "services/api/Dockerfile",
      "context": "string"
    },
    "start": "pnpm --filter web start",
    "pre_deploy": "pnpm --filter db migrate deploy",
    "port": 3000,
    "healthcheck": {
      "type": "http",
      "path": "/healthz",
      "port": 1,
      "timeout_seconds": 10,
      "interval_seconds": 10,
      "start_timeout_seconds": 300
    },
    "resources": {
      "cpu": 1,
      "memory_mb": 1024
    },
    "replicas": {
      "min": 1,
      "max": 1,
      "scale_on": {
        "cpu_percent": 10,
        "memory_percent": 10,
        "concurrency": 1
      }
    },
    "sleep_when_idle": false,
    "private": false,
    "cron": {
      "schedule": "0 2 * * *",
      "timezone": "Europe/London",
      "timeout_seconds": 1,
      "concurrency_policy": "forbid"
    },
    "restart_policy": {
      "mode": "on_failure",
      "max_retries": 10
    },
    "deploy": {
      "overlap_seconds": 20,
      "auto_rollback": false
    },
    "volumes": [
      {
        "volume": "string",
        "mount_path": "/data"
      }
    ]
  },
  "overrides": {
    "source": {
      "kind": "git",
      "repo": "string",
      "root": "apps/web",
      "watch": [
        "apps/web/**",
        "packages/ui/**",
        "pnpm-lock.yaml"
      ],
      "image": "ghcr.io/acme/api:1.4.2",
      "registry_credentials_secret": "string"
    },
    "build": {
      "builder": "railpack",
      "dockerfile": "services/api/Dockerfile",
      "context": "string"
    },
    "start": "pnpm --filter web start",
    "pre_deploy": "pnpm --filter db migrate deploy",
    "port": 3000,
    "healthcheck": {
      "type": "http",
      "path": "/healthz",
      "port": 1,
      "timeout_seconds": 10,
      "interval_seconds": 10,
      "start_timeout_seconds": 300
    },
    "resources": {
      "cpu": 1,
      "memory_mb": 1024
    },
    "replicas": {
      "min": 1,
      "max": 1,
      "scale_on": {
        "cpu_percent": 10,
        "memory_percent": 10,
        "concurrency": 1
      }
    },
    "sleep_when_idle": false,
    "private": false,
    "cron": {
      "schedule": "0 2 * * *",
      "timezone": "Europe/London",
      "timeout_seconds": 1,
      "concurrency_policy": "forbid"
    },
    "restart_policy": {
      "mode": "on_failure",
      "max_retries": 10
    },
    "deploy": {
      "overlap_seconds": 20,
      "auto_rollback": false
    },
    "volumes": [
      {
        "volume": "string",
        "mount_path": "/data"
      }
    ]
  },
  "current_deployment": {
    "id": "dep_01jbx2m9k7q4r8t5v6w3y0z1dp",
    "project_id": "prj_01jbx2m9k7q4r8t5v6w3y0z1pr",
    "environment_id": "env_01jbx2m9k7q4r8t5v6w3y0z1en",
    "service_id": "svc_01jbx2m9k7q4r8t5v6w3y0z1sv",
    "service_name": "web",
    "environment_name": "production",
    "status": "active",
    "status_text": "Live since 14:05",
    "trigger": {
      "kind": "git_push",
      "actor": {
        "type": "github",
        "id": "stewartwebb",
        "display": "stewartwebb pushed to main"
      }
    },
    "source": {
      "kind": "git",
      "commit": {
        "sha": "a1b2c3d4e5f60718293a4b5c6d7e8f9012345678",
        "branch": "main",
        "message": "Fix rota export",
        "author": "Stewart Webb"
      }
    },
    "build_id": "bld_01jbx2m9k7q4r8t5v6w3y0z1bd",
    "image": {
      "digest": "sha256:4b1f0e9d8c7b6a5948372615f4e3d2c1b0a9f8e7d6c5b4a3928170f6e5d4c3b2",
      "signed": true
    },
    "rollback_of": null,
    "operation_id": "op_01jbx2m9k7q4r8t5v6w3y0z1op",
    "url": "https://www.primecarers.co.uk",
    "failure": null,
    "created_at": "2026-10-23T14:02:00Z",
    "started_at": "2026-10-23T14:02:01Z",
    "active_at": "2026-10-23T14:05:12Z",
    "finished_at": "2026-10-23T14:05:12Z",
    "duration_ms": 191000
  },
  "urls": {
    "public": [
      "https://web-primecarers-k7q4.guv.run",
      "https://www.primecarers.co.uk"
    ],
    "internal_host": "web.guv.internal"
  },
  "replicas": {
    "desired": 1,
    "running": 1
  },
  "last_error": {
    "message": "string",
    "explanation_url": "string"
  },
  "cost_today": {
    "amount": "7.42",
    "currency": "GBP",
    "display": "£7.42"
  },
  "updated_at": "2026-10-22T13:05:00Z"
}
```

## Used by

- [A service in one environment (effective settings, status, URLs)](/docs/api/services/#a-service-in-one-environment-effective-settings-status-urls)
- [Set this environment's overrides for a service](/docs/api/services/#set-this-environments-overrides-for-a-service)
