Sandbox requests never reach a mobile network or charge your production wallet. You can test authentication, validation, pricing, idempotency, and message status flows.
Start in sandbox
New Textly accounts start with sandbox API access. In your dashboard, open the account menu → Developers to create a sandbox key. The full txt_test_ key appears only once, so copy it when you create it. Key management requires the account owner's session.
POST /api-keys
Authorization: Bearer YOUR_OWNER_SESSION
Content-Type: application/json
{ "name": "Development server", "environment": "sandbox" }Use GET /sandbox/senders to get a test Sender ID. Every account begins with TEXTLY; you can add another with POST /sandbox/senders and { "value": "MYBRAND" }. Use the returned id as senderId in API requests. Sandbox Sender IDs do not need network approval.
Send a test message
Call POST /sandbox/messages/quote with the send body to preview recipients, segments, cost, and wallet sufficiency. Then send the same body with a new Idempotency-Key:
POST /sandbox/messages
Authorization: Bearer txt_test_YOUR_KEY
Idempotency-Key: test-order-10482
Content-Type: application/json
{
"senderId": "SANDBOX_SENDER_UUID",
"messages": [
{ "recipient": "0712345678", "text": "Your order is on its way." }
]
}The response contains a request ID and message IDs in queued status. Repeating the same key and body returns the original response; changing the body with that key returns 409 Conflict. List test messages with GET /sandbox/messages?limit=50&offset=0.
Simulate delivery
Use a queued message ID from the send response to mark it delivered or failed:
POST /sandbox/messages/MESSAGE_UUID/simulate
Authorization: Bearer txt_test_YOUR_KEY
Content-Type: application/json
{ "status": "delivered" }A delivered result captures its virtual charge; a failed result refunds it. Only queued sandbox messages can be simulated. Sandbox simulations do not call your production delivery webhook.
Phone and replies
In Developers → Sandbox, enter a test phone number in the phone simulator to see messages addressed to it. The inbox groups conversations by test Sender ID. Type a reply in the simulated phone to create an incoming sandbox SMS; no handset is involved. You can also retrieve the conversation with GET /sandbox/phone?number=0712345678 and submit a reply with POST /sandbox/phone/reply using number, senderId, and body. Creating replies requires an owner session.
Sandbox callbacks
Configure a separate public HTTPS endpoint under Sandbox callback on the Developers page, or use PUT /sandbox/webhook with an owner session. Copy the signing secret when it appears. Textly signs sandbox callbacks with the same timestamp and HMAC headers as production, but the payload includes environment: "sandbox". Simulated replies create message.incoming events; simulated delivery results create message.delivered or message.failed events. Check recent attempts with GET /sandbox/webhook/events. Your production webhook receives only production events.
Wallet and limits
The sandbox wallet starts at KES 100. It uses your organization's current production price per SMS segment, including any admin-approved rate override, but holds only virtual funds. Check it with GET /sandbox/wallet. The owner can select Reset to KES 100 in Developers or call POST /sandbox/wallet/reset with an owner session. Resetting cancels queued test messages and does not affect the real wallet.
Sandbox sending allows up to 100 new requests per hour and 2,000 messages per rolling day per business. A wallet reset does not clear those limits.
Go live
When you are ready, activate production API access in Developers and create a separate txt_live_ key. Use the production /messages endpoints with an approved Sender ID and your real wallet. Administratively restricted accounts need support to restore access. Sandbox keys cannot call production send routes, and live keys cannot call sandbox routes.