Verify IP
curl --request POST \
--url https://sandbox.cashfree.com/verification/ip \
--header 'Content-Type: application/json' \
--header 'x-client-id: <api-key>' \
--header 'x-client-secret: <api-key>' \
--data '
{
"ip_address": "1.0.171.255",
"verification_id": "testverificationid"
}
'import requests
url = "https://sandbox.cashfree.com/verification/ip"
payload = {
"ip_address": "1.0.171.255",
"verification_id": "testverificationid"
}
headers = {
"x-client-id": "<api-key>",
"x-client-secret": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-client-id': '<api-key>',
'x-client-secret': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({ip_address: '1.0.171.255', verification_id: 'testverificationid'})
};
fetch('https://sandbox.cashfree.com/verification/ip', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sandbox.cashfree.com/verification/ip",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'ip_address' => '1.0.171.255',
'verification_id' => 'testverificationid'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-client-id: <api-key>",
"x-client-secret: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sandbox.cashfree.com/verification/ip"
payload := strings.NewReader("{\n \"ip_address\": \"1.0.171.255\",\n \"verification_id\": \"testverificationid\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-client-id", "<api-key>")
req.Header.Add("x-client-secret", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://sandbox.cashfree.com/verification/ip")
.header("x-client-id", "<api-key>")
.header("x-client-secret", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"ip_address\": \"1.0.171.255\",\n \"verification_id\": \"testverificationid\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.cashfree.com/verification/ip")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-client-id"] = '<api-key>'
request["x-client-secret"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"ip_address\": \"1.0.171.255\",\n \"verification_id\": \"testverificationid\"\n}"
response = http.request(request)
puts response.read_body{
"value": {
"reference_id": 1358,
"verification_id": "testverificationid",
"status": "VALID",
"ip_address": "1.0.171.255",
"proxy_type": "VPA",
"country_code": "TH",
"country_name": "Thailand",
"region_name": "Phangna",
"city_name": "Phang Nga",
"city_risk_score": "0",
"proxy_type_risk_score": "0"
}
}Verify IP
Use this API to verify location, proxy details, city risk score, and proxy type risk score of an IP address. View the test data and use the information to trigger the validations. The test data are usable only in the test environments such as gamma and sandbox.
Response Codes
| Sub Code | Status | Message | Next Action |
|---|---|---|---|
| 200 | SUCCESS | VALID | - |
| 400 | ERROR | x-client-id is missing in the request. | Enter all the header information in the request. |
| 400 | ERROR | verification_id already exists. | Enter a unique verification ID to identify the request. |
| 400 | ERROR | Client secret belongs to test environment | Enter the correct environment credentials in the request. |
| 400 | ERROR | please enter a valid IP address | Enter a valid IP address in the request. |
| 401 | ERROR | Invalid clientId and clientSecret combination | Ensure you enter valid x-client-id and x-client-secret information in the API request. |
| 403 | ERROR | IP not whitelisted your current ip is 106.51.91.104.For IP whitelisting assistance, visit our guide at https://www.cashfree.com/docs/secure-id/get-started/integration/ip-whitelisting-verification | Whitelist the IP address. |
| 404 | ERROR | unable to find IP details | Enter a valid IP address in the request. |
| 422 | ERROR | Insufficient balance to process this request | Try again with sufficient balance. |
| 500 | ERROR | something went wrong, please try after some time | Try again after some time. |
POST
/
ip
Verify IP
curl --request POST \
--url https://sandbox.cashfree.com/verification/ip \
--header 'Content-Type: application/json' \
--header 'x-client-id: <api-key>' \
--header 'x-client-secret: <api-key>' \
--data '
{
"ip_address": "1.0.171.255",
"verification_id": "testverificationid"
}
'import requests
url = "https://sandbox.cashfree.com/verification/ip"
payload = {
"ip_address": "1.0.171.255",
"verification_id": "testverificationid"
}
headers = {
"x-client-id": "<api-key>",
"x-client-secret": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-client-id': '<api-key>',
'x-client-secret': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({ip_address: '1.0.171.255', verification_id: 'testverificationid'})
};
fetch('https://sandbox.cashfree.com/verification/ip', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sandbox.cashfree.com/verification/ip",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'ip_address' => '1.0.171.255',
'verification_id' => 'testverificationid'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-client-id: <api-key>",
"x-client-secret: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sandbox.cashfree.com/verification/ip"
payload := strings.NewReader("{\n \"ip_address\": \"1.0.171.255\",\n \"verification_id\": \"testverificationid\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-client-id", "<api-key>")
req.Header.Add("x-client-secret", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://sandbox.cashfree.com/verification/ip")
.header("x-client-id", "<api-key>")
.header("x-client-secret", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"ip_address\": \"1.0.171.255\",\n \"verification_id\": \"testverificationid\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.cashfree.com/verification/ip")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-client-id"] = '<api-key>'
request["x-client-secret"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"ip_address\": \"1.0.171.255\",\n \"verification_id\": \"testverificationid\"\n}"
response = http.request(request)
puts response.read_body{
"value": {
"reference_id": 1358,
"verification_id": "testverificationid",
"status": "VALID",
"ip_address": "1.0.171.255",
"proxy_type": "VPA",
"country_code": "TH",
"country_name": "Thailand",
"region_name": "Phangna",
"city_name": "Phang Nga",
"city_risk_score": "0",
"proxy_type_risk_score": "0"
}
}Authorizations
Client ID. You can find your ID in the Merchant Dashboard.
Client secret key. You can find your secret key in the Merchant Dashboard.
Body
application/json
Find the request parameters to retrieve location information of an IP address
Response
IP verified successfully
