Class NumberInsightClient
- Namespace
- Vonage.NumberInsights
- Assembly
- Vonage.dll
Provides access to the Number Insight API for retrieving information about phone numbers including carrier details, validity, roaming status, and caller identity.
public class NumberInsightClient : INumberInsightClient
- Inheritance
-
NumberInsightClient
- Implements
- Inherited Members
Constructors
NumberInsightClient(Credentials)
Initializes a new instance of the NumberInsightClient class.
public NumberInsightClient(Credentials creds = null)
Parameters
credsCredentialsOptional credentials to use for API requests. If not provided, uses default configuration.
Properties
Credentials
The credentials used for authenticating API requests.
public Credentials Credentials { get; set; }
Property Value
Methods
GetNumberInsightAdvancedAsync(AdvancedNumberInsightRequest, Credentials)
Retrieves advanced information about a phone number including validity and reachability. This synchronous method waits for the response. For high-volume usage, consider GetNumberInsightAsynchronousAsync(AdvancedNumberInsightAsynchronousRequest, Credentials) to avoid timeouts.
public Task<AdvancedInsightsResponse> GetNumberInsightAdvancedAsync(AdvancedNumberInsightRequest request, Credentials creds = null)
Parameters
requestAdvancedNumberInsightRequestThe request containing the phone number and lookup options. See AdvancedNumberInsightRequest.
credsCredentialsOptional credentials to override the default client credentials.
Returns
- Task<AdvancedInsightsResponse>
An AdvancedInsightsResponse containing validity, reachability, and all standard insight data.
Examples
var request = new AdvancedNumberInsightRequest { Number = "447700900000" };
var response = await client.NumberInsightClient.GetNumberInsightAdvancedAsync(request);
- See Also
GetNumberInsightAsynchronousAsync(AdvancedNumberInsightAsynchronousRequest, Credentials)
Retrieves advanced information about a phone number asynchronously via webhook callback. Recommended for production use to avoid timeouts on complex lookups.
public Task<AdvancedInsightsAsynchronousResponse> GetNumberInsightAsynchronousAsync(AdvancedNumberInsightAsynchronousRequest request, Credentials creds = null)
Parameters
requestAdvancedNumberInsightAsynchronousRequestThe request containing the phone number and callback URL. See AdvancedNumberInsightAsynchronousRequest.
credsCredentialsOptional credentials to override the default client credentials.
Returns
- Task<AdvancedInsightsAsynchronousResponse>
An AdvancedInsightsAsynchronousResponse confirming the request was accepted. Full results are delivered to the callback URL.
Examples
var request = new AdvancedNumberInsightAsynchronousRequest
{
Number = "447700900000",
Callback = "https://example.com/webhooks/insight"
};
var response = await client.NumberInsightClient.GetNumberInsightAsynchronousAsync(request);
- See Also
GetNumberInsightBasicAsync(BasicNumberInsightRequest, Credentials)
Retrieves basic information about a phone number including country and formatting details. This is the fastest and lowest-cost lookup option.
public Task<BasicInsightResponse> GetNumberInsightBasicAsync(BasicNumberInsightRequest request, Credentials creds = null)
Parameters
requestBasicNumberInsightRequestThe request containing the phone number to look up. See BasicNumberInsightRequest.
credsCredentialsOptional credentials to override the default client credentials.
Returns
- Task<BasicInsightResponse>
A BasicInsightResponse containing country, carrier prefix, and number formatting information.
Examples
var request = new BasicNumberInsightRequest { Number = "447700900000" };
var response = await client.NumberInsightClient.GetNumberInsightBasicAsync(request);
- See Also
GetNumberInsightStandardAsync(StandardNumberInsightRequest, Credentials)
Retrieves standard information about a phone number including carrier, porting, and roaming details. Provides more detail than basic lookup at additional cost.
public Task<StandardInsightResponse> GetNumberInsightStandardAsync(StandardNumberInsightRequest request, Credentials creds = null)
Parameters
requestStandardNumberInsightRequestThe request containing the phone number and optional CNAM lookup flag. See StandardNumberInsightRequest.
credsCredentialsOptional credentials to override the default client credentials.
Returns
- Task<StandardInsightResponse>
A StandardInsightResponse containing carrier, porting status, roaming information, and optionally caller identity.
Examples
var request = new StandardNumberInsightRequest { Number = "447700900000", Cnam = true };
var response = await client.NumberInsightClient.GetNumberInsightStandardAsync(request);
- See Also
ValidateNumberInsightResponse(NumberInsightResponseBase)
public void ValidateNumberInsightResponse(NumberInsightResponseBase response)
Parameters
responseNumberInsightResponseBase