# Archive or restore several study sets

Source: https://workroad.app/docs/api/archive-sets

`POST https://workroad.app/api/v1/sets/archive`

Archives up to 500 sets in one call, or restores them with `archived: false`. An archived set keeps its terms and review history but leaves reviews, practice and the study picker. Sets that aren't the user's, are in the trash or are already in that state are skipped. To retire every set of a course that is over, archive its subject instead (`PATCH /subjects/{subjectId}`).

- MCP tool: `archiveSets` on `https://workroad.app/api/mcp`
- Required scopes: sets:update
- Test mode: `POST https://workroad.app/api/test/v1/sets/archive` checks the request and returns the example response without changing anything.
- Next: `archiveSets` with `archived: false` restores them.

## Headers

- `Idempotency-Key`: string, optional, 1-255 visible ASCII characters. Makes the POST safe to retry: a retry with the same key and body replays the first response, and the same key with a different body returns 409 `idempotency_conflict`. Kept for 24 hours. Over MCP it is the `idempotencyKey` argument.

## Request body

JSON.

- `setIds`: array of string (uuid), required, 1-500 items. 1-500 study set ids.
- `archived`: boolean, required. `true` archives the sets, `false` restores them.

## Response

`200` OK

- `data`: object, required
  - `count`: integer, required. How many sets changed. Sets that aren't the user's, are in the trash or are already in that state are skipped.

### Example

```json
{
  "data": {
    "count": 1
  }
}
```

## Errors

Every error has the body `{ "error": { "code", "message", "details" } }`.

- `400`: Invalid body.
- `401`: Missing, invalid, disabled or expired API key
- `402`: `api_allowance_reached`: this month's API and AI app requests on the free plan are used up. `details` has `limit`, `used`, `resetsAt` and `upgradeUrl`. Nothing ran; WorkRoad Plus has no monthly limit.
- `403`: The API key lacks the required scope
- `404`: No endpoint exists at this path.
- `405`: Method not allowed. Use a method from the Allow header.
- `409`: The Idempotency-Key was reused with a different request body, or a request with the same key is still in progress.
- `429`: Rate limit exceeded. Wait for Retry-After before retrying. The rate-limit headers are absent when the key's own limiter rejected the request before the per-endpoint bucket check ran.
- `500`: Internal server error
