> For the complete index of the 402pay docs, see [llms.txt](https://developer.402pay.co/llms.txt).

# Delete a link

Delete a link that has never taken a payment.

`DELETE https://dash.402pay.co/api/v1/links/{id}`

Only a link that has never had a payment can be deleted, so no payment loses its link. Archive any other link instead.

### Path

- `id` (string, required): The link's ID, such as `lnk_tDofQnHNbxq9jsyq`.

### Errors

- 404 `not_found` No link with that ID belongs to your business.
- 403 `test_mode_unavailable` A test key can't delete links on a live business, so use a live key.
- 409 `link_has_payments` The link has payments. Archive it instead.

Any request can also fail on its key or its body. See [errors](https://developer.402pay.co/api/errors.md).

Request, cURL:

```bash
curl -X DELETE "https://dash.402pay.co/api/v1/links/lnk_tDofQnHNbxq9jsyq" \
  -H "Authorization: Bearer $PAY402_SECRET_KEY"
```

Request, Node.js:

```js
const response = await fetch("https://dash.402pay.co/api/v1/links/lnk_tDofQnHNbxq9jsyq", {
  method: "DELETE",
  headers: {
    Authorization: `Bearer ${process.env.PAY402_SECRET_KEY}`,
  },
});
const { data } = await response.json();
```

Request, Python:

```python
import os

import requests

response = requests.delete(
    "https://dash.402pay.co/api/v1/links/lnk_tDofQnHNbxq9jsyq",
    headers={
        "Authorization": f"Bearer {os.environ['PAY402_SECRET_KEY']}",
    },
)
data = response.json()["data"]
```

Response, 200 OK:

```json
{
  "data": {
    "id": "lnk_tDofQnHNbxq9jsyq",
    "kind": "link",
    "deleted": true
  }
}
```
