# Remove a card

`DELETE https://evohub.io/api/v1/billing/payment-methods/{id}`

Part of the [Billing API](https://docs.evohub.io/billing.md) reference · operationId `removePaymentMethod`.

Removes a saved card. If it was the default and other cards remain,
the first remaining card becomes the default first. `remaining` is
how many cards are left.

With no card left and no credit, the organization is charged nothing
more but, once the month's free allowance is spent, its outbound
notifications stop after a grace period (see
`dispatch_grace_ends_at` on the summary).

Requires the `billing:payment:write` scope.

## Authorization

Any one of:

- `bearerKey`
- `headerKey`

Where:

- `bearerKey`: HTTP Bearer — An EvoHub API key (`evohub_…`) as a bearer token.
- `headerKey`: API key in the header `X-API-Key` — An EvoHub API key (`evohub_…`).

## Path parameters

- `id` (string, required, example `pm_1QExampleMc4444`): The card's ID, from the list of saved cards.

## Responses

### 200 — The card was removed.

Content type: `application/json`

Type: `object`

- `data` (object)
  - `remaining` (integer): Cards still saved.

### 401 — No API key was sent, or it is unknown, revoked or expired (`UNAUTHORIZED`).

Content type: `application/json`

Type: `Error`

- `error` (object, required)
  - `code` (string, required, example `STATEMENT_NOT_FOUND`)
  - `message` (string, required, example `No statement for that period.`)
  - `request_id` (string)

### 403 — The key lacks the scope this endpoint needs (`FORBIDDEN`).

Content type: `application/json`

Type: `Error`

- `error` (object, required)
  - `code` (string, required, example `STATEMENT_NOT_FOUND`)
  - `message` (string, required, example `No statement for that period.`)
  - `request_id` (string)

### 404 — The card is not saved for this organization (`CARD_NOT_FOUND`).

Content type: `application/json`

Type: `Error`

- `error` (object, required)
  - `code` (string, required, example `STATEMENT_NOT_FOUND`)
  - `message` (string, required, example `No statement for that period.`)
  - `request_id` (string)

### 429 — Too many requests (`RATE_LIMITED`). Wait for `Retry-After` seconds.

Headers:

- `Retry-After` (integer): Seconds to wait before retrying.

Content type: `application/json`

Type: `Error`

- `error` (object, required)
  - `code` (string, required, example `STATEMENT_NOT_FOUND`)
  - `message` (string, required, example `No statement for that period.`)
  - `request_id` (string)

### 502 — The payment provider did not accept the change (`CARD_UPDATE_FAILED`). Retry later.

Content type: `application/json`

Type: `Error`

- `error` (object, required)
  - `code` (string, required, example `STATEMENT_NOT_FOUND`)
  - `message` (string, required, example `No statement for that period.`)
  - `request_id` (string)

### 503 — Payments are not enabled on this environment (`PAYMENTS_DISABLED`).

Content type: `application/json`

Type: `Error`

- `error` (object, required)
  - `code` (string, required, example `STATEMENT_NOT_FOUND`)
  - `message` (string, required, example `No statement for that period.`)
  - `request_id` (string)

## Example request

```bash
curl -X DELETE 'https://evohub.io/api/v1/billing/payment-methods/pm_1QExampleMc4444' \
  -H 'Authorization: Bearer <TOKEN>'
```
