# Delete analysis

Delete one chart analysis for good and hide the channel post that shows it.

- Endpoint: `DELETE https://api.returning.ai/v1/analysis/{analysisId}`
- Section: Community / Chart analysis
- Authentication: `Authorization: Bearer <API_KEY>` (Community API key)
- Permission: `sendMessage` (Shown in the dashboard as "Send Messages")
- Retries: Safe to repeat; a repeat returns 404
- Guide: hand-written
- Verified: code, 2026-09-27
- Last updated: 26 Sep 2026
- Web page: https://docs.returning.ai/api-reference/chart-analysis/delete-analysis

## When to use this

- An analysis was posted by mistake, or with the wrong symbol or levels, and should come down.
- Your own tool removes an idea, and the community card should go with it.
- Clean up test cards from a chart channel.

**Instead:** Use [Update analysis](https://docs.returning.ai/api-reference/chart-analysis/update-analysis.md) instead to correct a pending analysis and keep its place in the channel.

**Can't be undone:** The analysis is removed, not archived. Afterwards Get analysis returns `404`, and it no longer appears in List analyses.

## Authentication

- Header: `Authorization: Bearer <API_KEY>`
- Permission: `sendMessage`

Use a Community API key with `sendMessage`, shown in the dashboard as Send Messages, and keep it on your server. This endpoint takes no `sender` and doesn't check who created the analysis, so only send IDs from your own community's analyses. Personal API keys are not accepted here and return `401`.

## Behaviour

Deleting removes the analysis for good and marks its channel post as deleted. No live update is sent, so members who already have the channel open may keep seeing the card until they reload. An analysis can be deleted in any status, not only `Pending`.

## Request

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `analysisId` | `string` | Yes | The analysis ID from Create analysis or List analyses. (24 hex characters) |

### Headers

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `Authorization` | `string` | Yes | Community API key with `sendMessage`. (`Bearer <API_KEY>`) |

### Example request

```bash
curl --request DELETE \
  --url https://api.returning.ai/v1/analysis/66f000000000000000000b01 \
  --header 'Authorization: Bearer <API_KEY>'
```

## Response

A `200` means the analysis is gone. The body repeats the ID in `data.analysisId`.

### Response fields

| Field | Type | Presence | Description |
| --- | --- | --- | --- |
| `status` | `string` | always | Result of the request. (`success`) |
| `statusCode` | `integer` | always | The HTTP status, repeated. |
| `message` | `string` | always | Human-readable summary. Do not branch on it. |
| `data` | `object` | always | The deleted analysis. |
| `data.analysisId` | `string` | always | The ID you deleted, as sent in the path. |

### Example response (200)

```json
{
  "status": "success",
  "statusCode": 200,
  "message": "Analysis deleted successfully",
  "data": {
    "analysisId": "66f000000000000000000b01"
  }
}
```

## Errors

These errors have no machine-readable code; branch on the HTTP status. The `401` for a missing or unknown key has `detail` and a `meta` object; the `401` for a missing permission has only `message`. Other errors carry `status`, `statusCode` and `message`.

### Fix the request

| Status | Code | What to do |
| --- | --- | --- |
| 400 | - | `analysisId` isn't a valid ID. Send the 24-character ID from Create analysis or List analyses. |
| 401 | - | The key is missing (`Token is require.`) or unknown (`Token is wrong.`), it's a personal key, or it lacks `sendMessage` (`Your API key does not have permission to access this action`). Send `Authorization: Bearer <API_KEY>` with a Community API key, and add Send Messages in Settings > Integration > API Keys. |

### Retry with backoff

| Status | Code | What to do |
| --- | --- | --- |
| 500 | - | The delete failed part way. Call Get analysis: if it returns `404` the analysis is gone; otherwise retry the delete with backoff. |

### Do not retry

| Status | Code | What to do |
| --- | --- | --- |
| 404 | - | No analysis has this ID. If you deleted it already, including on an earlier attempt that timed out, there is nothing left to do. |

**Retries:** Deleting is safe to repeat. Once the analysis is gone, the same request returns `404`, which you can treat as done. After a `500`, call Get analysis first: the analysis may already be removed.

## Next step

- [Confirm with List analyses](https://docs.returning.ai/api-reference/chart-analysis/list-analyses.md): `GET /v1/analysis/communities/{communityId}/channels/{channelId}`. Check that the analysis no longer appears in its channel.
- [Post a corrected card with Create analysis](https://docs.returning.ai/api-reference/chart-analysis/create-analysis.md): `POST /v1/analysis/{communityId}/channels/{channelId}`.
