Skip to main content

Getting Started with the GlowSMS REST API

Updated 7 min readMarkdown

The GlowSMS REST API enables developers to programmatically purchase temporary non-VoIP phone numbers, receive SMS verification codes, and manage verification orders without manually interacting with a web dashboard.

GlowSMS supports 180+ countries and 500+ online services, with real-time number availability, pay-per-use pricing, and automated refunds for eligible unsuccessful orders.

This tutorial walks through the complete API workflow using cURL, from checking your account balance to receiving a verification code and managing the order lifecycle.

Prerequisites

Before making your first API request, you will need:

  • A GlowSMS account
  • A valid API key
  • Sufficient account balance
  • A terminal with cURL installed
  • Basic familiarity with HTTP requests and JSON

You can access the official GlowSMS API documentation for detailed endpoint specifications and integration requirements.

Step 1: Configure Your API Credentials

The base URL for the GlowSMS REST API is:

https://glowsms.com/api/v1

Authenticated requests require a Bearer token in the Authorization header.

Store your API key and base URL in environment variables:

export GLOWSMS_API_KEY="YOUR_API_KEY"
export GLOWSMS_BASE_URL="https://glowsms.com/api/v1"

This allows you to reuse your credentials throughout the tutorial without including the actual API key in every command.

In production environments, API credentials should be stored securely on the server side. Never expose API keys in frontend applications, public repositories, or application logs.

Step 2: Check Your Account Balance

Before purchasing a number, check whether your account has sufficient funds.

Endpoint: GET /balance

curl "$GLOWSMS_BASE_URL/balance" \
  -H "Authorization: Bearer $GLOWSMS_API_KEY"

Checking your balance is particularly useful before creating orders in automated workflows.

Website purchases and API purchases use the same GlowSMS account balance.

Step 3: List Supported Services

Retrieve the available services through the services endpoint.

Endpoint: GET /services

curl "$GLOWSMS_BASE_URL/services" \
  -H "Authorization: Bearer $GLOWSMS_API_KEY"

GlowSMS supports more than 500 online services.

Use the service identifiers returned by the API when requesting offers or creating orders, rather than assuming that a service's display name matches its API identifier.

Step 4: Check Number Availability and Pricing

Before purchasing a number, retrieve the available offers for your selected country and service.

Endpoint: GET /offers

curl "$GLOWSMS_BASE_URL/offers?service=google&country=us" \
  -H "Authorization: Bearer $GLOWSMS_API_KEY"

Both query parameters are required.

Parameter Description Example
service Supported service identifier google
country Lowercase ISO country code us

Number availability and pricing vary by country, service, and current inventory.

Applications should retrieve current offers before creating an order instead of relying on previously cached prices.

Step 5: Create an SMS Verification Order

Once you have selected a suitable country and service, create an order.

Endpoint: POST /orders

curl -X POST "$GLOWSMS_BASE_URL/orders" \
  -H "Authorization: Bearer $GLOWSMS_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: b3f1c9a2-6c1e-4a2b-9f77-2a5d3e8c1d90" \
  -d '{"service":"google","country":"us"}'

The request specifies the desired service and country.

If the optional cost parameter is omitted, GlowSMS selects the lowest-priced available offer for that combination.

Important: This request creates a real order and deducts funds from your account balance.

Preventing Duplicate Purchases with Idempotency

Network failures can occur after a server has processed a purchase but before the client receives a response.

Retrying an order creation request without appropriate safeguards may result in an unintended duplicate purchase.

GlowSMS supports the Idempotency-Key header to help prevent this.

  • Generate a new unique key for each intended purchase.
  • Reuse the same key when retrying that purchase after a network timeout.
  • Never reuse the example key above for unrelated purchases.

This is particularly important for production applications where requests may be retried automatically.

After successfully creating an order, retain the returned order identifier and phone number.

Step 6: Retrieve the SMS Verification Code

After requesting a verification code through an authorized verification workflow, retrieve the corresponding order.

Endpoint: GET /orders/{id}

curl "$GLOWSMS_BASE_URL/orders/ord_a1b2c3d4e5" \
  -H "Authorization: Bearer $GLOWSMS_API_KEY"

Replace ord_a1b2c3d4e5 with the actual order identifier returned when creating your order.

Applications can check the order every 3–5 seconds while respecting the order expiration time and applicable API limits.

When the order status becomes active, the code field contains the received verification code.

Understanding Order States

Status Description
active A verification code has been received
completed The order has been completed
cancelled The order has been cancelled
timed_out The order has expired

Stop polling when the verification code becomes available or the order reaches a terminal state.

Verification codes should be treated as sensitive information and should not be exposed in application logs, analytics events, or error reports.

Step 7: Complete the Order

After receiving and using the verification code, complete the order.

Endpoint: POST /orders/{id}/finish

curl -X POST "$GLOWSMS_BASE_URL/orders/ord_a1b2c3d4e5/finish" \
  -H "Authorization: Bearer $GLOWSMS_API_KEY"

Completing the order allows your application to explicitly close the verification workflow.

Step 8: Cancel an Unsuccessful Order

If a verification code has not arrived, eligible orders can be cancelled through the API.

Endpoint: POST /orders/{id}/cancel

curl -X POST "$GLOWSMS_BASE_URL/orders/ord_a1b2c3d4e5/cancel" \
  -H "Authorization: Bearer $GLOWSMS_API_KEY"

Cancellation is subject to the following conditions:

  • Orders cannot be cancelled within the first 120 seconds after purchase.
  • Attempting to cancel during this period returns cannot_cancel.
  • Orders that have already received a verification code are not eligible for a refund.

Eligible orders that expire without receiving a verification code are automatically refunded.

For complete refund eligibility requirements, refer to the GlowSMS Refund Policy.

API Endpoint Reference

The following table summarizes the endpoints covered in this tutorial.

Method Endpoint Purpose
GET /balance Check account balance
GET /services Retrieve supported services
GET /offers Check availability and pricing
POST /orders Purchase a phone number
GET /orders/{id} Retrieve order details and SMS code
POST /orders/{id}/finish Complete an order
POST /orders/{id}/cancel Cancel an eligible order

All endpoints are relative to the GlowSMS API base URL.

Handling API Errors

A reliable integration should account for unsuccessful requests and unexpected network conditions.

Common scenarios include:

  • Invalid or missing API credentials
  • Insufficient account balance
  • Invalid service or country parameters
  • Unavailable phone numbers
  • Network timeouts
  • API rate limits
  • Orders that are no longer eligible for cancellation

Applications should inspect HTTP status codes and documented error responses before deciding whether to retry a request.

For purchase requests, always preserve the original idempotency key when retrying the same intended transaction.

Avoid unlimited retries and stop checking orders once they reach a terminal state.

Production Integration Best Practices

When integrating the GlowSMS REST API into a production application:

  • Keep API credentials on the server side.
  • Use HTTPS for all API requests.
  • Check current availability before purchasing numbers.
  • Generate unique idempotency keys for new purchases.
  • Implement bounded retries and appropriate request timeouts.
  • Track order identifiers and expiration times.
  • Avoid storing unnecessary SMS verification data.
  • Respect third-party platform policies and use the API only for authorized verification workflows.

Pricing and Payment Options

GlowSMS operates on a pay-per-use pricing model without monthly subscriptions or recurring subscription fees.

Prices vary depending on the selected country, service, and available offers.

Supported payment methods include credit and debit cards, Apple Pay, Google Pay, Alipay, and cryptocurrency. A cryptocurrency wallet is not required to use GlowSMS.

Conclusion

The GlowSMS REST API provides a complete workflow for managing temporary phone numbers and SMS verification programmatically.

Developers can check their balance, discover supported services, retrieve current offers, create orders, receive verification codes, and manage the order lifecycle through a consistent REST API interface.

For further information, explore the official GlowSMS developer resources:

For technical assistance, contact support@glowsms.com.

Published by the official GlowSMS Developer Blog.

About the author

  • GlowSMS is an online SMS verification platform providing temporary non-VoIP phone numbers for receiving one-time passwords (OTP) and verification codes across 180+ countries and 500+ supported services. GlowSMS offers pay-per-use pricing, real-time number availability, a private SMS dashboard, and automated refunds for eligible unsuccessful orders. The platform provides a REST API for developers to integrate SMS verification and order management into their applications. Official website: https://glowsms.com API Documentation: https://glowsms.com/api/docs

No comments yet. Be the first to comment.