# Delete an organization secret

`DELETE /v1/orgs/{orgId}/secrets/{secretName}`

Deletes an organization secret and every project link to it. Deployments that reference it stop receiving it on their next deploy.

## Path parameters

- `orgId` (integer, required): The org id from GET /v1/orgs. Minimum: `1`.
- `secretName` (string, required): The name of the secret

## Header parameters

- `Authorization` (string, required): `Bearer <token>`. [Authentication](https://spice.ai/docs/cloud/api/management#authentication) lists the tokens it accepts.
- `X-Org-Name` (string, optional): When present, X-Org-Name must name the same org as orgId. Otherwise the request returns org\_path\_mismatch (400). Pattern: `^[A-Za-z0-9._-]{1,255}$`.

## Example request

```bash
curl -X DELETE "https://api.spice.ai/v1/orgs/<orgId>/secrets/<secretName>" \
  -H "Authorization: Bearer <token>"
```

```http
DELETE /v1/orgs/<orgId>/secrets/<secretName> HTTP/1.1
Host: api.spice.ai
Authorization: Bearer <token>
```

## Responses

**204 No Content**

Secret deleted

**400 Bad Request**

Invalid org id (`invalid_org_id`), X-Org-Name does not name that org (`org_path_mismatch`), or invalid secret name

**401 Unauthorized**

Unauthorized

**403 Forbidden**

Insufficient scope (requires secrets:write), the caller is not an admin or owner, or not a member of the organization (`org_forbidden`), a machine credential named an organization other than its own (`org_assertion_mismatch`), or the organization a machine credential is bound to has been deleted (`org_deleted`)

**404 Not Found**

Secret not found

**500 Internal Server Error**

Internal server error

OpenAPI: [api.spice.ai/openapi.json](https://api.spice.ai/openapi.json)
