API Documentation
We hate long and boring documentation too. Let's skip right to the code examples.
Quickstart Guide
Sign up for the API
You’ll be calling the API using your Mashape Key. You’ll need to sign up for our API to get your key.
Sign Up to Our Facial Recognition APICreate an Album
An album is a set of labeled images. Albums are used to recognize new images that haven’t been seen yet. Let’s create our first album.
-
curl -X POST --include "https://lambda-face-recognition.p.mashape.com/detect" \ -H "X-Mashape-Key: dM7WpZJTUEmshLqtOqwlNvdZvCyEp1ZRGv9jsncz9Xzanba7oT" \ -F "files=@<file goes here>" \ -F "urls=http://www.lambdal.com/test2.jpg"
-
response = Unirest.post "https://lambda-face-recognition.p.mashape.com/album", headers:{:X-Mashape-Key => "dM7WpZJTUEmshLqtOqwlNvdZvCyEp1ZRGv9jsncz9Xzanba7oT"}, parameters:{:album => "CELEBS"}
-
response = Unirest.post("https://lambda-face-recognition.p.mashape.com/album", headers={"X-Mashape-Key": "dM7WpZJTUEmshLqtOqwlNvdZvCyEp1ZRGv9jsncz9Xzanba7oT"}, params={"album": CELEBS"})
-
$response = Unirest::post("https://lambda-face-recognition.p.mashape.com/album", array( "X-Mashape-Key" => "dM7WpZJTUEmshLqtOqwlNvdZvCyEp1ZRGv9jsncz9Xzanba7oT" ), array( "album" => "CELEBS" ) );
-
unirest.post("https://lambda-face-recognition.p.mashape.com/album") .header("X-Mashape-Key", "dM7WpZJTUEmshLqtOqwlNvdZvCyEp1ZRGv9jsncz9Xzanba7oT") .field("album", "CELEBS") .end(function (result) { console.log(result.status, result.headers, result.body); });
-
HttpResponse<JsonNode> response = Unirest.post("https://lambda-face-recognition.p.mashape.com/album") .header("X-Mashape-Key", "dM7WpZJTUEmshLqtOqwlNvdZvCyEp1ZRGv9jsncz9Xzanba7oT") .field("album", "CELEBS") .asJson();
-
Task<HttpResponse<MyClass>> response = Unirest.post("https://lambda-face-recognition.p.mashape.com/album") .header("X-Mashape-Key", "dM7WpZJTUEmshLqtOqwlNvdZvCyEp1ZRGv9jsncz9Xzanba7oT") .field("album", "CELEBS") .asJson();
-
NSDictionary *headers = @{@"X-Mashape-Key": @"dM7WpZJTUEmshLqtOqwlNvdZvCyEp1ZRGv9jsncz9Xzanba7oT"}; NSDictionary *parameters = @{@"album": @"CELEBS"}; UNIUrlConnection *asyncConnection = [[UNIRest post:^(UNISimpleRequest *request) { [request setUrl:@"https://lambda-face-recognition.p.mashape.com/album"]; [request setHeaders:headers]; [request setParameters:parameters]; }] asJsonAsync:^(UNIHTTPJsonResponse *response, NSError *error) { NSInteger code = response.code; NSDictionary *responseHeaders = response.headers; UNIJsonNode *body = response.body; NSData *rawBody = response.rawBody; }];
Train the Album
Give the album a few labeled images to work with. The more images you give it, the more accurate the model will be. Note, you can give us either urls or files.
-
curl -X POST --include "https://lambda-face-recognition.p.mashape.com/album_train" \ -H "X-Mashape-Key: dM7WpZJTUEmshLqtOqwlNvdZvCyEp1ZRGv9jsncz9Xzanba7oT" \ -F "album=CELEBS" \ -F "albumkey=b1ccb6caa8cefb7347d0cfb65146d5e3f84608f6ee55b1c90d37ed4ecca9b273" \ -F "entryid=TigerWoods" \ -F "files=@<file goes here>" \ -F "urls=http://www.lambdal.com/tiger.jpg"
-
response = Unirest.post "https://lambda-face-recognition.p.mashape.com/album_train", headers:{:X-Mashape-Key => "dM7WpZJTUEmshLqtOqwlNvdZvCyEp1ZRGv9jsncz9Xzanba7oT"}, parameters:{:album => "CELEBS", :albumkey => "b1ccb6caa8cefb7347d0cfb65146d5e3f84608f6ee55b1c90d37ed4ecca9b273", :entryid => "TigerWoods", :files => File.new("<file goes here>"), :urls => "http://www.lambdal.com/tiger.jpg"}
-
response = Unirest.post("https://lambda-face-recognition.p.mashape.com/album_train", headers={"X-Mashape-Key": "dM7WpZJTUEmshLqtOqwlNvdZvCyEp1ZRGv9jsncz9Xzanba7oT"}, params={"album": CELEBS", "albumkey": b1ccb6caa8cefb7347d0cfb65146d5e3f84608f6ee55b1c90d37ed4ecca9b273", "entryid": TigerWoods", "files": open("<file goes here>", mode="r"), "urls": http://www.lambdal.com/tiger.jpg"})
-
$response = Unirest::post("https://lambda-face-recognition.p.mashape.com/album_train", array( "X-Mashape-Key" => "dM7WpZJTUEmshLqtOqwlNvdZvCyEp1ZRGv9jsncz9Xzanba7oT" ), array( "album" => "CELEBS", "albumkey" => "b1ccb6caa8cefb7347d0cfb65146d5e3f84608f6ee55b1c90d37ed4ecca9b273", "entryid" => "TigerWoods", "files" => Unirest::file("<file goes here>"), "urls" => "http://www.lambdal.com/tiger.jpg" ) );
-
unirest.post("https://lambda-face-recognition.p.mashape.com/album_train") .header("X-Mashape-Key", "dM7WpZJTUEmshLqtOqwlNvdZvCyEp1ZRGv9jsncz9Xzanba7oT") .field("album", "CELEBS") .field("albumkey", "b1ccb6caa8cefb7347d0cfb65146d5e3f84608f6ee55b1c90d37ed4ecca9b273") .field("entryid", "TigerWoods") .attach("files", fs.createReadStream("<file goes here>")) .field("urls", "http://www.lambdal.com/tiger.jpg") .end(function (result) { console.log(result.status, result.headers, result.body); });
-
HttpResponse<JsonNode> response = Unirest.post("https://lambda-face-recognition.p.mashape.com/album_train") .header("X-Mashape-Key", "dM7WpZJTUEmshLqtOqwlNvdZvCyEp1ZRGv9jsncz9Xzanba7oT") .field("album", "CELEBS") .field("albumkey", "b1ccb6caa8cefb7347d0cfb65146d5e3f84608f6ee55b1c90d37ed4ecca9b273") .field("entryid", "TigerWoods") .field("files", new File("<file goes here>")) .field("urls", "http://www.lambdal.com/tiger.jpg") .asJson();
-
Task<HttpResponse<MyClass>> response = Unirest.post("https://lambda-face-recognition.p.mashape.com/album_train") .header("X-Mashape-Key", "dM7WpZJTUEmshLqtOqwlNvdZvCyEp1ZRGv9jsncz9Xzanba7oT") .field("album", "CELEBS") .field("albumkey", "b1ccb6caa8cefb7347d0cfb65146d5e3f84608f6ee55b1c90d37ed4ecca9b273") .field("entryid", "TigerWoods") .field("files", File.ReadAllBytes(@"<file goes here>")) .field("urls", "http://www.lambdal.com/tiger.jpg") .asJson();
-
NSURL *urlfiles = [NSURL URLWithString:@"<file goes here>"] NSDictionary *headers = @{@"X-Mashape-Key": @"dM7WpZJTUEmshLqtOqwlNvdZvCyEp1ZRGv9jsncz9Xzanba7oT"}; NSDictionary *parameters = @{@"album": @"CELEBS", @"albumkey": @"b1ccb6caa8cefb7347d0cfb65146d5e3f84608f6ee55b1c90d37ed4ecca9b273", @"entryid": @"TigerWoods", @"files": urlfiles, @"urls": @"http://www.lambdal.com/tiger.jpg"}; UNIUrlConnection *asyncConnection = [[UNIRest post:^(UNISimpleRequest *request) { [request setUrl:@"https://lambda-face-recognition.p.mashape.com/album_train"]; [request setHeaders:headers]; [request setParameters:parameters]; }] asJsonAsync:^(UNIHTTPJsonResponse *response, NSError *error) { NSInteger code = response.code; NSDictionary *responseHeaders = response.headers; UNIJsonNode *body = response.body; NSData *rawBody = response.rawBody; }];
Rebuild the Album
Tell the album to build a model itself using the labeled images.
-
curl --get --include "https://lambda-face-recognition.p.mashape.com/album_rebuild?album=CELEBS&albumkey=b1ccb6caa8cefb7347d0cfb65146d5e3f84608f6ee55b1c90d37ed4ecca9b273" \ -H "X-Mashape-Key: dM7WpZJTUEmshLqtOqwlNvdZvCyEp1ZRGv9jsncz9Xzanba7oT"
-
response = Unirest.get "https://lambda-face-recognition.p.mashape.com/album_rebuild?album=CELEBS&albumkey=b1ccb6caa8cefb7347d0cfb65146d5e3f84608f6ee55b1c90d37ed4ecca9b273", headers:{:X-Mashape-Key => "dM7WpZJTUEmshLqtOqwlNvdZvCyEp1ZRGv9jsncz9Xzanba7oT"}
-
response = Unirest.get("https://lambda-face-recognition.p.mashape.com/album_rebuild?album=CELEBS&albumkey=b1ccb6caa8cefb7347d0cfb65146d5e3f84608f6ee55b1c90d37ed4ecca9b273", headers={"X-Mashape-Key": "dM7WpZJTUEmshLqtOqwlNvdZvCyEp1ZRGv9jsncz9Xzanba7oT"})
-
$response = Unirest::get("https://lambda-face-recognition.p.mashape.com/album_rebuild?album=CELEBS&albumkey=b1ccb6caa8cefb7347d0cfb65146d5e3f84608f6ee55b1c90d37ed4ecca9b273", array( "X-Mashape-Key" => "dM7WpZJTUEmshLqtOqwlNvdZvCyEp1ZRGv9jsncz9Xzanba7oT" ) );
-
unirest.get("https://lambda-face-recognition.p.mashape.com/album_rebuild?album=CELEBS&albumkey=b1ccb6caa8cefb7347d0cfb65146d5e3f84608f6ee55b1c90d37ed4ecca9b273") .header("X-Mashape-Key", "dM7WpZJTUEmshLqtOqwlNvdZvCyEp1ZRGv9jsncz9Xzanba7oT") .end(function (result) { console.log(result.status, result.headers, result.body); });
-
HttpResponse<JsonNode> response = Unirest.get("https://lambda-face-recognition.p.mashape.com/album_rebuild?album=CELEBS&albumkey=b1ccb6caa8cefb7347d0cfb65146d5e3f84608f6ee55b1c90d37ed4ecca9b273") .header("X-Mashape-Key", "dM7WpZJTUEmshLqtOqwlNvdZvCyEp1ZRGv9jsncz9Xzanba7oT") .asJson();
-
Task<HttpResponse<MyClass>> response = Unirest.get("https://lambda-face-recognition.p.mashape.com/album_rebuild?album=CELEBS&albumkey=b1ccb6caa8cefb7347d0cfb65146d5e3f84608f6ee55b1c90d37ed4ecca9b273") .header("X-Mashape-Key", "dM7WpZJTUEmshLqtOqwlNvdZvCyEp1ZRGv9jsncz9Xzanba7oT") .asJson();
-
NSDictionary *headers = @{@"X-Mashape-Key": @"dM7WpZJTUEmshLqtOqwlNvdZvCyEp1ZRGv9jsncz9Xzanba7oT"}; UNIUrlConnection *asyncConnection = [[UNIRest get:^(UNISimpleRequest *request) { [request setUrl:@"https://lambda-face-recognition.p.mashape.com/album_rebuild?album=CELEBS&albumkey=b1ccb6caa8cefb7347d0cfb65146d5e3f84608f6ee55b1c90d37ed4ecca9b273"]; [request setHeaders:headers]; }] asJsonAsync:^(UNIHTTPJsonResponse *response, NSError *error) { NSInteger code = response.code; NSDictionary *responseHeaders = response.headers; UNIJsonNode *body = response.body; NSData *rawBody = response.rawBody; }];
Recognize an Image
Give the album an image to recognize. You can see that there are two options, urls and files.
-
curl -X POST --include "https://lambda-face-recognition.p.mashape.com/recognize" \ -H "X-Mashape-Key: dM7WpZJTUEmshLqtOqwlNvdZvCyEp1ZRGv9jsncz9Xzanba7oT" \ -F "album=CELEBS" \ -F "albumkey=b1ccb6caa8cefb7347d0cfb65146d5e3f84608f6ee55b1c90d37ed4ecca9b273" \ -F "files=@<file goes here>" \ -F "urls=http://www.lambdal.com/tiger.jpg"
-
response = Unirest.post "https://lambda-face-recognition.p.mashape.com/recognize", headers:{:X-Mashape-Key => "dM7WpZJTUEmshLqtOqwlNvdZvCyEp1ZRGv9jsncz9Xzanba7oT"}, parameters:{:album => "CELEBS", :albumkey => "b1ccb6caa8cefb7347d0cfb65146d5e3f84608f6ee55b1c90d37ed4ecca9b273", :files => File.new("<file goes here>"), :urls => "http://www.lambdal.com/tiger.jpg"}
-
response = Unirest.post("https://lambda-face-recognition.p.mashape.com/recognize", headers={"X-Mashape-Key": "dM7WpZJTUEmshLqtOqwlNvdZvCyEp1ZRGv9jsncz9Xzanba7oT"}, params={"album": CELEBS", "albumkey": b1ccb6caa8cefb7347d0cfb65146d5e3f84608f6ee55b1c90d37ed4ecca9b273", "files": open("<file goes here>", mode="r"), "urls": http://www.lambdal.com/tiger.jpg"})
-
$response = Unirest::post("https://lambda-face-recognition.p.mashape.com/recognize", array( "X-Mashape-Key" => "dM7WpZJTUEmshLqtOqwlNvdZvCyEp1ZRGv9jsncz9Xzanba7oT" ), array( "album" => "CELEBS", "albumkey" => "b1ccb6caa8cefb7347d0cfb65146d5e3f84608f6ee55b1c90d37ed4ecca9b273", "files" => Unirest::file("<file goes here>"), "urls" => "http://www.lambdal.com/tiger.jpg" ) );
-
unirest.post("https://lambda-face-recognition.p.mashape.com/recognize") .header("X-Mashape-Key", "dM7WpZJTUEmshLqtOqwlNvdZvCyEp1ZRGv9jsncz9Xzanba7oT") .field("album", "CELEBS") .field("albumkey", "b1ccb6caa8cefb7347d0cfb65146d5e3f84608f6ee55b1c90d37ed4ecca9b273") .attach("files", fs.createReadStream("<file goes here>")) .field("urls", "http://www.lambdal.com/tiger.jpg") .end(function (result) { console.log(result.status, result.headers, result.body); });
-
HttpResponse<JsonNode> response = Unirest.post("https://lambda-face-recognition.p.mashape.com/recognize") .header("X-Mashape-Key", "dM7WpZJTUEmshLqtOqwlNvdZvCyEp1ZRGv9jsncz9Xzanba7oT") .field("album", "CELEBS") .field("albumkey", "b1ccb6caa8cefb7347d0cfb65146d5e3f84608f6ee55b1c90d37ed4ecca9b273") .field("files", new File("<file goes here>")) .field("urls", "http://www.lambdal.com/tiger.jpg") .asJson();
-
Task<HttpResponse<MyClass>> response = Unirest.post("https://lambda-face-recognition.p.mashape.com/recognize") .header("X-Mashape-Key", "dM7WpZJTUEmshLqtOqwlNvdZvCyEp1ZRGv9jsncz9Xzanba7oT") .field("album", "CELEBS") .field("albumkey", "b1ccb6caa8cefb7347d0cfb65146d5e3f84608f6ee55b1c90d37ed4ecca9b273") .field("files", File.ReadAllBytes(@"<file goes here>")) .field("urls", "http://www.lambdal.com/tiger.jpg") .asJson();
-
NSURL *urlfiles = [NSURL URLWithString:@"<file goes here>"] NSDictionary *headers = @{@"X-Mashape-Key": @"dM7WpZJTUEmshLqtOqwlNvdZvCyEp1ZRGv9jsncz9Xzanba7oT"}; NSDictionary *parameters = @{@"album": @"CELEBS", @"albumkey": @"b1ccb6caa8cefb7347d0cfb65146d5e3f84608f6ee55b1c90d37ed4ecca9b273", @"files": urlfiles, @"urls": @"http://www.lambdal.com/tiger.jpg"}; UNIUrlConnection *asyncConnection = [[UNIRest post:^(UNISimpleRequest *request) { [request setUrl:@"https://lambda-face-recognition.p.mashape.com/recognize"]; [request setHeaders:headers]; [request setParameters:parameters]; }] asJsonAsync:^(UNIHTTPJsonResponse *response, NSError *error) { NSInteger code = response.code; NSDictionary *responseHeaders = response.headers; UNIJsonNode *body = response.body; NSData *rawBody = response.rawBody; }];
Support
If you have any more questions, feedback, or need help integrating, reach out:
Email: support@lambdal.com