API Documentation

Face Detection API

post
https://[face api url]
/detect/single
Face Detection For Single Face

Parameter in Response

Name
Type
Description
bbox
Dictionary
Face bounding boxes of personal
xmax
Float
Maximum value in the x-axis
xmin
Float
Minimum value in the x-axis
ymax
Float
Maximum value in the y-axis
ymin
Float
Minimum value in the y-axis
detection_score
String
Detection score of face in image.
face
Base64
Face image in base64 format
message
String
The processing status
process_time
Float
The processing time

Sample Requests

CURL
Java - Unirest
NodeJS - Request
Objective C
PHP
Python
1
//Use default score
2
curl --location --request POST 'https://[face api url]/detect/single' \
3
--header 'apikey: {Your API Key}' \
4
--form '[email protected]"{Your Image File Path}"'
5
6
//Use score of each company
7
curl --location --request POST 'https://[face api url]/detect/single' \
8
--header 'apikey: {Your API Key}' \
9
--form '[email protected]"{Your Image File Path}"'
10
--form 'company="{Your Company Name}"'
11
Copied!
1
Unirest.setTimeouts(0, 0);
2
HttpResponse<String> response = Unirest.post("https://[face api url]/detect/single")
3
.header("apikey", "{Your API Key}")
4
.field("file", new File("{Your Image File Path}"))
5
6
// Use score of each company
7
.field("company", "{Your Company Name}")
8
9
// Use default score
10
//.field("company", "{Your Company Name}")
11
12
.asString();
Copied!
1
var request = require('request');
2
var fs = require('fs');
3
var options = {
4
'method': 'POST',
5
'url': 'https://[face api url]/detect/single',
6
'headers': {
7
'apikey': '{Your API Key}'
8
},
9
formData: {
10
'file': {
11
'value': fs.createReadStream('{Your Image File Path}'),
12
'options': {
13
'filename': '{Your Image File Name}'
14
'contentType': null
15
}
16
},
17
18
// Use score of each company
19
'company': '{Your Company Name}'
20
21
// Use default score
22
//'company': '{Your Company Name}'
23
}
24
};
25
request(options, function (error, response) {
26
if (error) throw new Error(error);
27
console.log(response.body);
28
});
Copied!
1
#import <Foundation/Foundation.h>
2
3
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
4
5
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://[face api url]/detect/single"]
6
cachePolicy:NSURLRequestUseProtocolCachePolicy
7
timeoutInterval:10.0];
8
NSDictionary *headers = @{
9
@"apikey": @"{Your API Key}"
10
};
11
12
[request setAllHTTPHeaderFields:headers];
13
NSArray *parameters = @[
14
@{ @"name": @"file", @"fileName": @"{Your Image File Path}" },
15
16
// Use score of each company
17
@{ @"name": @"company", @"value": @"{Your Company Name}" }
18
19
// Use default score
20
// @{ @"name": @"company", @"value": @"{Your Company Name}" }
21
22
];
23
24
NSString *boundary = @"----WebKitFormBoundary7MA4YWxkTrZu0gW";
25
NSError *error;
26
NSMutableString *body = [NSMutableString string];
27
28
for (NSDictionary *param in parameters) {
29
[body appendFormat:@"--%@\r\n", boundary];
30
if (param[@"fileName"]) {
31
[body appendFormat:@"Content-Disposition:form-data; name=\"%@\"; filename=\"%@\"\r\n", param[@"name"], param[@"fileName"]];
32
[body appendFormat:@"Content-Type: %@\r\n\r\n", param[@"contentType"]];
33
[body appendFormat:@"%@", [NSString stringWithContentsOfFile:param[@"fileName"] encoding:NSUTF8StringEncoding error:&error]];
34
if (error) {
35
NSLog(@"%@", error);
36
}
37
} else {
38
[body appendFormat:@"Content-Disposition:form-data; name=\"%@\"\r\n\r\n", param[@"name"]];
39
[body appendFormat:@"%@", param[@"value"]];
40
}
41
}
42
[body appendFormat:@"\r\n--%@--\r\n", boundary];
43
NSData *postData = [body dataUsingEncoding:NSUTF8StringEncoding];
44
[request setHTTPBody:postData];
45
46
[request setHTTPMethod:@"POST"];
47
48
NSURLSession *session = [NSURLSession sharedSession];
49
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
50
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
51
if (error) {
52
NSLog(@"%@", error);
53
dispatch_semaphore_signal(sema);
54
} else {
55
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
56
NSError *parseError = nil;
57
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
58
NSLog(@"%@",responseDictionary);
59
dispatch_semaphore_signal(sema);
60
}
61
}];
62
[dataTask resume];
63
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
Copied!
1
<?php
2
require_once 'HTTP/Request2.php';
3
$request = new HTTP_Request2();
4
$request->setUrl('https://[face api url]/detect/single');
5
$request->setMethod(HTTP_Request2::METHOD_POST);
6
$request->setConfig(array(
7
'follow_redirects' => TRUE
8
));
9
$request->setHeader(array(
10
'apikey' => '{Your API Key}'
11
));
12
13
// Use score of each company
14
$request->addPostParameter(array(
15
'company' => '{Your Company Name}'
16
));
17
18
// Use default score
19
//$request->addPostParameter(array(
20
// 'company' => '{Your Company Name}'
21
//));
22
23
$request->addUpload('file', '{Your Image File Path}', '{Your Image File Name}', '<Content-Type Header>');
24
try {
25
$response = $request->send();
26
if ($response->getStatus() == 200) {
27
echo $response->getBody();
28
}
29
else {
30
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
31
$response->getReasonPhrase();
32
}
33
}
34
catch(HTTP_Request2_Exception $e) {
35
echo 'Error: ' . $e->getMessage();
36
}
37
Copied!
1
import requests
2
3
url = "https://[face api url]/detect/single"
4
5
# Use score of each company
6
payload={'company': '{Your Company Name}'}
7
8
# Use default score
9
payload={}
10
11
files=[
12
('file',('{Your Image File Name}',open('{Your Image File Path}','rb'),'image/jpeg'))
13
]
14
headers = {
15
'apikey': '{Your API Key}'
16
}
17
18
response = requests.request("POST", url, headers=headers, data=payload, files=files)
19
20
print(response.text)
21
Copied!
post
https://[face api url]
/detect/multi
Face Detection For Multiple Face

Parameter in Response

Name
Type
Description
message
String
The processing status
process_time
Float
The processing time
result
Array
The data in dictionary for each personal
bbox
Dictionary
Face bounding boxes of personal
xmax
Float
Maximum value in the x-axis
xmin
Float
Minimum value in the x-axis
ymax
Float
Maximum value in the y-axis
ymin
Float
Minimum value in the y-axis
detection_score
String
Detection score of face in image.
face
Base64
Face image in base64 format
Sample Requests
CURL
Java - Unirest
NodeJS - Request
Objective C
PHP
Python
1
//Use default score
2
curl --location --request POST 'https://[face api url]/detect/multi' \
3
--header 'apikey: {Your API Key}' \
4
--form '[email protected]"{Your Image File Path}"'
5
6
//Use score of each company
7
curl --location --request POST 'https://[face api url]/detect/multi' \
8
--header 'apikey: {Your API Key}' \
9
--form '[email protected]"{Your Image File Path}"'
10
--form 'company="{Your Company Name}"'
11
Copied!
1
Unirest.setTimeouts(0, 0);
2
HttpResponse<String> response = Unirest.post("https://[face api url]/detect/multi")
3
.header("apikey", "{Your API Key}")
4
.field("file", new File("{Your Image File Path}"))
5
6
// Use score of each company
7
.field("company", "{Your Company Name}")
8
9
// Use default score
10
//.field("company", "{Your Company Name}")
11
12
.asString();
Copied!
1
var request = require('request');
2
var fs = require('fs');
3
var options = {
4
'method': 'POST',
5
'url': 'https://[face api url]/detect/multi',
6
'headers': {
7
'apikey': '{Your API Key}'
8
},
9
formData: {
10
'file': {
11
'value': fs.createReadStream('{Your Image File Path}'),
12
'options': {
13
'filename': '{Your Image File Name}'
14
'contentType': null
15
}
16
}
17
// Use score of each company
18
,
19
'company': '{Your Company Name}'
20
21
// Use default score
22
//'company': '{Your Company Name}'
23
}
24
};
25
request(options, function (error, response) {
26
if (error) throw new Error(error);
27
console.log(response.body);
28
});
Copied!
1
#import <Foundation/Foundation.h>
2
3
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
4
5
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://[face api url]/detect/multi"]
6
cachePolicy:NSURLRequestUseProtocolCachePolicy
7
timeoutInterval:10.0];
8
NSDictionary *headers = @{
9
@"apikey": @"{Your API Key}"
10
};
11
12
[request setAllHTTPHeaderFields:headers];
13
NSArray *parameters = @[
14
@{ @"name": @"file", @"fileName": @"{Your Image File Path}" },
15
16
// Use score of each company
17
@{ @"name": @"company", @"value": @"{Your Company Name}" }
18
19
// Use default score
20
// @{ @"name": @"company", @"value": @"{Your Company Name}" }
21
22
];
23
24
NSString *boundary = @"----WebKitFormBoundary7MA4YWxkTrZu0gW";
25
NSError *error;
26
NSMutableString *body = [NSMutableString string];
27
28
for (NSDictionary *param in parameters) {
29
[body appendFormat:@"--%@\r\n", boundary];
30
if (param[@"fileName"]) {
31
[body appendFormat:@"Content-Disposition:form-data; name=\"%@\"; filename=\"%@\"\r\n", param[@"name"], param[@"fileName"]];
32
[body appendFormat:@"Content-Type: %@\r\n\r\n", param[@"contentType"]];
33
[body appendFormat:@"%@", [NSString stringWithContentsOfFile:param[@"fileName"] encoding:NSUTF8StringEncoding error:&error]];
34
if (error) {
35
NSLog(@"%@", error);
36
}
37
} else {
38
[body appendFormat:@"Content-Disposition:form-data; name=\"%@\"\r\n\r\n", param[@"name"]];
39
[body appendFormat:@"%@", param[@"value"]];
40
}
41
}
42
[body appendFormat:@"\r\n--%@--\r\n", boundary];
43
NSData *postData = [body dataUsingEncoding:NSUTF8StringEncoding];
44
[request setHTTPBody:postData];
45
46
[request setHTTPMethod:@"POST"];
47
48
NSURLSession *session = [NSURLSession sharedSession];
49
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
50
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
51
if (error) {
52
NSLog(@"%@", error);
53
dispatch_semaphore_signal(sema);
54
} else {
55
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
56
NSError *parseError = nil;
57
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
58
NSLog(@"%@",responseDictionary);
59
dispatch_semaphore_signal(sema);
60
}
61
}];
62
[dataTask resume];
63
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
Copied!
1
<?php
2
require_once 'HTTP/Request2.php';
3
$request = new HTTP_Request2();
4
$request->setUrl('https://[face api url]/detect/multi');
5
$request->setMethod(HTTP_Request2::METHOD_POST);
6
$request->setConfig(array(
7
'follow_redirects' => TRUE
8
));
9
$request->setHeader(array(
10
'apikey' => '{Your API Key}'
11
));
12
13
// Use score of each company
14
$request->addPostParameter(array(
15
'company' => '{Your Company Name}'
16
));
17
18
// Use default score
19
//$request->addPostParameter(array(
20
// 'company' => '{Your Company Name}'
21
//));
22
23
$request->addUpload('file', '{Your Image File Path}', '{Your Image File Name}', '<Content-Type Header>');
24
try {
25
$response = $request->send();
26
if ($response->getStatus() == 200) {
27
echo $response->getBody();
28
}
29
else {
30
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
31
$response->getReasonPhrase();
32
}
33
}
34
catch(HTTP_Request2_Exception $e) {
35
echo 'Error: ' . $e->getMessage();
36
}
37
Copied!
1
import requests
2
3
url = "https://[face api url]/detect/multi"
4
5
# Use score of each company
6
payload={'company': '{Your Company Name}'}
7
8
# Use default score
9
payload={}
10
11
files=[
12
('file',('{Your Image File Name}',open('{Your Image File Path}','rb'),'image/jpeg'))
13
]
14
headers = {
15
'apikey': '{Your API Key}'
16
}
17
18
response = requests.request("POST", url, headers=headers, data=payload, files=files)
19
20
print(response.text)
Copied!

Face Detection Tool

get
https://[face api url]
/config
Default Score Configuration

Parameter in Response

Name
Type
Description
company
String
The company name
detection_score
Float
The default score of face detection
message
String
The Processing status

Sample Requests

CURL
Java - Unirest
NodeJS - Request
Objective C
PHP
Python
1
// Configure Score
2
curl --location -g --request GET 'https://[face api url]/config?detection={Detection Value}&company={Your Company Name}&password={Your Company Password}' \
3
--header 'apikey: {Your API Key}'
4
5
// Show Score
6
curl --location -g --request GET 'https://[face api url]/config?detection&company={Your Company Name}&password={Your Company Password}' \
7
--header 'apikey: {Your API Key}'
Copied!
1
Unirest.setTimeouts(0, 0);
2
3
// Configure Score
4
HttpResponse<String> response = Unirest.get("https://[face api url]/config?detection={Detection Value}&company={Your Company Name}&password={Your Company Password}")
5
.header("apikey", "{Your API Key}")
6
.multiPartContent()
7
.asString();
8
9
// Configure Score
10
HttpResponse<String> response = Unirest.get("https://[face api url]/config?detection&company={Your Company Name}&password={Your Company Password}")
11
.header("apikey", "{Your API Key}")
12
.multiPartContent()
13
.asString();
Copied!
1
var request = require('request');
2
var options = {
3
'method': 'GET',
4
5
// Configure Score
6
'url': 'https://[face api url]/config?detection={Detection Value}&company={Your Company Name}&password={Your Company Password}',
7
8
// Configure Score
9
'url': 'https://[face api url]/config?detection&company={Your Company Name}&password={Your Company Password}',
10
11
'headers': {
12
'apikey': '{Your API Key}'
13
},
14
formData: {
15
16
}
17
};
18
request(options, function (error, response) {
19
if (error) throw new Error(error);
20
console.log(response.body);
21
});
22
Copied!
1
#import <Foundation/Foundation.h>
2
3
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
4
5
// Configure Score
6
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://[face api url]/config?detection={Detection Value}&company={Your Company Name}&password={Your Company Password}"]
7
cachePolicy:NSURLRequestUseProtocolCachePolicy
8
timeoutInterval:10.0];
9
10
// Show Score
11
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://[face api url]/config?detection&company={Your Company Name}&password={Your Company Password}"]
12
cachePolicy:NSURLRequestUseProtocolCachePolicy
13
timeoutInterval:10.0];
14
15
NSDictionary *headers = @{
16
@"apikey": @"{Your API Key}"
17
};
18
19
[request setAllHTTPHeaderFields:headers];
20
21
[request setHTTPMethod:@"GET"];
22
23
NSURLSession *session = [NSURLSession sharedSession];
24
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
25
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
26
if (error) {
27
NSLog(@"%@", error);
28
dispatch_semaphore_signal(sema);
29
} else {
30
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
31
NSError *parseError = nil;
32
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
33
NSLog(@"%@",responseDictionary);
34
dispatch_semaphore_signal(sema);
35
}
36
}];
37
[dataTask resume];
38
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
Copied!
1
<?php
2
require_once 'HTTP/Request2.php';
3
$request = new HTTP_Request2();
4
5
// Configure Score
6
$request->setUrl('https://[face api url]/config?detection={Detection Value}&company={Your Company Name}&password={Your Company Password}');
7
8
// Show Score
9
$request->setUrl('https://[face api url]/config?detection&company={Your Company Name}&password={Your Company Password}');
10
11
$request->setMethod(HTTP_Request2::METHOD_GET);
12
$request->setConfig(array(
13
'follow_redirects' => TRUE
14
));
15
$request->setHeader(array(
16
'apikey' => '{Your API Key}'
17
));
18
try {
19
$response = $request->send();
20
if ($response->getStatus() == 200) {
21
echo $response->getBody();
22
}
23
else {
24
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
25
$response->getReasonPhrase();
26
}
27
}
28
catch(HTTP_Request2_Exception $e) {
29
echo 'Error: ' . $e->getMessage();
30
}
Copied!
1
import requests
2
3
# Configure Score
4
url = "https://[face api url]/config?detection={Detection Value}&company={Your Company Name}&password={Your Company Password}"
5
6
# Show Score
7
url = "https://[face api url]/config?detection&company={Your Company Name}&password={Your Company Password}"
8
9
payload={}
10
files={}
11
headers = {
12
'apikey': '{Your API Key}'
13
}
14
15
response = requests.request("GET", url, headers=headers, data=payload, files=files)
16
17
print(response.text)
Copied!
Last modified 1mo ago