### Start a Verification with Email - C# Source: https://www.twilio.com/docs/verify/api/verification C# / .NET example that starts a Verification with Email using the Twilio Verify v2 API. Requires TWILIO_API_KEY, TWILIO_API_SECRET, and TWILIO_ACCOUNT_SID environment variables. Prints the verification SID. ```csharp // Install the C# / .NET helper library from twilio.com/docs/csharp/install using System; using Twilio; using Twilio.Rest.Verify.V2.Service; using System.Threading.Tasks; class Program { public static async Task Main(string[] args) { // Find your Account SID at twilio.com/console // Provision API Keys at twilio.com/console/runtime/api-keys // and set the environment variables. See http://twil.io/secure // For local testing, you can use your Account SID and Auth token string apiKey = Environment.GetEnvironmentVariable("TWILIO_API_KEY"); string apiSecret = Environment.GetEnvironmentVariable("TWILIO_API_SECRET"); string accountSid = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID"); TwilioClient.Init(apiKey, apiSecret, accountSid); var verification = await VerificationResource.CreateAsync( to: "customer@example.com", channel: "email", pathServiceSid: "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); Console.WriteLine(verification.Sid); } } ``` -------------------------------- ### Start a Verification with Email - Java Source: https://www.twilio.com/docs/verify/api/verification Java example that starts a Verification with Email using the Twilio Verify v2 API. Requires TWILIO_API_KEY, TWILIO_API_SECRET, and TWILIO_ACCOUNT_SID environment variables. Prints the verification SID. ```java // Install the Java helper library from twilio.com/docs/java/install import com.twilio.Twilio; import com.twilio.rest.verify.v2.service.Verification; public class Example { // Find your Account SID at twilio.com/console // Provision API Keys at twilio.com/console/runtime/api-keys // and set the environment variables. See http://twil.io/secure // For local testing, you can use your Account SID and Auth token public static final String API_KEY = System.getenv("TWILIO_API_KEY"); public static final String API_SECRET = System.getenv("TWILIO_API_SECRET"); public static final String ACCOUNT_SID = System.getenv("TWILIO_ACCOUNT_SID"); public static void main(String[] args) { Twilio.init(API_KEY, API_SECRET, ACCOUNT_SID); Verification verification = Verification.creator("VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "customer@example.com", "email").create(); System.out.println(verification.getSid()); } } ``` -------------------------------- ### Start a Verification with Email - Python Source: https://www.twilio.com/docs/verify/api/verification Python example that starts a Verification with Email using the Twilio Verify v2 API. Requires TWILIO_API_KEY, TWILIO_API_SECRET, and TWILIO_ACCOUNT_SID environment variables. Prints the verification SID. ```python # Download the helper library from https://www.twilio.com/docs/python/install import os from twilio.rest import Client # Find your Account SID at twilio.com/console # Provision API Keys at twilio.com/console/runtime/api-keys # and set the environment variables. See http://twil.io/secure # For local testing, you can use your Account SID and Auth token api_key = os.environ["TWILIO_API_KEY"] api_secret = os.environ["TWILIO_API_SECRET"] account_sid = os.environ["TWILIO_ACCOUNT_SID"] client = Client(api_key, api_secret, account_sid) verification = client.verify.v2.services( "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ).verifications.create(to="customer@example.com", channel="email") print(verification.sid) ``` -------------------------------- ### Start a Verification with Email - Node.js Source: https://www.twilio.com/docs/verify/api/verification Node.js example that starts a Verification with Email using the Twilio Verify v2 API. Requires TWILIO_ACCOUNT_SID, TWILIO_API_KEY, and TWILIO_API_SECRET environment variables. Prints the verification SID. ```javascript // Download the helper library from https://www.twilio.com/docs/node/install const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio"; // Find your Account SID at twilio.com/console // Provision API Keys at twilio.com/console/runtime/api-keys // and set the environment variables. See http://twil.io/secure // For local testing, you can use your Account SID and Auth token const accountSid = process.env.TWILIO_ACCOUNT_SID; const apiKey = process.env.TWILIO_API_KEY; const apiSecret = process.env.TWILIO_API_SECRET; const client = twilio(apiKey, apiSecret, { accountSid: accountSid }); async function createVerification() { const verification = await client.verify.v2 .services("VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") .verifications.create({ channel: "email", to: "customer@example.com", }); console.log(verification.sid); } createVerification(); ``` -------------------------------- ### Start a Verification with a Template (Python) Source: https://www.twilio.com/docs/verify/api/templates Python example using the Twilio helper library to create a verification with a specified template. Requires TWILIO_ACCOUNT_SID, TWILIO_API_KEY, and TWILIO_API_SECRET environment variables. The template_sid parameter must start with HJ. ```python # Download the helper library from https://www.twilio.com/docs/python/install import os from twilio.rest import Client # Find your Account SID at twilio.com/console # Provision API Keys at twilio.com/console/runtime/api-keys # and set the environment variables. See http://twil.io/secure # For local testing, you can use your Account SID and Auth token api_key = os.environ["TWILIO_API_KEY"] api_secret = os.environ["TWILIO_API_SECRET"] account_sid = os.environ["TWILIO_ACCOUNT_SID"] client = Client(api_key, api_secret, account_sid) verification = client.verify.v2.services( "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ).verifications.create( to="+15017122661", channel="sms", template_sid="HJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", ) print(verification.status) ``` -------------------------------- ### Start a Verification with Voice (C#) Source: https://www.twilio.com/docs/verify/authentication-channels Use this C# example to start a Voice verification by setting the Channel parameter to 'call'. Requires Twilio helper library and environment variables for API credentials. The verification is created for the specified phone number and service SID. ```C# // Install the C# / .NET helper library from twilio.com/docs/csharp/install using System; using Twilio; using Twilio.Rest.Verify.V2.Service; using System.Threading.Tasks; class Program { public static async Task Main(string[] args) { // Find your Account SID at twilio.com/console // Provision API Keys at twilio.com/console/runtime/api-keys // and set the environment variables. See http://twil.io/secure // For local testing, you can use your Account SID and Auth token string apiKey = Environment.GetEnvironmentVariable("TWILIO_API_KEY"); string apiSecret = Environment.GetEnvironmentVariable("TWILIO_API_SECRET"); string accountSid = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID"); TwilioClient.Init(apiKey, apiSecret, accountSid); var verification = await VerificationResource.CreateAsync( to: "+15017122661", channel: "call", pathServiceSid: "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); Console.WriteLine(verification.Sid); } } ``` -------------------------------- ### GET /v2/Services/{ServiceSid}/Webhooks Source: https://www.twilio.com/docs/verify/api/webhooks This snippet documents the GET endpoint for listing all Webhooks for a Service, including path and query parameters, and a response example. ```APIDOC ## GET /v2/Services/{ServiceSid}/Webhooks ### Description Retrieve a list of all Webhooks for a Service. ### Method GET ### Endpoint https://verify.twilio.com/v2/Services/{ServiceSid}/Webhooks ### Parameters #### Path Parameters - **ServiceSid** (string) - Required - The unique SID identifier of the Service. Must match pattern ^VA[0-9a-fA-F]{32}$ and be 34 characters long. #### Query Parameters - **PageSize** (integer) - Optional - How many resources to return in each list page. The default is 50, and the maximum is 1000. - **Page** (integer) - Optional - The page index. This value is simply for client state. - **PageToken** (string) - Optional - The page token. This is provided by the API. ### Request Example GET https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks?PageSize=50&Page=0&PageToken=abc123 ### Response #### Success Response (200) - **webhooks** (array) - List of Webhook resources. Each Webhook resource contains a **sid** (string) - The unique string that identifies the Webhook resource. #### Response Example { "webhooks": [ { "sid": "YWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" } ] } ``` -------------------------------- ### Create a Bucket in C# Source: https://www.twilio.com/docs/verify/api/programmable-rate-limits C# example for creating a bucket. Uses the Twilio helper library, initializes the client with API key and secret from environment variables, and calls BucketResource.CreateAsync with interval 60 and max 4. Writes the bucket Sid to the console. ```csharp // Install the C# / .NET helper library from twilio.com/docs/csharp/install using System; using Twilio; using Twilio.Rest.Verify.V2.Service.RateLimit; using System.Threading.Tasks; class Program { public static async Task Main(string[] args) { // Find your Account SID at twilio.com/console // Provision API Keys at twilio.com/console/runtime/api-keys // and set the environment variables. See http://twil.io/secure // For local testing, you can use your Account SID and Auth token string apiKey = Environment.GetEnvironmentVariable("TWILIO_API_KEY"); string apiSecret = Environment.GetEnvironmentVariable("TWILIO_API_SECRET"); string accountSid = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID"); TwilioClient.Init(apiKey, apiSecret, accountSid); var bucket = await BucketResource.CreateAsync( interval: 60, max: 4, pathServiceSid: "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", pathRateLimitSid: "RKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); Console.WriteLine(bucket.Sid); } } ``` -------------------------------- ### Response from Starting a WhatsApp Verification Source: https://www.twilio.com/docs/verify/whatsapp Example response from starting a WhatsApp verification. Shows the verification object with status "pending" and channel "whatsapp". ```json { "sid": "VEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "service_sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "to": "+15017122661", "channel": "whatsapp", "status": "pending", "valid": false, "date_created": "2015-07-30T20:00:00Z", "date_updated": "2015-07-30T20:00:00Z", "lookup": {}, "amount": null, "payee": null, "send_code_attempts": [ { "time": "2015-07-30T20:00:00Z", "channel": "whatsapp", "attempt_sid": "VLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" } ], "sna": null, "url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Verifications/VEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" } ``` -------------------------------- ### Fetch a Webhook with Go Source: https://www.twilio.com/docs/verify/api/webhooks Go example using the Twilio helper library to fetch a Webhook. Requires TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN environment variables. ```go // Download the helper library from https://www.twilio.com/docs/go/install package main import ( "fmt" "github.com/twilio/twilio-go" "os" ) func main() { // Find your Account SID and Auth Token at twilio.com/console // and set the environment variables. See http://twil.io/secure // Make sure TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN exists in your environment client := twilio.NewRestClient() resp, err := client.VerifyV2.FetchWebhook("VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "YWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") if err != nil { fmt.Println(err.Error()) os.Exit(1) } else { if resp.Sid != nil { fmt.Println(*resp.Sid) } else { fmt.Println(resp.Sid) } } } ``` -------------------------------- ### List all Buckets in C# Source: https://www.twilio.com/docs/verify/api/service-rate-limit-buckets C# / .NET example using the Twilio helper library to list all Buckets. Requires TWILIO_API_KEY, TWILIO_API_SECRET, and TWILIO_ACCOUNT_SID environment variables. Uses placeholder SIDs VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa and RKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa. ```csharp // Install the C# / .NET helper library from twilio.com/docs/csharp/install using System; using Twilio; using Twilio.Rest.Verify.V2.Service.RateLimit; using System.Threading.Tasks; class Program { public static async Task Main(string[] args) { // Find your Account SID at twilio.com/console // Provision API Keys at twilio.com/console/runtime/api-keys // and set the environment variables. See http://twil.io/secure // For local testing, you can use your Account SID and Auth token string apiKey = Environment.GetEnvironmentVariable("TWILIO_API_KEY"); string apiSecret = Environment.GetEnvironmentVariable("TWILIO_API_SECRET"); string accountSid = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID"); TwilioClient.Init(apiKey, apiSecret, accountSid); var buckets = await BucketResource.ReadAsync( pathServiceSid: "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", pathRateLimitSid: "RKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", limit: 20); foreach (var record in buckets) { Console.WriteLine(record.Sid); } } } ``` -------------------------------- ### List all Services with Python Source: https://www.twilio.com/docs/verify/api/service Python helper library example for listing all Verify Services. Requires TWILIO_API_KEY, TWILIO_API_SECRET, and TWILIO_ACCOUNT_SID environment variables. Lists up to 20 services and prints each service SID. ```python # Download the helper library from https://www.twilio.com/docs/python/install import os from twilio.rest import Client # Find your Account SID at twilio.com/console # Provision API Keys at twilio.com/console/runtime/api-keys # and set the environment variables. See http://twil.io/secure # For local testing, you can use your Account SID and Auth token api_key = os.environ["TWILIO_API_KEY"] api_secret = os.environ["TWILIO_API_SECRET"] account_sid = os.environ["TWILIO_ACCOUNT_SID"] client = Client(api_key, api_secret, account_sid) services = client.verify.v2.services.list(limit=20) for record in services: print(record.sid) ``` -------------------------------- ### List all Services with Java Source: https://www.twilio.com/docs/verify/api/service Java helper library example for listing all Verify Services. Requires TWILIO_API_KEY, TWILIO_API_SECRET, and TWILIO_ACCOUNT_SID environment variables. Uses Service.reader().limit(20).read() and prints each service SID. ```java // Install the Java helper library from twilio.com/docs/java/install import com.twilio.Twilio; import com.twilio.rest.verify.v2.Service; import com.twilio.base.ResourceSet; public class Example { // Find your Account SID at twilio.com/console // Provision API Keys at twilio.com/console/runtime/api-keys // and set the environment variables. See http://twil.io/secure // For local testing, you can use your Account SID and Auth token public static final String API_KEY = System.getenv("TWILIO_API_KEY"); public static final String API_SECRET = System.getenv("TWILIO_API_SECRET"); public static final String ACCOUNT_SID = System.getenv("TWILIO_ACCOUNT_SID"); public static void main(String[] args) { Twilio.init(API_KEY, API_SECRET, ACCOUNT_SID); ResourceSet services = Service.reader().limit(20).read(); for (Service record : services) { System.out.println(record.getSid()); } } } ``` -------------------------------- ### Create a Bucket in Python Source: https://www.twilio.com/docs/verify/api/programmable-rate-limits Python example for creating a bucket. Uses the Twilio helper library, initializes the client with API key and secret from environment variables, and calls buckets.create with interval 60 and max 4. Prints the bucket sid. ```python # Download the helper library from https://www.twilio.com/docs/python/install import os from twilio.rest import Client # Find your Account SID at twilio.com/console # Provision API Keys at twilio.com/console/runtime/api-keys # and set the environment variables. See http://twil.io/secure # For local testing, you can use your Account SID and Auth token api_key = os.environ["TWILIO_API_KEY"] api_secret = os.environ["TWILIO_API_SECRET"] account_sid = os.environ["TWILIO_ACCOUNT_SID"] client = Client(api_key, api_secret, account_sid) bucket = ( client.verify.v2.services("VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") .rate_limits("RKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") .buckets.create(interval=60, max=4) ) print(bucket.sid) ``` -------------------------------- ### List all Services with C# Source: https://www.twilio.com/docs/verify/api/service C# / .NET helper library example for listing all Verify Services. Requires TWILIO_API_KEY, TWILIO_API_SECRET, and TWILIO_ACCOUNT_SID environment variables. Uses ServiceResource.ReadAsync with a limit of 20 and prints each service SID. ```csharp // Install the C# / .NET helper library from twilio.com/docs/csharp/install using System; using Twilio; using Twilio.Rest.Verify.V2; using System.Threading.Tasks; class Program { public static async Task Main(string[] args) { // Find your Account SID at twilio.com/console // Provision API Keys at twilio.com/console/runtime/api-keys // and set the environment variables. See http://twil.io/secure // For local testing, you can use your Account SID and Auth token string apiKey = Environment.GetEnvironmentVariable("TWILIO_API_KEY"); string apiSecret = Environment.GetEnvironmentVariable("TWILIO_API_SECRET"); string accountSid = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID"); TwilioClient.Init(apiKey, apiSecret, accountSid); var services = await ServiceResource.ReadAsync(limit: 20); foreach (var record in services) { Console.WriteLine(record.Sid); } } } ``` -------------------------------- ### Start a Verification with a Template (Node.js) Source: https://www.twilio.com/docs/verify/api/templates Node.js example using the Twilio helper library to create a verification with a specified template. Requires TWILIO_ACCOUNT_SID, TWILIO_API_KEY, and TWILIO_API_SECRET environment variables. The templateSid parameter must start with HJ. ```javascript // Download the helper library from https://www.twilio.com/docs/node/install const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio"; // Find your Account SID at twilio.com/console // Provision API Keys at twilio.com/console/runtime/api-keys // and set the environment variables. See http://twil.io/secure // For local testing, you can use your Account SID and Auth token const accountSid = process.env.TWILIO_ACCOUNT_SID; const apiKey = process.env.TWILIO_API_KEY; const apiSecret = process.env.TWILIO_API_SECRET; const client = twilio(apiKey, apiSecret, { accountSid: accountSid }); async function createVerification() { const verification = await client.verify.v2 .services("VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") .verifications.create({ channel: "sms", templateSid: "HJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", to: "+15017122661", }); console.log(verification.status); } createVerification(); ``` -------------------------------- ### Create a Bucket in Node.js Source: https://www.twilio.com/docs/verify/api/programmable-rate-limits Node.js example for creating a bucket. Uses the Twilio helper library, initializes the client with API key and secret from environment variables, and calls buckets.create with interval 60 and max 4. Logs the bucket sid. ```javascript // Download the helper library from https://www.twilio.com/docs/node/install const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio"; // Find your Account SID at twilio.com/console // Provision API Keys at twilio.com/console/runtime/api-keys // and set the environment variables. See http://twil.io/secure // For local testing, you can use your Account SID and Auth token const accountSid = process.env.TWILIO_ACCOUNT_SID; const apiKey = process.env.TWILIO_API_KEY; const apiSecret = process.env.TWILIO_API_SECRET; const client = twilio(apiKey, apiSecret, { accountSid: accountSid }); async function createBucket() { const bucket = await client.verify.v2 .services("VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") .rateLimits("RKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") .buckets.create({ interval: 60, max: 4, }); console.log(bucket.sid); } createBucket(); ``` -------------------------------- ### Start a Verification with Voice to an extension (sendDigits) Source: https://www.twilio.com/docs/verify/api/verification Start a verification with Voice to an extension by including the sendDigits parameter (e.g., "350") in the create call. Both Node.js and Python examples use the same service SID and channel 'call'. ```javascript // Download the helper library from https://www.twilio.com/docs/node/install const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio"; // Find your Account SID at twilio.com/console // Provision API Keys at twilio.com/console/runtime/api-keys // and set the environment variables. See http://twil.io/secure // For local testing, you can use your Account SID and Auth token const accountSid = process.env.TWILIO_ACCOUNT_SID; const apiKey = process.env.TWILIO_API_KEY; const apiSecret = process.env.TWILIO_API_SECRET; const client = twilio(apiKey, apiSecret, { accountSid: accountSid }); async function createVerification() { const verification = await client.verify.v2 .services("VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") .verifications.create({ channel: "call", sendDigits: "350", to: "+15017122661", }); console.log(verification.sid); } createVerification(); ``` ```python # Download the helper library from https://www.twilio.com/docs/python/install import os from twilio.rest import Client # Find your Account SID at twilio.com/console # Provision API Keys at twilio.com/console/runtime/api-keys # and set the environment variables. See http://twil.io/secure # For local testing, you can use your Account SID and Auth token api_key = os.environ["TWILIO_API_KEY"] api_secret = os.environ["TWILIO_API_SECRET"] account_sid = os.environ["TWILIO_ACCOUNT_SID"] client = Client(api_key, api_secret, account_sid) verification = client.verify.v2.services( "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ).verifications.create(channel="call", to="+15017122661", send_digits="350") print(verification.sid) ``` -------------------------------- ### Fetch a Webhook with C# Source: https://www.twilio.com/docs/verify/api/webhooks C# example using the Twilio helper library to fetch a Webhook. Requires TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN environment variables. ```csharp // Install the C# / .NET helper library from twilio.com/docs/csharp/install using System; using Twilio; using Twilio.Rest.Verify.V2.Service; using System.Threading.Tasks; class Program { public static async Task Main(string[] args) { // Find your Account SID and Auth Token at twilio.com/console // and set the environment variables. See http://twil.io/secure string accountSid = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID"); string authToken = Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN"); TwilioClient.Init(accountSid, authToken); var webhook = await WebhookResource.FetchAsync( pathServiceSid: "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", pathSid: "YWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); Console.WriteLine(webhook.Sid); } } ``` -------------------------------- ### GET /v2/Services/{ServiceSid}/RateLimits/{Sid} Source: https://www.twilio.com/docs/verify/api/service-rate-limits This snippet documents the HTTP GET endpoint used to fetch a specific Rate Limit resource from a Verify Service. It includes the endpoint URL, path parameters, and the response schema with an example. ```APIDOC ## GET /v2/Services/{ServiceSid}/RateLimits/{Sid} ### Description Fetch a specific Rate Limit resource from a Verify Service. ### Method GET ### Endpoint `https://verify.twilio.com/v2/Services/{ServiceSid}/RateLimits/{Sid}` ### Parameters #### Path Parameters - **ServiceSid** (string) - Required - The SID of the Verify Service containing the Rate Limit. - **Sid** (string) - Required - The SID of the Rate Limit resource to fetch. ### Response #### Success Response (200) - **sid** (string) - The unique string that identifies the Rate Limit resource. - **service_sid** (string) - The SID of the Verify Service that the Rate Limit belongs to. - **account_sid** (string) - The SID of the Account that created the Rate Limit. - **unique_name** (string) - A unique, developer-defined name for the Rate Limit. - **description** (string) - A description of the Rate Limit. - **date_created** (string) - The date and time in GMT when the Rate Limit was created. - **date_updated** (string) - The date and time in GMT when the Rate Limit was last updated. - **url** (string) - The absolute URL of the Rate Limit resource. - **links** (object) - Contains a link to the associated Buckets subresource. #### Response Example ```json { "sid": "RKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "service_sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "unique_name": "unique.name", "description": "Description", "date_created": "2015-07-30T20:00:00Z", "date_updated": "2015-07-30T20:00:00Z", "url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RateLimits/RKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "links": { "buckets": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RateLimits/RKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Buckets" } } ``` ``` -------------------------------- ### Start a Verification with Voice (Java) Source: https://www.twilio.com/docs/verify/authentication-channels Use this Java example to start a Voice verification by setting the Channel parameter to 'call'. Requires Twilio helper library and environment variables for API credentials. The verification is created for the specified phone number and service SID. ```Java // Install the Java helper library from twilio.com/docs/java/install import com.twilio.Twilio; import com.twilio.rest.verify.v2.service.Verification; public class Example { // Find your Account SID at twilio.com/console // Provision API Keys at twilio.com/console/runtime/api-keys // and set the environment variables. See http://twil.io/secure // For local testing, you can use your Account SID and Auth token public static final String API_KEY = System.getenv("TWILIO_API_KEY"); public static final String API_SECRET = System.getenv("TWILIO_API_SECRET"); public static final String ACCOUNT_SID = System.getenv("TWILIO_ACCOUNT_SID"); public static void main(String[] args) { Twilio.init(API_KEY, API_SECRET, ACCOUNT_SID); Verification verification = Verification.creator("VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "+15017122661", "call").create(); System.out.println(verification.getSid()); } } ``` -------------------------------- ### Fetch a Bucket - C# Source: https://www.twilio.com/docs/verify/api/service-rate-limit-buckets C# example using the Twilio helper library to fetch a Bucket. Requires TWILIO_API_KEY, TWILIO_API_SECRET, and TWILIO_ACCOUNT_SID environment variables. Uses placeholder SIDs for the service, rate limit, and bucket. ```csharp // Install the C# / .NET helper library from twilio.com/docs/csharp/install using System; using Twilio; using Twilio.Rest.Verify.V2.Service.RateLimit; using System.Threading.Tasks; class Program { public static async Task Main(string[] args) { // Find your Account SID at twilio.com/console // Provision API Keys at twilio.com/console/runtime/api-keys // and set the environment variables. See http://twil.io/secure // For local testing, you can use your Account SID and Auth token string apiKey = Environment.GetEnvironmentVariable("TWILIO_API_KEY"); string apiSecret = Environment.GetEnvironmentVariable("TWILIO_API_SECRET"); string accountSid = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID"); TwilioClient.Init(apiKey, apiSecret, accountSid); var bucket = await BucketResource.FetchAsync( pathServiceSid: "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", pathRateLimitSid: "RKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", pathSid: "BLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); Console.WriteLine(bucket.Sid); } } ``` -------------------------------- ### Fetch an Entity with Go Source: https://www.twilio.com/docs/verify/api/entity Go example using the Twilio helper library to fetch an Entity. Requires TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN environment variables. Prints the entity's SID or exits with error. ```go // Download the helper library from https://www.twilio.com/docs/go/install package main import ( "fmt" "github.com/twilio/twilio-go" "os" ) func main() { // Find your Account SID and Auth Token at twilio.com/console // and set the environment variables. See http://twil.io/secure // Make sure TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN exists in your environment client := twilio.NewRestClient() resp, err := client.VerifyV2.FetchEntity("VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "Identity") if err != nil { fmt.Println(err.Error()) os.Exit(1) } else { if resp.Sid != nil { fmt.Println(*resp.Sid) } else { fmt.Println(resp.Sid) } } } ``` -------------------------------- ### Start a Verification with Voice (Python) Source: https://www.twilio.com/docs/verify/authentication-channels Use this Python example to start a Voice verification by setting the Channel parameter to 'call'. Requires Twilio helper library and environment variables for API credentials. The verification is created for the specified phone number and service SID. ```Python # Download the helper library from https://www.twilio.com/docs/python/install import os from twilio.rest import Client # Find your Account SID at twilio.com/console # Provision API Keys at twilio.com/console/runtime/api-keys # and set the environment variables. See http://twil.io/secure # For local testing, you can use your Account SID and Auth token api_key = os.environ["TWILIO_API_KEY"] api_secret = os.environ["TWILIO_API_SECRET"] account_sid = os.environ["TWILIO_ACCOUNT_SID"] client = Client(api_key, api_secret, account_sid) verification = client.verify.v2.services( "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ).verifications.create(to="+15017122661", channel="call") print(verification.sid) ``` -------------------------------- ### Start a Verification with Voice (JavaScript) Source: https://www.twilio.com/docs/verify/authentication-channels Use this JavaScript example to start a Voice verification by setting the Channel parameter to 'call'. Requires Twilio helper library and environment variables for API credentials. The verification is created for the specified phone number and service SID. ```JavaScript // Download the helper library from https://www.twilio.com/docs/node/install const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio"; // Find your Account SID at twilio.com/console // Provision API Keys at twilio.com/console/runtime/api-keys // and set the environment variables. See http://twil.io/secure // For local testing, you can use your Account SID and Auth token const accountSid = process.env.TWILIO_ACCOUNT_SID; const apiKey = process.env.TWILIO_API_KEY; const apiSecret = process.env.TWILIO_API_SECRET; const client = twilio(apiKey, apiSecret, { accountSid: accountSid }); async function createVerification() { const verification = await client.verify.v2 .services("VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") .verifications.create({ channel: "call", to: "+15017122661", }); console.log(verification.sid); } createVerification(); ``` -------------------------------- ### Fetch an Access Token (curl) and Example Response Source: https://www.twilio.com/docs/verify/api/access-token Sends a GET request to the Verify API to fetch an access token, with example response JSON showing fields like sid, token, and ttl. Requires TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN environment variables for authentication. ```bash curl -X GET "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/AccessTokens/YKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \ -u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN ``` ```json { "sid": "YKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "service_sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "entity_identity": "ff483d1ff591898a9942916050d2ca3f", "factor_type": "push", "factor_friendly_name": "John Doe iPhone", "ttl": 60, "date_created": "2015-07-30T20:00:00Z", "token": "eyJ6aXAiOiJERUYiLCJraWQiOiJTQVNfUzNfX19LTVNfdjEiLCJjdHkiOiJ0d2lsaW8tZnBhO3Y9MSIsImVuYyI6IkEyNTZHQ00iLCJhbGciOiJkaXIifQ..qjltWfIgQaTwp2DZz.81Z_6W4kR-hdlAUvJQCbwS8CQ7QAoFRkOvNMoySEj8zEB4BAY3MXhPARfaK4Lnr4YceA2cXEmkTHPKQ7bPm0XZMGYm1fqLYzAR8YAqUetI9WEdQdhXFrHNgmpFe6GpRrdrfB0STR5Xq0fdakomb98iuIFt1XtP0_yqxvxQzKe1O4035XhK_ELVwQBzqqdI77XRZBFM0REAzlnEOe61nOcQxkaIM9Qel9L5RPhcndcCPFAyYjxo6Ri5c4vOnszUzLDiHmeK9Ep9fRE5-Oz0px0ZEg_FgTUEPFPo2OHQj076HZPeGm65IHBtX7LCkR6IVnJpQt8rttPC3YBOG0y-aTO7snG9QTq_yifeYcbRE2bbs_2wRfs3xM9c6rvX52bVbO3eNuQ-pD4c7ZTpN9g4Y3Kx_ifO87qFhVtnqW9N2YLVJECy1p-aCR7jiygMVr3CRdW1hGZ4brZ4GEkF_HB0h8KYqwGzLYsVkZj2fRW5F6XZpd1eiJZ2K9ClQa4W5fTCQdI99Y2Hk\-3LEpIpP0hXmM3sKj3kF2LQqZx84k4KQ4V7m8Q6c1MkO39rZ5nS8k9KQ3H1d4f2iZ5h7N3o8eW6fE5rA2hJ4dC6sFc3e6kQ6d9Y5nK3V6aB8pE9fD2qZ1vF6c4bQ9lG7jD4R5n1T3V8xZ4cY7wK2pQ9mE6bV3hJ2dA5sN8eM1rS4fH7kG9eC3dT6gZ2qL4dP0H7nV8bW5bH6E2mK4vBH1cZ9ruM7x3TH0kY6wLk8mE4cW9tR6uX3yO4fE5dS9gR7lG2cN4pB6", "url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/AccessTokens/YKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" } ``` -------------------------------- ### Start a Verification with a specific template (Go) Source: https://www.twilio.com/docs/verify/api/templates Uses the Twilio Go helper library to create a verification with a templateSid. Requires environment variables TWILIO_ACCOUNT_SID, TWILIO_API_KEY, and TWILIO_API_SECRET. The verification status is printed to the console. ```go // Download the helper library from https://www.twilio.com/docs/go/install package main import ( "fmt" "github.com/twilio/twilio-go" verify "github.com/twilio/twilio-go/rest/verify/v2" "os" ) func main() { // Find your Account SID at twilio.com/console // Provision API Keys at twilio.com/console/runtime/api-keys // and set the environment variables. See http://twil.io/secure // For local testing, you can use your Account SID and Auth token accountSid := os.Getenv("TWILIO_ACCOUNT_SID") apiKey := os.Getenv("TWILIO_API_KEY") apiSecret := os.Getenv("TWILIO_API_SECRET") client := twilio.NewRestClientWithParams(twilio.ClientParams{ Username: apiKey, Password: apiSecret, AccountSid: accountSid, }) params := &verify.CreateVerificationParams{} params.SetTo("+15017122661") params.SetChannel("sms") params.SetTemplateSid("HJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") resp, err := client.VerifyV2.CreateVerification("VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", params) if err != nil { fmt.Println(err.Error()) os.Exit(1) } else { if resp.Status != nil { fmt.Println(*resp.Status) } else { fmt.Println(resp.Status) } } } ``` -------------------------------- ### Fetch a Bucket - Java Source: https://www.twilio.com/docs/verify/api/service-rate-limit-buckets Java example using the Twilio helper library to fetch a Bucket. Requires TWILIO_API_KEY, TWILIO_API_SECRET, and TWILIO_ACCOUNT_SID environment variables. Uses placeholder SIDs for the service, rate limit, and bucket. ```java // Install the Java helper library from twilio.com/docs/java/install import com.twilio.Twilio; import com.twilio.rest.verify.v2.service.ratelimit.Bucket; public class Example { // Find your Account SID at twilio.com/console // Provision API Keys at twilio.com/console/runtime/api-keys // and set the environment variables. See http://twil.io/secure // For local testing, you can use your Account SID and Auth token public static final String API_KEY = System.getenv("TWILIO_API_KEY"); public static final String API_SECRET = System.getenv("TWILIO_API_SECRET"); public static final String ACCOUNT_SID = System.getenv("TWILIO_ACCOUNT_SID"); public static void main(String[] args) { Twilio.init(API_KEY, API_SECRET, ACCOUNT_SID); Bucket bucket = Bucket .fetcher("VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "RKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "BLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") .fetch(); System.out.println(bucket.getSid()); } } ``` -------------------------------- ### GET /v2/Attempts/Summary Source: https://www.twilio.com/docs/verify/api/verification-attempts-summary This snippet documents the HTTP endpoint for fetching a verification attempts summary, including the query parameter, request example, and response schema. ```APIDOC ## GET /v2/Attempts/Summary ### Description Fetches a summary of verification attempts, optionally filtered by Verify Service SID. ### Method GET ### Endpoint https://verify.twilio.com/v2/Attempts/Summary ### Parameters #### Query Parameters - **VerifyServiceSid** (string) - Optional - The SID of the Verify Service to filter the summary by. ### Request Example ``` curl -X GET "https://verify.twilio.com/v2/Attempts/Summary?VerifyServiceSid=VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \ -u $TWILIO_API_KEY:$TWILIO_API_SECRET ``` ### Response #### Success Response (200) - **total_attempts** (integer) - Total number of verification attempts. - **total_converted** (integer) - Total number of converted verification attempts. - **total_unconverted** (integer) - Total number of unconverted verification attempts. - **conversion_rate_percentage** (string) - Conversion rate as a percentage. - **url** (string) - The URL of the summary resource. #### Response Example ```json { "total_attempts": 11, "total_converted": 9, "total_unconverted": 2, "conversion_rate_percentage": "81.818181818", "url": "https://verify.twilio.com/v2/Attempts/Summary" } ``` ``` -------------------------------- ### Fetch an Entity with C# Source: https://www.twilio.com/docs/verify/api/entity C# example using the Twilio helper library to fetch an Entity. Requires TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN environment variables. Prints the entity's SID. ```csharp // Install the C# / .NET helper library from twilio.com/docs/csharp/install using System; using Twilio; using Twilio.Rest.Verify.V2.Service; using System.Threading.Tasks; class Program { public static async Task Main(string[] args) { // Find your Account SID and Auth Token at twilio.com/console // and set the environment variables. See http://twil.io/secure string accountSid = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID"); string authToken = Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN"); TwilioClient.Init(accountSid, authToken); var entity = await EntityResource.FetchAsync( pathServiceSid: "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", pathIdentity: "Identity"); Console.WriteLine(entity.Sid); } } ``` -------------------------------- ### Fetch a Bucket - Python Source: https://www.twilio.com/docs/verify/api/service-rate-limit-buckets Python example using the Twilio helper library to fetch a Bucket. Requires TWILIO_API_KEY, TWILIO_API_SECRET, and TWILIO_ACCOUNT_SID environment variables. Uses placeholder SIDs for the service, rate limit, and bucket. ```python # Download the helper library from https://www.twilio.com/docs/python/install import os from twilio.rest import Client # Find your Account SID at twilio.com/console # Provision API Keys at twilio.com/console/runtime/api-keys # and set the environment variables. See http://twil.io/secure # For local testing, you can use your Account SID and Auth token api_key = os.environ["TWILIO_API_KEY"] api_secret = os.environ["TWILIO_API_SECRET"] account_sid = os.environ["TWILIO_ACCOUNT_SID"] client = Client(api_key, api_secret, account_sid) bucket = ( client.verify.v2.services("VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") .rate_limits("RKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") .buckets("BLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") .fetch() ) print(bucket.sid) ```