Validate an Email Validation
Endpointβ
POST https://api.verifik.co/v2/email-validations/{id}/validate
This service validates an email validation by providing the verification code. The system will check the code against the stored verification code and update the validation status accordingly.
Headersβ
Content-Typeβ
Type: String
Required: Required
Value: application/json
Authorizationβ
Type: String
Required: Required
Value: Bearer {YOUR_ACCESS_TOKEN}
Path Parametersβ
idβ
Type: String
Required: Yes
The unique identifier of the email validation record you want to validate.
Body Parametersβ
verificationCodeβ
Type: String
Required: Yes
The verification code received via email.
Requestβ
- Node.js
- Python
- PHP
- Go
import axios from 'axios';
const options = {
method: 'POST',
url: 'https://api.verifik.co/v2/email-validations/email_validation_123456789/validate',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer <your_token>'
},
data: {
verificationCode: '123456'
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
import http.client
import json
conn = http.client.HTTPSConnection("api.verifik.co")
payload = json.dumps({
"verificationCode": "123456"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer <your_token>'
}
conn.request("POST", "/v2/email-validations/email_validation_123456789/validate", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', 'https://api.verifik.co/v2/email-validations/email_validation_123456789/validate', [
'headers' => [
'Content-Type': 'application/json',
'Authorization' => 'Bearer <your_token>',
],
'json' => [
'verificationCode' => '123456'
]
]);
echo $response->getBody();
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
url := "https://api.verifik.co/v2/email-validations/email_validation_123456789/validate"
payload := map[string]interface{}{
"verificationCode": "123456",
}
jsonData, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Bearer <your_token>")
client := &http.Client{}
res, _ := client.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}
Responseβ
- 200
- 400
- 409
- 410
{
"success": true,
"data": {
"_id": "email_validation_123456789",
"client": "client_123456789",
"project": "project_123456789",
"projectFlow": "flow_123456789",
"status": "validated",
"email": "user@example.com",
"type": "validation",
"validationMethod": "verificationCode",
"verificationCode": "123456",
"expiresAt": "2024-01-15T11:30:00Z",
"attempts": 1,
"maxAttempts": 3,
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-15T10:32:00Z",
"validatedAt": "2024-01-15T10:32:00Z"
},
"signature": {
"dateTime": "April 11, 2023 12:25 PM",
"message": "Certified by Verifik.co"
}
}
{
"success": false,
"error": "Invalid verification code",
"code": "INVALID_CODE"
}
{
"success": false,
"error": "Verification code expired",
"code": "CODE_EXPIRED"
}
{
"success": false,
"error": "Maximum attempts exceeded",
"code": "MAX_ATTEMPTS_EXCEEDED"
}
Characteristicsβ
- Code Validation: Validates 6-digit OTP codes sent via email
- Attempt Control: Tracks validation attempts and maximum limits
- Expiration: Handles expired codes with appropriate responses
- Status Update: Updates validation status after successful verification
- Timestamps: Records when validation was completed
- Multiple Languages: Support for JavaScript, Python, PHP and Swift
- Error Handling: Detailed error responses for different scenarios