# Cancel a port request

`POST https://api.morevoice.ai/v1/ports/{id}/cancel`

Withdraws a port that has not completed (`cancellable`; a rejected port can be closed this way too). A completed or already cancelled port answers 409. Cancel well before the `port_date`: once the carrier moved the numbers it can't be undone here.

Authenticate with a secret API key: `Authorization: Bearer $MOREVOICE_API_KEY`.

Operation ID: `ports_cancel`.

## Parameters

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | yes | A porting order ID (`port_…`). |

### Headers

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `MoreVoice-Version` | `string` | no | The API version to use for this request. Defaults to the version the API key is pinned to. |
| `Idempotency-Key` | `string` | no | A unique key (for example a UUID) that makes this request safe to retry: for 24 hours, a retry with the same key and parameters returns the first response instead of acting twice. |

## Responses

### 200 OK

OK Returns `PortingOrder`.

| Field | Type | Description |
| --- | --- | --- |
| `object` | `"porting_order"` | — |
| `id` | `string` | A porting order ID (prefix `port_`). |
| `livemode` | `boolean` | `true` in live mode, `false` in test mode. |
| `status` | `"draft" \| "submitted" \| "in_review" \| "submitted_to_carrier" \| "docs_required" \| "scheduled" \| "completed" \| "rejected" \| …` | `submitted` (sent, waiting for our review) → `in_review` (our staff check the request and its documents) → `submitted_to_carrier` (waiting for the carrier's date) → `scheduled` (`port_date` is set) → `completed` (the numbers are your phone numbers). Or `docs_required` (another document is needed: fix it in the app), `rejected` (`rejection_reason`) or `cancelled`. `draft`: created in the app and not sent yet. |
| `numbers` | `string[]` | The numbers to move (E.164). |
| `current_carrier` | `string \| null` | The provider the numbers are with today. |
| `requested_date` | `string \| null` | The date you asked for (YYYY-MM-DD); the real date is the carrier's (`port_date`). |
| `port_date` | `string \| null` | When the numbers move: set once the carrier scheduled it (`scheduled`). |
| `rejection_reason` | `string \| null` | Why the port was rejected (`rejected` only). |
| `documents` | `object` | — |
| `documents.loa` | `boolean` | The signed letter of authorization is on file. |
| `documents.invoice` | `boolean` | The latest invoice from the current provider is on file. |
| `estimate_business_days` | `object \| null` | How long such a port usually takes, in business days (an estimate, not a promise). |
| `estimate_business_days.min` | `integer` | — |
| `estimate_business_days.max` | `integer` | — |
| `cancellable` | `boolean` | POST /v1/ports/{id}/cancel is still possible. |
| `source` | `"app" \| "api"` | Where it was filed: in the app (Phone numbers → Port your numbers) or through this API. |
| `timeline` | `object[]` | Each change of `status`, oldest first. |
| `submitted_at` | `string \| null` | — |
| `completed_at` | `string \| null` | — |
| `created` | `string` | An ISO-8601 timestamp in UTC. |
| `updated` | `string` | An ISO-8601 timestamp in UTC. |

Example:

```json
{
  "cancellable": true,
  "completed_at": null,
  "created": "2026-11-23T09:00:00.000Z",
  "current_carrier": "Bezeq",
  "documents": {
    "invoice": true,
    "loa": true
  },
  "estimate_business_days": {
    "max": 10,
    "min": 7
  },
  "id": "port_4KqLm8XzT2vR9bYc1NdWe",
  "livemode": true,
  "numbers": [
    "+97235550100",
    "+972775556789"
  ],
  "object": "porting_order",
  "port_date": null,
  "rejection_reason": null,
  "requested_date": "2026-12-01",
  "source": "api",
  "status": "in_review",
  "submitted_at": "2026-11-23T09:00:00.000Z",
  "timeline": [
    {
      "at": "2026-11-23T09:00:00.000Z",
      "note": null,
      "status": "submitted"
    },
    {
      "at": "2026-11-23T11:20:00.000Z",
      "note": null,
      "status": "in_review"
    }
  ],
  "updated": "2026-11-23T11:20:00.000Z"
}
```

### 400 Bad Request

The request is invalid: a parameter is missing, malformed or unknown, or the version header is unknown. Returns `ErrorEnvelope`.

### 401 Unauthorized

No valid API key was sent. Returns `ErrorEnvelope`.

### 403 Forbidden

The key may not do this (a missing scope, a plan limit, or a compliance block). Returns `ErrorEnvelope`.

### 404 Not Found

No object with this ID (in the path or the body) exists in this organisation and mode. Returns `ErrorEnvelope`.

### 409 Conflict

The request conflicts with the object's state, or the Idempotency-Key was reused with other parameters. Returns `ErrorEnvelope`.

### 429 Too Many Requests

Too many requests, or no call capacity right now. Retry after the Retry-After delay. Returns `ErrorEnvelope`.

### 500 Internal Server Error

Something went wrong on MoreVoice's side. Retry with the same Idempotency-Key. Returns `ErrorEnvelope`.

## Code samples

**TypeScript**

```ts
import MoreVoice from "@morevoice/sdk";

const mv = new MoreVoice(); // MOREVOICE_API_KEY from the environment

const portingOrder = await mv.ports.cancel("port_7Hk2Lm9Qp");
console.log(portingOrder);
```

**Python**

```python
from morevoice import MoreVoice

client = MoreVoice()  # MOREVOICE_API_KEY from the environment

porting_order = client.ports.cancel("port_7Hk2Lm9Qp")
print(porting_order)
```

**cURL**

```sh
curl -X POST https://api.morevoice.ai/v1/ports/port_7Hk2Lm9Qp/cancel \
  -H "Authorization: Bearer $MOREVOICE_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```
