Face Detect API
The Face Detect API uses state of the art computer vision algorithms to accurately and efficiently detect faces in images.
From 9,332 users
Applications using this API
API Status
API Response Times
Average | P50 | P75 | P90 | P95 |
|---|---|---|---|---|
| 412ms | 457ms | 459ms | 725ms | 1228ms |
Similar APIs
Didn't find what you were looking for? Suggest an improvement
/v1/facedetect POST
https://api.api-ninjas.com/v1/facedetect
Given an input image, returns a list containing all detected faces in the form of bounding boxes.
Files
imagerequiredImage file containing faces. Must be either JPEG or PNG format.
Headers
X-Api-KeyrequiredAPI Key associated with your account.
Response
A JSON array of objects, each containing the following fields, or an error if the request is unsuccessful.
xThe x-coordinate of the top-left corner of the bounding box.
yThe y-coordinate of the top-left corner of the bounding box.
widthWidth of the bounding box in pixels.
heightHeight of the bounding box in pixels.
Sample Request Live Demo!
Try our APIs in the API playground
Sign up for a free API key to get started — no credit card required.
https://api.api-ninjas.com/v1/facedetectHeaders
X-Api-KeyLog in or sign up to get your API KeySample Response
Code Examples
1
2
3
curl -X POST "https://api.api-ninjas.com/v1/facedetect" \
-H "X-Api-Key: YOUR_API_KEY" \
-F "image=@YOUR_IMAGE.jpeg"If your programming language is not listed in the Code Example above, you can still make API calls by using a HTTP request library written in your programming language and following the above documentation.
Frequently Asked Questions
Can I use the Face Detect API for commercial purposes?
Yes, but you must have a premium subscription. Commercial use of the Face Detect API is not permitted on the free tier. See our pricing page to choose a plan that fits your needs.How do I get an API key and start using the Face Detect API?
Sign up for a free account to instantly get your API key, then pass it in theX-Api-Keyheader on every request. The documentation above includes ready-to-run examples in cURL, Python, JavaScript, Node.js, and more.What happens if I exceed my quota for the month?
Your API requests will simply be denied once you hit your monthly quota — you will never be charged more than the plan you signed up for. To increase your quota, you can upgrade your plan any time on our pricing page.What happens if a request to the Face Detect API fails?
The API responds with a standard HTTP status code and a JSON error message describing the problem. See our error codes reference for the full list of codes and how to resolve each one, or contact support if you need help.What are some use cases for the Face Detect API?
The Face Detect API uses state of the art computer vision algorithms to locate faces in images, making it useful for photo tagging, headcount and attendance applications, blurring or redacting faces for privacy, and as a preprocessing step before cropping or recognition. For detecting non-face objects you can pair it with the Object Detection API.How do I submit an image to the Face Detect API?
Send a POST request to the/v1/facedetectendpoint with the image uploaded as multipart form-data in theimagefile field, which must be in JPEG or PNG format. See the API documentation for code samples in cURL, Python, and JavaScript.What does the Face Detect API response include?
The API returns a JSON array of objects, one per detected face, where each object gives the bounding box withxandyfor the top-left corner andwidthandheightin pixels. If the request is unsuccessful you will receive an error instead, as described in the error codes reference.Does the Face Detect API extract text or read content from images?
No, the Face Detect API only returns bounding boxes for faces and does not read any text or characters from the image. To extract text from an image, use the Image to Text API instead.