How to cancel a port-in order
Effortlessly cancel your number port order with Telnyx's Cancel Port Order documentation. Discover step-by-step instructions, resources, and best practices for smoothly canceling a number port-in process.
If you decide that you want to cancel your port order after submitting it, then you can use the following command to do so.
This will transition the port order into a cancel-pending status.
Request Samples 
Don't forget to update YOUR_API_KEY here.
curl --location --request POST 'https://api.telnyx.com/v2/porting_orders/{{id}}/actions/cancel' \
--header 'Authorization: Bearer YOUR_API_KEY'
Afterwards, you can expect the following webhook:
{
  "data": {
    "event_type": "porting_order.status_changed",
    "id": "73f31498-030a-44a2-9331-0d4cb3a7a766",
    "occurred_at": "2021-03-19T19:49:19.406853Z",
    "payload": {
      "customer_reference": "1-alpha-2-bravo-3-charlie",
      "id": "3594c6c3-51a7-4306-b715-ca3765f13464",
      "status": {
        "details": [],
        "value": "cancel-pending"
      },
      "support_key": "sr_98f022",
      "updated_at": "2021-01-19T19:49:18+00:00",
      "webhook_url": "https://example.com/c49bf044-2ab6-46ee-a148-f8eb40afbd78"
    },
    "record_type": "event"
  },
  "meta": {
    "attempt": 1,
    "delivered_to": "https://example.com/c49bf044-2ab6-46ee-a148-f8eb40afbd78"
  }
}
The port-in order will remain in a cancel-pending status until Porting Ops reviews and cancels the order. When that happens, the port-in order will transition into a cancelled status and you will receive the following webhook:
{
  "data": {
    "event_type": "porting_order.status_changed",
    "id": "f0700172-d201-41f7-8be0-f3c08019432f",
    "occurred_at": "2021-03-19T19:55:54.357004Z",
    "payload": {
      "customer_reference": "1-alpha-2-bravo-3-charlie",
      "id": "3594c6c3-51a7-4306-b715-ca3765f13464",
      "status": {
        "details": [],
        "value": "cancelled"
      },
      "support_key": "sr_98f022",
      "updated_at": "2021-03-19T19:55:53+00:00",
      "webhook_url": "https://example.com/c49bf044-2ab6-46ee-a148-f8eb40afbd78"
    },
    "record_type": "event"
  },
  "meta": {
    "attempt": 1,
    "delivered_to": "https://example.com/c49bf044-2ab6-46ee-a148-f8eb40afbd78"
  }
}
Canceling within 48 hours of the FOC date/time 
If you try to cancel a port-in order within 48 hours of the FOC date/time, the API request will fail. You will need to reach out to customer support directly to have the port order canceled.
Request:
curl --location --request POST 'https://api.telnyx.com/v2/porting_orders/{{id}}/actions/cancel' \
--header 'Authorization: Bearer [REDACTED]'
Response:
{
    "errors": [
        {
            "detail": "'foc_datetime_actual' is within 48 hours from now. Please open a ticket with our support team for further assistance",
            "source": {
                "pointer": "/foc_datetime_actual"
            },
            "title": "Porting Order can't be cancelled at this time"
        }
    ]
}