# The defaults of a new service

> GET /v1/services/defaults. The single source of service defaults and limits (decision 12): scaling, key expiry, timeouts and, for a catalog entry (catalog_id), its target…

Source: https://legion.ambient.xyz/docs/api/services/get-service-defaults

`GET https://api.legion.ambient.xyz/v1/services/defaults`

Authenticate with an API key: `Authorization: Bearer $LEGION_API_KEY`.

The single source of service defaults and limits (decision 12): scaling, key expiry, timeouts and, for a
catalog entry (`catalog_id`), its target concurrency and the GPUs per replica it needs. The web app, CLI
and MCP read these; nothing else hardcodes them. Needs `services.read`.

## Query parameters

- `catalog_id`, string

## Responses

### 200

The defaults.

- `scaling`, ServiceScaling, required
  - `min_replicas`, integer, required
  - `max_replicas`, integer, required
  - `scale_to_zero`, boolean, required
  - `idle_timeout_seconds`, integer, required
  - `scale_down_delay_seconds`, integer, required
  - `warm_replicas`, integer, required
  - `target_concurrency`, integer, required
  - `max_concurrency`, integer, required
  - `queue_wait_threshold_ms`, integer, required
  - `request_timeout_seconds`, integer, required
- `scale_to_zero_idle_timeout_seconds`, integer, required: The idle window when scale_to_zero is turned on.
- `scale_to_zero_warm_replicas`, integer, required: The warm replicas suggested when scale_to_zero is turned on.
- `key_expiry_days`, integer, required
- `key_expiry_options`, array of integer, required
- `max_request_timeout_seconds`, integer, required
- `max_wait_seconds`, integer, required: The most a caller may hold a cold request with `X-Legion-Wait`.
- `min_gpus`, integer, required: GPUs per replica the catalog entry needs; 1 without one.
- `limits`, ServiceLimits, required
  - `max_services`, integer, required
  - `max_keys_per_service`, integer, required
  - `max_replicas_per_service`, integer, required
  - `max_replicas_per_org`, integer, required
  - `max_gpu_choices`, integer, required

Example:

```json
{
  "scaling": {
    "min_replicas": 0,
    "max_replicas": 0,
    "scale_to_zero": false,
    "idle_timeout_seconds": 0,
    "scale_down_delay_seconds": 0,
    "warm_replicas": 0,
    "target_concurrency": 0,
    "max_concurrency": 0,
    "queue_wait_threshold_ms": 0,
    "request_timeout_seconds": 0
  },
  "scale_to_zero_idle_timeout_seconds": 0,
  "scale_to_zero_warm_replicas": 0,
  "key_expiry_days": 0,
  "key_expiry_options": [
    0
  ],
  "max_request_timeout_seconds": 0,
  "max_wait_seconds": 0,
  "min_gpus": 0,
  "limits": {
    "max_services": 0,
    "max_keys_per_service": 0,
    "max_replicas_per_service": 0,
    "max_replicas_per_org": 0,
    "max_gpu_choices": 0
  }
}
```

### 400

The request is malformed or fails validation. An image reference that
is not a container image reference answers `invalid_image_reference`.

### 401

Missing, unknown, expired or revoked credentials.

### 403

The caller lacks the permission this operation requires (`forbidden`),
or signed in without having joined an organization yet
(`no_organization`; `getOnboarding` and the invitation and
organization operations under it work), or could not sign in
(`email_unverified`, `account_conflict`, and `domain_not_allowed`). `not_invited` is no longer returned to
session tokens.

`access_not_approved`: a signed-in person who is not approved
for the beta yet. Every operation that takes a credential answers it to
them, except `getMe` and `joinMyWaitlist`; the problem carries
`access` (`waitlisted` or `not_requested`, and the email). Approved
means a member of an organization, holding a pending invitation, or Legion; an API key always belongs to a member.

`oauth_token_mcp_only`: the caller sent an OAuth access token (`lgo_`), which is accepted
only by `mcpMessage` and the tool calls it dispatches. Every other operation answers it, whatever
the token's scope. Use an API key or the Legion web app.

`org_suspended`: the caller's organization is suspended. Every operation that takes a
credential answers it, by session or API key, except `getMe` (which shows `org.suspended_at` and
`org.suspension_reason`) and the support operations under `/v1/support/`.

`terms_not_accepted`: an approved caller who has not accepted
the current version of the Terms of Use and the Acceptable Use Policy. Every operation that takes a credential answers it, except `getMe`,
`acceptLegalDocuments`, `joinMyWaitlist` and the wind-down operations
(`listRentals`, `stopRental`, `deleteRental`, `listHosts`,
`updateListing` with `listed` false, `removeHost`); the problem
carries `legal`. An API key acts for the person who created it, so it
is refused until that person accepts. Terminal
operations also return
`session_required` (called with an API key) and `step_up_required`
(neither a sign-in nor a step-up challenge within the step-up window).

### 500

An unexpected server error. Safe to retry.

## Errors

- 403 [`no_organization`](https://legion.ambient.xyz/docs/errors#no_organization)

## Example request

```sh
curl -s "https://api.legion.ambient.xyz/v1/services/defaults" \
  -H "Authorization: Bearer $LEGION_API_KEY"
```
