Network Enablement API

The Network Enablement API improves the existing authentication flow for Network Features. This is especially beneficial for those APIs using client authentication, increasing performance, privacy and security:

  • Facilitates pre-checks and provides developers with the necessary data to optimize their calls to the Network Features.
  • Reduces the latency of API calls by improving the routing of the operators calls.

API Reference

The OpenAPI specification for the Network Enablement API is available here.

Authentication

The Network Enablement API uses JSON Web Tokens (JWT) for authentication. Check out our detailed guide on generating a JWT.

How to Use the API

For security reasons it is essential that the Network Enablement API is called by your backend and not from an end-user device.

Request

To invoke the API, send a

POST
request to the /network-enablement endpoint in JSON format with the following body parameters:

Body Parameters

Parameter Required Type Description
phone_number Yes string The phone number of the user in E.164 format, including the country code.
scope Yes Array of string A list of permission scopes that define the specific access or operations being requested for the API call. See the scopes guide.
state Yes string A generated value used to maintain state between the request and callback. Must be unique for each request.

Headers

Header Description
Authorization Must be set to Bearer along with the JWT token generated in the previous step. The JWT must correlate to the App that is approved for the Network Features usage.
Content-Type Must be set to application/json.

The following example uses cURL to call the Network Enablement API, using the Virtual Operator

curl -X POST https://api-eu.vonage.com/v0.1/network-enablement \
  --header "Authorization: Bearer $JWT" \
  --header "Content-Type: application/json" \
  --data $'{
    "phone_number": "'$PHONE_NUMBER'",
    "scopes": ["dpv:FraudPreventionAndDetection#number-verification-verify-read"],
    "state" : "'$STATE'"
}'

Response

If the request is successful, the response will return a scope object similar to this:

{
  "scopes": {
    "dpv:FraudPreventionAndDetection#number-verification-verify-read": {
      "auth_url": "https://api-eu.vonage.com/oauth2/auth?client_id=sandbox_test&scope=dpv%3AFraudPreventionAndDetection%23number-verification-verify-read&state=v2_840e17a8-79f2-1a277bff&redirect_uri=https%3A%2F%2Fui.idp.vonage.com%2Fcamara%2Foauth%2Fcallback&response_type=code",
      "requires_carrier_network": false
    }
  }
}

Where:

  • auth_url contains the URL to be called on the end-user device to start the authentication flow.
  • The requires_carrier_network parameter specifies whether the auth_url must be sent from the client using a carrier network instead of WiFi.