Verify by URL
Verify a bank slip by providing a URL to the image.
Endpoint
http
POST /verify/bankFull URL: https://api.easyslip.com/v2/verify/bank
Authentication
Required. See Authentication Guide.
http
Authorization: Bearer YOUR_API_KEY
Content-Type: application/jsonRequest
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | Yes | URL to slip image (1-255 characters) |
remark | string | No | Custom remark (1-255 characters) |
matchAccount | boolean | No | Match receiver with registered accounts |
matchAmount | number | No | Expected amount to validate |
checkDuplicate | boolean | No | Check for duplicate slip |
URL Requirements
| Requirement | Value |
|---|---|
| Protocol | HTTP or HTTPS only |
| Maximum length | 255 characters |
| Content type | Must return a valid image |
| Maximum size | 4 MB |
| IP restrictions | No private/internal IP addresses |
Blocked URLs
The following are not allowed for security reasons:
- Private IP ranges:
10.x.x.x,172.16-31.x.x,192.168.x.x - Localhost:
127.0.0.1,localhost - Link-local:
169.254.x.x - Non-HTTP protocols:
file://,ftp://, etc.
Type Definitions
typescript
// Request
interface VerifyByUrlRequest {
url: string; // 1-255 chars
remark?: string; // 1-255 chars
matchAccount?: boolean;
matchAmount?: number;
checkDuplicate?: boolean;
}
// Response
interface VerifyBankResponse {
success: true;
data: VerifyBankData;
message: string;
}
interface VerifyBankData {
remark?: string;
isDuplicate: boolean;
matchedAccount: MatchedAccount | null;
amountInOrder?: number;
amountInSlip: number;
isAmountMatched?: boolean;
rawSlip: RawSlip;
}
// See POST /verify/bank for full type definitionsExamples
bash
curl -X POST https://api.easyslip.com/v2/verify/bank \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/slips/slip-12345.jpg",
"checkDuplicate": true
}'javascript
const verifyByUrl = async (url, options = {}) => {
const response = await fetch('https://api.easyslip.com/v2/verify/bank', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({ url, ...options })
});
const result = await response.json();
if (!result.success) {
throw new Error(result.error.message);
}
return result.data;
};
// Usage
const slip = await verifyByUrl('https://example.com/slips/slip-12345.jpg', {
checkDuplicate: true,
matchAmount: 1500.00
});
console.log('Amount:', slip.rawSlip.amount.amount);
console.log('Is Amount Matched:', slip.isAmountMatched);php
function verifyByUrl(string $url, array $options = []): array
{
$apiKey = getenv('EASYSLIP_API_KEY');
$data = array_merge(['url' => $url], $options);
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => 'https://api.easyslip.com/v2/verify/bank',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $apiKey,
'Content-Type: application/json'
],
CURLOPT_POSTFIELDS => json_encode($data)
]);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
if (!$result['success']) {
throw new Exception($result['error']['message']);
}
return $result['data'];
}
// Usage
$slip = verifyByUrl('https://example.com/slips/slip-12345.jpg', [
'checkDuplicate' => true
]);
echo "Amount: " . $slip['rawSlip']['amount']['amount'];python
import requests
import os
def verify_by_url(url: str, **options) -> dict:
response = requests.post(
'https://api.easyslip.com/v2/verify/bank',
headers={
'Authorization': f'Bearer {os.environ["EASYSLIP_API_KEY"]}',
'Content-Type': 'application/json'
},
json={'url': url, **options}
)
result = response.json()
if not result['success']:
raise Exception(result['error']['message'])
return result['data']
# Usage
slip = verify_by_url(
'https://example.com/slips/slip-12345.jpg',
checkDuplicate=True
)
print(f"Amount: {slip['rawSlip']['amount']['amount']}")Response
Success (200)
json
{
"success": true,
"data": {
"isDuplicate": false,
"rawSlip": {
"payload": "00000000000000000000000000000000000000000000000",
"transRef": "68370160657749I376388B35",
"date": "2024-01-15T14:30:00+07:00",
"amount": {
"amount": 1500.00
},
"sender": {
"bank": { "id": "004", "name": "กสิกรไทย", "short": "KBANK" },
"account": { "name": { "th": "นาย ผู้โอน ทดสอบ" } }
},
"receiver": {
"bank": { "id": "014", "name": "ไทยพาณิชย์", "short": "SCB" },
"account": { "name": { "th": "นาย รับเงิน ทดสอบ" } }
}
}
},
"message": "Bank slip verified successfully"
}Error Responses
Invalid URL Protocol (400)
json
{
"success": false,
"error": {
"code": "URL_PROTOCOL_NOT_ALLOWED",
"message": "Only HTTP and HTTPS protocols are allowed"
}
}Invalid IP Range (400)
json
{
"success": false,
"error": {
"code": "URL_INVALID_IP_RANGE",
"message": "URL points to a restricted IP range"
}
}URL Unreachable (400)
json
{
"success": false,
"error": {
"code": "IMAGE_URL_UNREACHABLE",
"message": "Unable to access the image URL"
}
}Invalid Image Type (400)
json
{
"success": false,
"error": {
"code": "INVALID_IMAGE_TYPE",
"message": "URL does not point to a valid image"
}
}Image Too Large (400)
json
{
"success": false,
"error": {
"code": "IMAGE_SIZE_TOO_LARGE",
"message": "Image size exceeds 4MB limit"
}
}Notes
- Use HTTPS URLs for security
- URL must be publicly accessible
- Server should return correct Content-Type header
- API has a 10-second timeout for URL fetching
- For reliability, host images on a CDN