---
title: "Ask for another code, or another number"
method: POST
path: "/api/v1/orders/{id}/retry"
tags: ["Orders"]
---

# Ask for another code, or another number

`POST /api/v1/orders/{id}/retry`

## Request

- Base URL: `https://virtualsms.io`
- URL: `https://virtualsms.io/api/v1/orders/{id}/retry`
- Auth: one of:
  - API key in header `X-API-Key`
  - API key in query parameter `api_key`

What this does depends on the order, and the response shape follows it:

- **Resend** — the same number is asked for a fresh code. Response
  carries `message`.
- **Swap** — the order keeps its id but gets a **new number**. Response
  carries `phone_number` and a refreshed `expires_at`. `can_swap_number`
  on the order tells you in advance which behaviour you will get.

Valid only while the order is `waiting` or `created`.

Also served as `POST /api/v1/order/{id}/retry`.

## Path parameters

- `id` string, uuid, required

## Request body

- object
  - `swap_to_standard` boolean: Only meaningful on an order eligible for a number swap: ask for a Standard replacement instead of a like-for-like one. The price difference is credited to your balance and returned as `credit`.

## Response `200`

Accepted. Which fields are present depends on whether the order
resent to the same number or was given a new one.

- object
  - `success` boolean
  - `order_id` string, uuid
  - `message` string: Present on a resend.
  - `phone_number` string: Present when the number was swapped — this is the new one.
  - `expires_at` string: Present when the number was swapped.
  - `credit` number, float: Present on a `swap_to_standard` downgrade.
  - `balance` number, float: Present on a `swap_to_standard` downgrade.

## Other responses

- `400`: The order is not in a retryable state, or this order type has no retry path.
- `404`: Order not found, or not yours
- `502`: Upstream refused the request for a new code

---

[API](https://skmtc.dev/virtualsms/apis/virtualsms-account-verification-platform-for-developers-and.md) · [All operations](https://skmtc.dev/virtualsms/apis/virtualsms-account-verification-platform-for-developers-and/llms.txt) · [OpenAPI document](https://skmtc.dev/virtualsms/apis/virtualsms-account-verification-platform-for-developers-and/revisions/be89af981be1?raw)
