Getting started
Pl@ntNet API provides a computational access to the visual identification engine used in Pl@ntNet apps in the form of a RESTful Web service. The service allows you to submit simultaneously from 1 to 5 images of the same plant and to have in return the list of the most likely species as well as a confidence score for each of them. The identification engine is based on most advanced deep learning technologies and is regularly updated thanks to the contributions of the community and the integration of new expert databases.
A more detailed description of the identification engine is available in the following article: Pl@ntnet app in the era of deep learning, Affouard, A., Goëau, H., Bonnet, P., Lombardo, J. C., & Joly, A, ICLR 2017.
Identification performance varies from one species to another and depends mainly on the number of images illustrating them in the training database (explore here). If you would like to improve the recognition performance of a particular species, you can contribute new images using any of the Pl@ntNet apps.
The second parameter that has the greatest impact on the quality of identification is the quality of the images provided at the service input. As with Pl@ntNet apps, it is important to ensure that the images are as informative and clear as possible (see Pl@ntNet tutorial).
Step 1 my.plantnet account
Done
Step 2 private key
From your account (Settings page), generate your private API key (if not already done).
For the following example, we will use your current key:
api-key: YOUR-PRIVATE-API-KEY-HERE
Next step HTTP request
POST local images - based on local files
Choose this method if the images you want to identify are accessible locally.GET remote images - based on the images URLs
Choose this method if the images you want to identify are hosted online and you have their URLs.Full API documentation for advanced users
Complete API documentation is exposed by OpenAPI
Show API documentation
POST identification request example
Step 1 plant pictures
Get the paths of the images you want to identify. You can add up to 5 images in a single identification request.
WARNING Within a single request (1 to 5 images), all images must represent a single plant.
INFO For best practices (image size, format, compression), see FAQFor the following example, we will use these two images:
Step 2 data summary
Private API key:
api-key: YOUR-PRIVATE-API-KEY-HERE
Images:
image_1: /data/media/image_1.jpeg
image_2: /data/media/image_2.jpegOrgans:
image_1: flower
image_2: leafStep 3 identification request
WARNING The following code is based on local files, it will not work on your computer!
Identification service params:
service: https://my-api.plantnet.org/v2/identify/all
api-key: api-key=YOUR-PRIVATE-API-KEY-HERE
image_1: images=/data/media/image_1.jpeg
image_2: images=/data/media/image_2.jpeg
organ_1: organs=flower
organ_2: organs=leafStep 4 identification results
Get the list of probable species names sorted by score.
Expose API key
To enable usage of your API key in browser-side client apps (AJAX), you need to explicitly authorize all domain names the apps are hosted on.
Step 1 enable client access to your API key (CORS)
From your account (Settings page), check "expose my API key".
You can now use your API key in a client-side browser application, ie. in a CORS-enabled environment.
Step 2 authorize domain(s)
Under "Authorized domains", add one domain per line. CORS requests will be rejected if domain present in Origin header is not in this list.
WARNING CORS considers http://domain.com and https://domain.com as different origins.Step 3 (optional) authorize IP addresses
Once "expose my API key" is checked, any non-CORS request will be rejected if it does not come from a server with an IP address matching the "Authorized IPs" list. This prevents the exposed API key from being stolen and used server-side on a machine that isn't yours.
If you want to use your API key both client-side and server-side, you need to explicitly authorize IP addresses of your servers. Under "Authorized IPs", add one IPv4 or IPv4 range (CIDR format) per line.