# Create a corrected port-in request `POST /profiles/{profileReference}/esims/{esimReference}/port-ins` Creates and submits a new port-in request for the eSIM. Use this after a previous request ended `rejected`, `failed`, or `cancelled` (e.g. with corrected donor details), or to start porting on an eSIM that can still port (see the Porting tag). The previous terminal request is superseded (marked abandoned), so only the newest request is ever live. Rejected when the eSIM can no longer port, when a request is still in progress, or when the eSIM's porting was abandoned. For the initial port-in, prefer the `portIn` block on `POST /esims` — it guarantees an eSIM that waits for its port cannot activate before the port-in is registered. Any `numberRegistration` supplied with that initial order carries over to a corrected request automatically, tracking the corrected number; this endpoint takes no registration details of its own. Requires OAuth2 client-credentials authentication: send `Authorization: Bearer {token}`. ## Path parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `profileReference` | string | Yes | Profile reference | | `esimReference` | string | Yes | eSIM reference | ## Header parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `X-Idempotency-Key` | string | No | Optional idempotency key for requests that change state. If provided, duplicate requests with the same key within 48 hours will return the cached original response without duplicating side effects. **Behavior:** - Same key + same method, path and request body → returns cached response (prevents duplicate operations) - Same key + different method, path or request body → returns 422 error - Same key + in-flight request → returns 423 error - Keys are held for at least 48 hours; use a fresh key for every new request **Request Body Matching:** Request bodies are compared by their JSON content. Object key order, including in nested objects, and whitespace do not affect matching. This means: - `{"a":1,"b":2}` and `{"b":2,"a":1}` are treated as identical ✓ - Whitespace differences are ignored ✓ - The method and the full path, query included, must match as well; headers are not compared **Best Practices:** - Use UUIDs or client-generated unique strings - Store keys on your side to support retries - Don't reuse keys across different operations | ## Request body (application/json) | Field | Type | Required | Description | | --- | --- | --- | --- | | `msisdn` | string | Yes | The number to port, in international format (E.164 without a leading `+`) — i.e. the country code, not the national `0` trunk prefix. Belgium: `324` + 8 digits, e.g. `32470123456`; Netherlands: `316` + 8 digits, e.g. `31612345678`. | | `details` | one of Donor SIM or account | Account or SMS code | Yes | Donor details of the number to port. Their shape is the one the selected eSIM's variant takes: proof by the donor SIM, or by the customer's account number with SMS confirmation without one. Unknown fields are rejected. | | `details.Donor SIM or account` | object | No | Donor details proven by the donor SIM or the account. A `prepaid` contract takes `donorIccid` and/or `donorSimNumber`; a `postpaid` contract any of `donorIccid`, `donorSimNumber` and `donorAccountNumber`; a `business` contract `donorAccountNumber` only. | | `details.Donor SIM or account.donorContractType` | string | Yes | Contract type of the number at the donor operator | | `details.Donor SIM or account.donorIccid` | string | No | ICCID of the donor SIM card, with a valid check digit. The preferred proof of a donor SIM: most donor operators accept it. | | `details.Donor SIM or account.donorSimNumber` | string | No | The number printed on the donor SIM card. Send it only when the donor SIM's ICCID is not available; `donorIccid` is accepted by more donor operators. | | `details.Donor SIM or account.donorAccountNumber` | string | No | Account/customer number at the donor operator | | `details.Account or SMS code` | object | No | Donor details proven by the account, or by SMS without one. A `postpaid` contract requires `donorAccountNumber` and `donorContractAction`; a `prepaid` one refuses `donorContractAction`. Without `donorAccountNumber`, the customer confirms the port-in with a code sent by SMS to the number being ported. The request stays `requested` until they do; an unconfirmed code expires after 24 hours and the port-in is rejected. | | `details.Account or SMS code.donorContractType` | string | Yes | Contract type of the number at the donor operator | | `details.Account or SMS code.donorAccountNumber` | string | No | Customer number at the donor operator | | `details.Account or SMS code.donorContractAction` | string | No | [Extensible enum](https://opensource.zalando.com/restful-api-guidelines/#112). What happens to the customer's contract at the donor operator. Required for a `postpaid` contract and refused for a `prepaid` one, which has no contract to end or keep. `terminate_at_expiry` ends it where it can end; the donor may refuse the port while a commitment period runs. `terminate_early` ends it even during a commitment period, which may cost the customer an early-termination fee at the donor. `keep_with_new_number` keeps the contract running at the donor under a new number. | ```json { "msisdn": "32470123456", "details": { "donorContractType": "postpaid", "donorIccid": "8932031234567890128" } } ``` ## Example request ```bash curl 'https://connect.test.firsty.app/api/v3/profiles/{profileReference}/esims/{esimReference}/port-ins' \ --request POST \ --header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \ --header 'Content-Type: application/json' \ --header 'X-Idempotency-Key: ' \ --data '{ "msisdn": "32470123456", "details": { "donorContractType": "postpaid", "donorIccid": "8932031234567890128" } }' ``` ## Responses ### 201 — Port-in request created and submitted Example: Created and submitted ```json { "data": { "portInRequestReference": "B6T3J9WQ", "profileReference": "1234567890123456", "esimReference": "123456000000000001", "msisdn": "32470123456", "details": { "donorContractType": "postpaid", "donorIccid": "8932031234567890128" }, "status": "requested", "scheduledAt": null, "submittedAt": "2026-10-26T12:01:31Z", "completedAt": null, "abandoned": false, "createdAt": "2026-10-26T12:01:30Z", "updatedAt": "2026-10-26T12:01:31Z" } } ``` ### 400 — Validation failed (number format, donor detail rules for the eSIM variant) ```json { "type": "https://developers.firsty.app/errors/not_found", "title": "Not found", "status": 404, "detail": "eSIM not found", "code": "bad_request" } ``` ### 401 — Unauthorized - missing or invalid API key ### 403 — Forbidden - client does not have access to this resource ### 404 — Resource not found ### 409 — eSIM can no longer port, its number has already been ported, or the latest request was abandoned (`invalid_state_transition`), a non-terminal request exists (`port_in_pending`), or its phone number is being swapped or another change to it is in progress (`esim_change_pending`) ```json { "type": "https://developers.firsty.app/errors/not_found", "title": "Not found", "status": 404, "detail": "eSIM not found", "code": "bad_request" } ``` ### 422 — The eSIM variant does not support porting (`porting_not_supported`), or an idempotency key was reused for a different request (`idempotency_key_reused`) ```json { "type": "https://developers.firsty.app/errors/not_found", "title": "Not found", "status": 404, "detail": "eSIM not found", "code": "bad_request" } ``` ### 423 — A request with this idempotency key is still being processed ### 429 — Rate limit exceeded. A `429` can also arrive without these headers or this body; handle it by its status code. ### 500 — Internal server error