JavaScript
import Surge from '@surgeapi/node';
const client = new Surge({
apiKey: process.env['SURGE_API_KEY'], // This is the default and can be omitted
});
const verificationCheck = await client.verifications.check('vfn_01jayh15c2f2xamftg0xpyq1nj', {
code: '123456',
});
console.log(verificationCheck.result);import os
from surge import Surge
client = Surge(
api_key=os.environ.get("SURGE_API_KEY"), # This is the default and can be omitted
)
verification_check = client.verifications.check(
id="vfn_01jayh15c2f2xamftg0xpyq1nj",
code="123456",
)
print(verification_check.result)package main
import (
"context"
"fmt"
"github.com/stainless-sdks/surge-go"
"github.com/stainless-sdks/surge-go/option"
)
func main() {
client := surge.NewClient(
option.WithAPIKey("My API Key"),
)
verificationCheck, err := client.Verifications.Check(
context.TODO(),
"vfn_01jayh15c2f2xamftg0xpyq1nj",
surge.VerificationCheckParams{
Code: "123456",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", verificationCheck.Result)
}
require "surge_api"
surge = SurgeAPI::Client.new(api_key: "My API Key")
verification_check = surge.verifications.check("vfn_01jayh15c2f2xamftg0xpyq1nj", code: "123456")
puts(verification_check)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Surge\Client;
use Surge\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('SURGE_API_KEY') ?: 'My API Key');
try {
$verificationCheck = $client->verifications->check(
'vfn_01jayh15c2f2xamftg0xpyq1nj', code: '123456'
);
var_dump($verificationCheck);
} catch (APIException $e) {
echo $e->getMessage();
}curl --request POST \
--url https://api.surge.app/verifications/{id}/checks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"code": "123456"
}
'HttpResponse<String> response = Unirest.post("https://api.surge.app/verifications/{id}/checks")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"code\": \"123456\"\n}")
.asString();{
"result": "ok",
"verification": {
"attempt_count": 1,
"id": "vfn_01jayh15c2f2xamftg0xpyq1nj",
"phone_number": "+18015551234",
"status": "verified"
}
}Verifications
Check verification
Submit the OTP a user received to complete phone number verification.
POST
/
verifications
/
{id}
/
checks
JavaScript
import Surge from '@surgeapi/node';
const client = new Surge({
apiKey: process.env['SURGE_API_KEY'], // This is the default and can be omitted
});
const verificationCheck = await client.verifications.check('vfn_01jayh15c2f2xamftg0xpyq1nj', {
code: '123456',
});
console.log(verificationCheck.result);import os
from surge import Surge
client = Surge(
api_key=os.environ.get("SURGE_API_KEY"), # This is the default and can be omitted
)
verification_check = client.verifications.check(
id="vfn_01jayh15c2f2xamftg0xpyq1nj",
code="123456",
)
print(verification_check.result)package main
import (
"context"
"fmt"
"github.com/stainless-sdks/surge-go"
"github.com/stainless-sdks/surge-go/option"
)
func main() {
client := surge.NewClient(
option.WithAPIKey("My API Key"),
)
verificationCheck, err := client.Verifications.Check(
context.TODO(),
"vfn_01jayh15c2f2xamftg0xpyq1nj",
surge.VerificationCheckParams{
Code: "123456",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", verificationCheck.Result)
}
require "surge_api"
surge = SurgeAPI::Client.new(api_key: "My API Key")
verification_check = surge.verifications.check("vfn_01jayh15c2f2xamftg0xpyq1nj", code: "123456")
puts(verification_check)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Surge\Client;
use Surge\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('SURGE_API_KEY') ?: 'My API Key');
try {
$verificationCheck = $client->verifications->check(
'vfn_01jayh15c2f2xamftg0xpyq1nj', code: '123456'
);
var_dump($verificationCheck);
} catch (APIException $e) {
echo $e->getMessage();
}curl --request POST \
--url https://api.surge.app/verifications/{id}/checks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"code": "123456"
}
'HttpResponse<String> response = Unirest.post("https://api.surge.app/verifications/{id}/checks")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"code\": \"123456\"\n}")
.asString();{
"result": "ok",
"verification": {
"attempt_count": 1,
"id": "vfn_01jayh15c2f2xamftg0xpyq1nj",
"phone_number": "+18015551234",
"status": "verified"
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The ID of the verification to check against.
Example:
"vfn_01jayh15c2f2xamftg0xpyq1nj"
Body
application/json
Parameters for checking a Verification code
The Verification code that was received.
Pattern:
^[0-9]{6}$Example:
"123456"
Response
Correct code
The result of checking a Verification code
The result of the code check.
Available options:
ok, incorrect, exhausted, expired, already_verified A phone number verification
Show child attributes
Show child attributes
Example:
{
"attempt_count": 0,
"id": "vfn_01jayh15c2f2xamftg0xpyq1nj",
"phone_number": "+18015551234",
"status": "pending"
}