Rent Hero SMS numbers
const url = 'https://api.clearance.rest/numbers/providers/herosms/rent';const options = { method: 'POST', headers: {'X-API-Key': '<X-API-Key>', 'Content-Type': 'application/json'}, body: '{"service":"tg","country":6}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.clearance.rest/numbers/providers/herosms/rent \ --header 'Content-Type: application/json' \ --header 'X-API-Key: <X-API-Key>' \ --data '{ "service": "tg", "country": 6 }'Opens one or more activations: gets a temporary number from Hero SMS and attaches it to your project. The rental lasts about 20 minutes. After that the number can no longer receive SMS and becomes RELEASED, though SMS it already received stay readable through GET /sms/wait.
Send quantity to rent several (1 to 20); the response is then always a numbers array with one result per activation, and one failing does not stop the others. Without quantity you get a single number.
Leave max_price out unless you need a hard budget cap. Without it, the service retries with a growing price ceiling until stock is found. Sending it disables those retries and tries exactly once.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
Service code, from GET /providers/herosms/services.
Hero SMS numeric country id.
How many numbers to rent. Changes the response to numbers[].
Hard upper price per activation. Disables automatic price escalation.
Restrict to one operator, from GET /providers/herosms/operators.
Comma-separated number prefixes to exclude (at most 20).
Example
{ "service": "tg", "country": 6}Responses
Section titled “Responses”Rented. The shape depends on whether quantity was sent.
object
object
The number’s id. Use it with POST /release.
The provider’s own id: Twilio’s PN… SID, or Hero SMS’s activation id. Not present on mobile numbers.
E.164 format.
Your project’s id.
Where a number stands for your project.
| Value | Meaning |
|---|---|
ACTIVE |
Usable. |
OFFLINE |
Mobile only: no signal from the phone for 30+ minutes (or ever). Does not block delivery. |
SIM_REMOVED |
Mobile only: the SIM is not in the phone. |
MOVED |
The number was attached to another project. |
RELEASED |
A Twilio number was deleted, or a Hero SMS activation finished or was cancelled. |
EXPIRED |
Hero SMS only: the rental time ran out and the number is about to become RELEASED. |
UNASSIGNED |
Detached from your project, or never attached. |
Human-readable reason for a non-ACTIVE status.
When the number was attached to your project, in milliseconds since the Unix epoch.
When it stopped being attached, in milliseconds since the Unix epoch.
Hero SMS only, on the rent response. When the rental ends.
Hero SMS only, on the rent response.
Hero SMS only, on the rent response.
Hero SMS only, on the rent response.
Hero SMS only, on the rent response.
Present on mobile numbers.
object
Where a number stands for your project.
| Value | Meaning |
|---|---|
ACTIVE |
Usable. |
OFFLINE |
Mobile only: no signal from the phone for 30+ minutes (or ever). Does not block delivery. |
SIM_REMOVED |
Mobile only: the SIM is not in the phone. |
MOVED |
The number was attached to another project. |
RELEASED |
A Twilio number was deleted, or a Hero SMS activation finished or was cancelled. |
EXPIRED |
Hero SMS only: the rental time ran out and the number is about to become RELEASED. |
UNASSIGNED |
Detached from your project, or never attached. |
Whether the SIM is in the phone.
Last signal from the phone, in milliseconds since the Unix epoch.
Present on Hero SMS numbers in GET /list.
object
object
object
object
The number’s id. Use it with POST /release.
The provider’s own id: Twilio’s PN… SID, or Hero SMS’s activation id. Not present on mobile numbers.
E.164 format.
Your project’s id.
Where a number stands for your project.
| Value | Meaning |
|---|---|
ACTIVE |
Usable. |
OFFLINE |
Mobile only: no signal from the phone for 30+ minutes (or ever). Does not block delivery. |
SIM_REMOVED |
Mobile only: the SIM is not in the phone. |
MOVED |
The number was attached to another project. |
RELEASED |
A Twilio number was deleted, or a Hero SMS activation finished or was cancelled. |
EXPIRED |
Hero SMS only: the rental time ran out and the number is about to become RELEASED. |
UNASSIGNED |
Detached from your project, or never attached. |
Human-readable reason for a non-ACTIVE status.
When the number was attached to your project, in milliseconds since the Unix epoch.
When it stopped being attached, in milliseconds since the Unix epoch.
Hero SMS only, on the rent response. When the rental ends.
Hero SMS only, on the rent response.
Hero SMS only, on the rent response.
Hero SMS only, on the rent response.
Hero SMS only, on the rent response.
Present on mobile numbers.
object
Where a number stands for your project.
| Value | Meaning |
|---|---|
ACTIVE |
Usable. |
OFFLINE |
Mobile only: no signal from the phone for 30+ minutes (or ever). Does not block delivery. |
SIM_REMOVED |
Mobile only: the SIM is not in the phone. |
MOVED |
The number was attached to another project. |
RELEASED |
A Twilio number was deleted, or a Hero SMS activation finished or was cancelled. |
EXPIRED |
Hero SMS only: the rental time ran out and the number is about to become RELEASED. |
UNASSIGNED |
Detached from your project, or never attached. |
Whether the SIM is in the phone.
Last signal from the phone, in milliseconds since the Unix epoch.
Present on Hero SMS numbers in GET /list.
object
Examples
{ "success": true, "number": { "sid": "c1aaeac1-ec52-44e2-b00a-d1350fb6bee6", "providerSid": "1234567890", "provider": "herosms", "phoneNumber": "+6281234567890", "friendlyName": "my-project", "smsUrl": null, "voiceUrl": null, "capabilities": { "voice": false, "sms": true, "mms": false, "fax": false }, "status": "ACTIVE", "statusReason": null, "expiresAt": 1785108360000, "serviceCode": "tg", "operator": "telkomsel", "cost": 0.2, "currency": "840" }}{ "success": true, "numbers": [ { "success": true, "number": { "sid": "c1aaeac1-ec52-44e2-b00a-d1350fb6bee6", "providerSid": "1234567890", "provider": "herosms", "phoneNumber": "+6281234567890", "status": "ACTIVE" } }, { "success": false, "error": "hero-sms NO_NUMBERS" } ]}service or country is missing.
Error envelope returned with a non-2xx status.
object
Human-readable error message.
Example
{ "success": false, "error": "invalid json body"}The X-API-Key header is missing or invalid.
Error envelope returned with a non-2xx status.
object
Human-readable error message.
Example
{ "success": false, "error": "geçersiz API anahtarı"}Renting a single number (no quantity) failed. With quantity, failures are reported per activation inside a 200.
Error envelope returned with a non-2xx status.
object
Human-readable error message.
Example
{ "success": false, "error": "invalid json body"}