Announcing Vonage Virtual CSP for Network APIs
最終更新日 September 17, 2024

One of the most recurring questions we get from developers is: How can I test the Network APIs if they are unavailable in my country? Say no more. We are excited to announce the availability of the Virtual Communication Service Provider (CSP).

The Virtual CSP provides predefined and deterministic API responses when using the Vonage Sandbox. It works like a regular CSP but only accepts API requests with phone numbers that use the +990 prefix.

Let’s take a look at how it works!

How Can I Enable the Virtual CSP?

Using the Virtual CSP is straightforward. Just create an application in the dashboard (or use an existing one) and select “Sandbox” under the Network API capabilities box. That’s it. No extra configuration is required. From now on, all API requests using the credentials linked to this application and phone numbers with the +990 prefix will be directed to the Virtual CSP.

Once the application is ready, go to the Sandbox page to check the available CSPs supported within the Sandbox. The first entry corresponds to the Virtual CSP:

List of available CSPs for testing Network APIs using the Vonage SandboxVirtual CSP list in the Vonage Sandbox

Note that It is not necessary to add +990 numbers to your Sandbox’s allowlist. Simply make an API call to any of the supported Network APIs.

Call Network APIs with the Virtual CSP

The Virtual CSP provides deterministic responses for API requests using phone numbers starting with +990. The behavior is defined by the input parameters in the API request, including different ranges in some parameters or specific phone number endings. The documentation contains all possible API response combinations for the supported Network APIs. 

For example, the /check endpoint of the SIM Swap API will always return true if the parameter maxAge is larger than 500:

curl --url https://api-eu.vonage.com/camara/sim-swap/v040/check \
  --header 'Authorization: Bearer $TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{"phoneNumber": "+990123456", "maxAge": "500"}'

In case we want to test the scenario where the API returns an error, we could send an API request using a phone number ending in 99:

curl --url https://api-eu.vonage.com/camara/sim-swap/v040/check \
  --header 'Authorization: Bearer $TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{"phoneNumber": "+990123499, "maxAge": "500"}'

Remember that authentication must be implemented in the same way as with a regular CSP.

Get in Touch

Have you already used the new Virtual CSP? We’d love to hear your feedback! Join us on the Vonage Community Slack or message us on X, and we will get back to you. 

Thanks for reading!

Alvaro NavarroSenior Developer Advocate

Alvaro is a developer advocate at Vonage, focusing on Network APIs. Passionate about Developer Experience, APIs, and Open Source. Outside work, you can often find him exploring comic shops, attending sci-fi and horror festivals or crafting stuff with those renowned tiny plastic building blocks.

Ready to start building?

Experience seamless connectivity, real-time messaging, and crystal-clear voice and video calls-all at your fingertips.

Subscribe to Our Developer Newsletter

Subscribe to our monthly newsletter to receive our latest updates on tutorials, releases, and events. No spam.