# Work limits

> Bounds on outstanding admitted work under a run.

Source: https://docs.getrunstate.com/api/work-limits/

<!-- Generated by apps/docs/scripts/gen-api.mjs from packages/contracts/openapi.yaml. Do not edit. -->

All paths are relative to the API base URL (`https://api.getrunstate.com`) and require `Authorization: Bearer <api key>`. See [the API overview](https://docs.getrunstate.com/api/) for authentication, idempotency and the error envelope.

## GET /work-limits

```http
GET /v1/spaces/{spaceId}/work-limits
```

Read-only work-limit list with current outstanding counts.

- **Key permission:** `coordination_read`

**Path parameters**

| Name | Type | Notes |
| --- | --- | --- |
| `spaceId` | string (uuid) | required |

**Responses**

| Status | Meaning |
| --- | --- |
| `200` | Work limits |

```bash
curl -X GET "$RUNSTATE_BASE_URL/v1/spaces/$RUNSTATE_SPACE_ID/work-limits" \
  -H "Authorization: Bearer $RUNSTATE_API_KEY"
```

## POST /work-limits

```http
POST /v1/spaces/{spaceId}/work-limits
```

Configure an outstanding-work bound.

- **Key permission:** `resource_config`
- **Idempotency-Key header:** required
- **TypeScript SDK:** `rs.workLimits.ensure()`
- **Python SDK:** `rs.work_limits.ensure()`

**Path parameters**

| Name | Type | Notes |
| --- | --- | --- |
| `spaceId` | string (uuid) | required |

**Request body** (JSON)

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `name` | string | yes |  |
| `scopeId` | string (uuid) | yes |  |
| `maxOutstanding` | integer | yes | min 1 |

**Responses**

| Status | Meaning |
| --- | --- |
| `201` | Created work limit |
| `409` | Error envelope `{"error":{"code","message","requestId"}}` |

```bash
curl -X POST "$RUNSTATE_BASE_URL/v1/spaces/$RUNSTATE_SPACE_ID/work-limits" \
  -H "Authorization: Bearer $RUNSTATE_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"name":"<name>","scopeId":"<run id>","maxOutstanding":1}'
```
