Get Started

REST API: Sandbox

The Sandbox resource has been deprecated and may be removed in future versions of the Twilio API.

The Sandbox resource gives you programmatic access to your Twilio Developer Sandbox phone number. Using this resource you can get the phone number and PIN for your sandbox, view the current voice and SMS URLs and update those URLs just like any other IncomingPhoneNumber resource on a Full Twilio Account.

Sandbox Instance Resource

Resource URI

/2010-04-01/Accounts/{YourAccountSid}/Sandbox

Resource Properties

The Sandbox resource is represented by the following properties:

Property Description
DateCreated The date that this resource was created, given in RFC 2822 format.
DateUpdated The date that this resource was last updated, given in RFC 2822 format.
Pin An 8 digit number that gives access to this sandbox.
AccountSid The unique id of the Account connected to this sandbox.
PhoneNumber The phone number of the sandbox. Formatted with a '+' and country code e.g., +16175551212 (E.164 format).
ApplicationSid The 34 character sid of the Twilio Application associated with the sandbox.
ApiVersion Calls to the sandbox will start a new TwiML session with this API version.
VoiceUrl The URL Twilio will request when the sandbox number is called.
VoiceMethod The HTTP method to use when requesting the above URL. Either GET or POST.
SmsUrl The URL Twilio will request when receiving an incoming SMS message to the sandbox number.
SmsMethod The HTTP method to use when requesting the SmsUrl. Either GET or POST.
StatusCallback The URL that Twilio will request to pass status parameters (such as call ended) to your application.
StatusCallbackMethod The HTTP method Twilio will use to make requests to the StatusCallback URL. Either GET or POST.
Uri The URI for this resource, relative to https://api.twilio.com

HTTP GET

Returns the Sandbox resource associated with the account identified by {YourAccountSid}. Twilio accounts upgraded prior to February 2010 may not have a Sandbox resource, and in this case you will receive a 404 (Not Found) response.

Example
Try it now
  • GET /2010-04-01/Accounts/ACda6f1.../Sandbox

    <TwilioResponse>
        <TwilioSandbox>
            <Pin>63729915</Pin>
            <AccountSid>ACda6f1e31047ebd6fe7a55f120be3a900</AccountSid>
            <PhoneNumber>+14154132865</PhoneNumber>
            <ApplicationSid>AP1d510128c851af26b0a14d50b5577e69</ApplicationSid>
            <ApiVersion>2010-04-01</ApiVersion>
            <VoiceUrl>http://demo.twilio.com/welcome</VoiceUrl>
            <VoiceMethod>GET</VoiceMethod>
            <SmsUrl>http://demo.twilio.com/welcome/sms</SmsUrl>
            <SmsMethod>POST</SmsMethod>
            <StatusCallback/>
            <StatusCallbackMethod>POST</StatusCallbackMethod>
            <DateCreated>Mon, 10 Nov 2008 20:52:56 +0000</DateCreated>
            <DateUpdated>Mon, 10 Nov 2008 20:52:56 +0000</DateUpdated>
            <ApiVersion>2010-04-01</ApiVersion>
            <Uri>/2010-04-01/Accounts/ACda6f1e31047ebd6fe7a55f120be3a900/Sandbox</Uri>
        </TwilioSandbox>
    </TwilioResponse>    

HTTP POST

You can POST to the Sandbox resource to update the TwiML voice and SMS URLs associated with the sandbox number.

Optional Parameters

Your request may include the following parameters:

Parameter Description
VoiceUrl The URL that Twilio should request when somebody calls this sandbox.
VoiceMethod The HTTP method that should be used to request the above URL. Must be either GET or POST. Defaults to POST.
SmsUrl The URL that Twilio should request when somebody sends an SMS to the sandbox.
SmsMethod The HTTP method that should be used to request the SmsUrl. Must be either GET or POST. Defaults to POST.
StatusCallback The URL that Twilio will request to pass status parameters (such as call ended) to your application.
StatusCallbackMethod The HTTP method Twilio will use to make requests to the StatusCallback URL. Either GET or POST.
Example

If successful, Twilio responds with an updated representation of the sandbox.

Try it now
  • POST /2010-04-01/Accounts/ACda6f1.../Sandbox

    VoiceUrl=http://mynewdomain.com/my-call-handler.php&VoiceMethod=POST

    <TwilioResponse>
        <TwilioSandbox>
            <Pin>63729915</Pin>
            <AccountSid>ACda6f1e31047ebd6fe7a55f120be3a900</AccountSid>
            <PhoneNumber>+14154132865</PhoneNumber>
            <ApplicationSid>AP1d510128c851af26b0a14d50b5577e69</ApplicationSid>
            <ApiVersion>2010-04-01</ApiVersion>
            <VoiceUrl>http://mynewdomain.com/my-call-handler.php</VoiceUrl>
            <VoiceMethod>POST</VoiceMethod>
            <SmsUrl>http://demo.twilio.com/welcome/sms</SmsUrl>
            <SmsMethod>POST</SmsMethod>
            <StatusCallback/>
            <StatusCallbackMethod>POST</StatusCallbackMethod>
            <DateCreated>Mon, 10 Nov 2008 20:52:56 +0000</DateCreated>
            <DateUpdated>Mon, 10 Nov 2008 20:52:56 +0000</DateUpdated>
            <ApiVersion>2010-04-01</ApiVersion>
            <Uri>/2010-04-01/Accounts/ACda6f1e31047ebd6fe7a55f120be3a900/Sandbox</Uri>
        </TwilioSandbox>
    </TwilioResponse>    

HTTP PUT

Same as POST, see above.

HTTP DELETE

Not supported