# Delete a custom pattern for a workspace

> Delete a custom pattern.

<div class="g1t-endpoint"><span class="g1t-method" data-method="delete">DELETE</span><code>/workspaces/{workspace}/secret-scanning/custom-patterns/{id}</code></div>

Alerts it found stay.

- **Authentication:** Required. Send an [access token](/reference/api/#authentication) as `Authorization: Bearer`.
- **MCP tool:** [`security`](/reference/mcp/#security) with `action` `delete_pattern`, and the same inputs
- **Scope:** An access token needs [`security:write`](/guides/authentication/#scopes).
- **Also at:** [`DELETE /repos/{owner}/{name}/secret-scanning/custom-patterns/{id}`](/reference/api/secret-scanning/delete-custom-pattern/)

## Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `workspace` | string | Yes | Instead of repo: the workspace's slug, for all of it (or its own, for patterns). |
| `id` | string | Yes | The pattern's id: pat_… |

## Example request

```sh
curl -X DELETE https://api.g1t.sh/workspaces/flagon-io/secret-scanning/custom-patterns/pat_01kq2p9f6g7h8j9k0m1n2p3q4r \
  -H "Authorization: Bearer $G1T_TOKEN"
```

## Example response

A successful request answers `200` with:

```json
{
  "deleted": true
}
```

## Errors

A failed request answers with one of these statuses and a body like `{"error": {"code": "not_found", "message": "Repository not found."}}`. See [errors](/reference/api/#errors).

| Status | Code | When |
| --- | --- | --- |
| 401 | `unauthenticated` | A token is required, or the one sent is not valid. |
| 403 | `forbidden` | The token is valid but not allowed to do this, such as a member-only change or an agent token outside its repository. |
| 404 | `not_found` | It does not exist, or you cannot see it. |
| 409 | `conflict` | The request conflicts with the current state. |
| 422 | `invalid` | The input is not valid. `message` says which field and why. |
