Verify verification code by phone number
POST
/
verifications
/
by_phone_number
/
{phone_number}
/
actions
/
verify
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const verifyVerificationCodeResponse = await client.verifications.byPhoneNumber.actions.verify(
'+13035551234',
{ code: '17686', verify_profile_id: '12ade33a-21c0-473b-b055-b3c836e1c292' },
);
console.log(verifyVerificationCodeResponse.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
verify_verification_code_response = client.verifications.by_phone_number.actions.verify(
phone_number="+13035551234",
code="17686",
verify_profile_id="12ade33a-21c0-473b-b055-b3c836e1c292",
)
print(verify_verification_code_response.data)package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
verifyVerificationCodeResponse, err := client.Verifications.ByPhoneNumber.Actions.Verify(
context.TODO(),
"+13035551234",
telnyx.VerificationByPhoneNumberActionVerifyParams{
Code: "17686",
VerifyProfileID: "12ade33a-21c0-473b-b055-b3c836e1c292",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", verifyVerificationCodeResponse.Data)
}package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.verifications.byphonenumber.actions.ActionVerifyParams;
import com.telnyx.sdk.models.verifications.byphonenumber.actions.VerifyVerificationCodeResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
ActionVerifyParams params = ActionVerifyParams.builder()
.phoneNumber("+13035551234")
.code("17686")
.verifyProfileId("12ade33a-21c0-473b-b055-b3c836e1c292")
.build();
VerifyVerificationCodeResponse verifyVerificationCodeResponse = client.verifications().byPhoneNumber().actions().verify(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
verify_verification_code_response = telnyx.verifications.by_phone_number.actions.verify(
"+13035551234",
code: "17686",
verify_profile_id: "12ade33a-21c0-473b-b055-b3c836e1c292"
)
puts(verify_verification_code_response)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$verifyVerificationCodeResponse = $client
->verifications
->byPhoneNumber
->actions
->verify(
'+13035551234',
code: '17686',
verifyProfileID: '12ade33a-21c0-473b-b055-b3c836e1c292',
);
var_dump($verifyVerificationCodeResponse);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx verifications:by-phone-number:actions verify \
--api-key 'My API Key' \
--phone-number +13035551234 \
--code 17686 \
--verify-profile-id 12ade33a-21c0-473b-b055-b3c836e1c292curl --request POST \
--url https://api.telnyx.com/v2/verifications/by_phone_number/{phone_number}/actions/verify \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"code": "17686",
"verify_profile_id": "12ade33a-21c0-473b-b055-b3c836e1c292"
}
'{
"data": {
"phone_number": "+13035551234",
"response_code": "accepted"
}
}{
"errors": [
{
"code": "10015",
"title": "Invalid sorting value",
"detail": "The value provided for sorting is not valid. Check the value used and try again.",
"source": {
"pointer": "/sort",
"parameter": "<string>"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10015"
}
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The phone number associated with the verification code being verified. +E164 formatted phone number.
Example:
"+13035551234"
Body
application/json
Response
Expected verify response to a valid request.
Show child attributes
Show child attributes
Was this page helpful?
⌘I
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const verifyVerificationCodeResponse = await client.verifications.byPhoneNumber.actions.verify(
'+13035551234',
{ code: '17686', verify_profile_id: '12ade33a-21c0-473b-b055-b3c836e1c292' },
);
console.log(verifyVerificationCodeResponse.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
verify_verification_code_response = client.verifications.by_phone_number.actions.verify(
phone_number="+13035551234",
code="17686",
verify_profile_id="12ade33a-21c0-473b-b055-b3c836e1c292",
)
print(verify_verification_code_response.data)package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
verifyVerificationCodeResponse, err := client.Verifications.ByPhoneNumber.Actions.Verify(
context.TODO(),
"+13035551234",
telnyx.VerificationByPhoneNumberActionVerifyParams{
Code: "17686",
VerifyProfileID: "12ade33a-21c0-473b-b055-b3c836e1c292",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", verifyVerificationCodeResponse.Data)
}package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.verifications.byphonenumber.actions.ActionVerifyParams;
import com.telnyx.sdk.models.verifications.byphonenumber.actions.VerifyVerificationCodeResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
ActionVerifyParams params = ActionVerifyParams.builder()
.phoneNumber("+13035551234")
.code("17686")
.verifyProfileId("12ade33a-21c0-473b-b055-b3c836e1c292")
.build();
VerifyVerificationCodeResponse verifyVerificationCodeResponse = client.verifications().byPhoneNumber().actions().verify(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
verify_verification_code_response = telnyx.verifications.by_phone_number.actions.verify(
"+13035551234",
code: "17686",
verify_profile_id: "12ade33a-21c0-473b-b055-b3c836e1c292"
)
puts(verify_verification_code_response)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$verifyVerificationCodeResponse = $client
->verifications
->byPhoneNumber
->actions
->verify(
'+13035551234',
code: '17686',
verifyProfileID: '12ade33a-21c0-473b-b055-b3c836e1c292',
);
var_dump($verifyVerificationCodeResponse);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx verifications:by-phone-number:actions verify \
--api-key 'My API Key' \
--phone-number +13035551234 \
--code 17686 \
--verify-profile-id 12ade33a-21c0-473b-b055-b3c836e1c292curl --request POST \
--url https://api.telnyx.com/v2/verifications/by_phone_number/{phone_number}/actions/verify \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"code": "17686",
"verify_profile_id": "12ade33a-21c0-473b-b055-b3c836e1c292"
}
'{
"data": {
"phone_number": "+13035551234",
"response_code": "accepted"
}
}{
"errors": [
{
"code": "10015",
"title": "Invalid sorting value",
"detail": "The value provided for sorting is not valid. Check the value used and try again.",
"source": {
"pointer": "/sort",
"parameter": "<string>"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10015"
}
}
]
}