# Delete a Playground solution

```http
DELETE /api/public/v1/competitions/lean-kernel-challenge/playground/solutions/{solutionId}
```

**Scope**: `playground.write`.

Permanently removes an owned private Solution and its complete Workspace. The `solutionId` must identify an owned Solution from [List saved solutions](./list-playground-solutions.md).

Deleting does not alter any immutable record created from the Solution: existing [practice Runs](./list-playground-runs.md), their [execution snapshots and downloads](./download-playground-run.md), formal submissions, and [Contributor Network publication snapshots](./download-contributor-package.md) remain available and unchanged.

The caller must be enrolled and the Playground must be open for new work, matching the write admission of [Save a Playground solution](./save-playground-solution.md). Deletion is therefore unavailable after the Playground closes; retained owner-authorized reads continue to work.

## Path parameter

| Parameter | Type, requirement, and meaning |
| :--- | :--- |
| `solutionId` | **Required string.** Stable opaque Solution ID returned by [List saved solutions](./list-playground-solutions.md). Pass it through unchanged. An ID that is not a valid opaque ID returns the same `404 NOT_FOUND` as a missing Solution. |

## Example request

```bash
export SAIR_API_BASE="https://api.sair.foundation/api/public/v1"

curl -X DELETE \
  "$SAIR_API_BASE/competitions/lean-kernel-challenge/playground/solutions/17" \
  -H "Authorization: Bearer $SAIR_API_KEY"
```

## Successful response

```http
HTTP/1.1 204 No Content
```

The response has no body. `204` confirms that the Solution and its Workspace were deleted.

## Publication lock

A Solution with `published: true` cannot be deleted until its [Contributor Network package is withdrawn](./withdraw-contributor-package.md). A publication still being created can also block deletion even though the list response has no separate `publishing` state; the `409` response reports `details.publicationState` as `publishing` or `published`.

## Uncertain responses and repeats

This operation does not use an `idempotencyKey`. After a successful deletion, repeating the same request returns `404 NOT_FOUND` because the Solution no longer exists.

If a timeout or connection failure leaves the result uncertain, do not blind-retry aggressively: re-read [the Solution list](./list-playground-solutions.md) and confirm whether the `solutionId` still appears before retrying.

## Effects

- The Solution immediately stops appearing in subsequent list responses and cannot be re-read, updated, or used to create new Runs.
- Existing Runs keep their exact revision, verdicts, measurements, and downloads. They are self-contained immutable snapshots.
- Formal submissions and their stored candidates are unchanged.
- A published Solution must be withdrawn before deletion.
- The per-Problem Solution count used by `SOLUTION_LIMIT_REACHED` is released.

## Errors

| Error | When |
| :--- | :--- |
| `403 ENROLL_REQUIRED` | The caller is not enrolled in the Competition. |
| `403 PLAYGROUND_NOT_STARTED` | The Playground has not opened for new work. |
| `403 PLAYGROUND_READ_ONLY` | The Playground is closed or disabled for new work. |
| `404 NOT_FOUND` | The Competition is not visible, or the Solution is missing, not owned by the caller, or has an invalid `solutionId`. |
| `409 SOLUTION_PUBLICATION_LOCKED` | The Solution is in `publishing` or `published` state. `details.publicationState` identifies the lock. |
| `502 PLATFORM_UNAVAILABLE` | Competition visibility, lifecycle, or enrollment cannot be verified. |
| `502 PLAYGROUND_CONFIGURATION_INVALID` | The authoritative Playground lifecycle configuration is invalid. |
| `500 SOLUTION_STORE_FAILED` | The Solution deletion could not be confirmed. Check your saved Solutions before retrying. |
| `503 SOLUTION_STORE_BUSY` | The Solution store is temporarily busy; re-read the Solution before deciding whether to retry. |

See [Errors](../../../errors.md) for shared authentication, scope, and account-rate-limit errors.
