Plant identification - flowerchecker/plant-id-examples GitHub Wiki

Send plant photos to our back end, and get the JSON result with species suggestions.

See the Plant.id API product page.

Request

Endpoint:

  • https://api.plant.id/v2/identify

Request method:

  • POST

Required parameters:

  • images - a list of one or more images of the plant you want to identify (images should be encoded as strings in Base64)

Optional parameters:

  • latitude - geographic coordinate (float) - increases the identification accuracy
  • longitude - geographic coordinate (float) - increases the identification accuracy
  • modifiers - list of strings, that influences the identification process and results (speed, accuracy, response content etc.), see the list of available modifiers
  • plant_details - list of strings, that determines which information about the plant (e.g. common names) will be included in the response, see the list of available plant details
  • plant_language - language code (ISO 639-1) used for language-dependent plant_details (default "en")
  • plant_languages - list of up to 3 language codes (ISO 639-1) used for language-dependent plant_details (do not combine with the parameter plant_language) When used the respective fields in the response will turn into dictionaries with the language code as a key.
  • custom_id - unique identifier you can set for your purpose (int) - can be used for handling network connection errors
  • datetime - timestamp in seconds (int)
  • identification_timeout - timeout limit in seconds (int, default 20 second, max. 20 seconds) If the identification takes more than the given number of seconds, identification info without any suggestion is returned.

See the request examples in different programming languages in our repository.

Response

The result in the JSON format contains a list of suggestions of possible plant species or genera (taxons). Each suggestion contains:

  • id - id of the suggestion (you can use to (un)confirm the suggestion)
  • plant_name - the name of the plant in our database
  • plant_details - info you requested (if available), see plant_details documentation
  • probability - certainty level that suggested plant is the one from the photo
  • confirmed - confirmation status (bool)
  • similar-images - list of representative images of the identified species carefully selected by the model, so it resembles the input image (Similar images are included in the result only if you add the value similar_image in the modifiers list in the request.), the list contains dictionaries with image data (id, similarity, url, url_small) and license data (license_name, license_url, citation) if citation for the representative image is needed.

In addition to species suggestions, fields is_plant and is_plant_probability are also available. is_plant = false indicates that sent images contain no plant and is_plant_probability gives more detailed information and it expresses the probability if there is a plant in the photo. These fields can be used, for example, to filter irrelevant photos.

Response example

See the JSON response example.

Asynchronous response retrieval

You can retrieve the indetification results later with the use of identification ID or CUSTOM_ID.

Do not forget to check whether identification with given ID (or your CUSTOM_ID) has been already proceeded and return its result.

URIs:

  • https://api.plant.id/v2/get_identification_result/ID

  • https://api.plant.id/v2/get_identification_result/custom_id/CUSTOM_ID

Request method:

  • POST

Optional parameters:

  • plant_details - list of strings, that determines which information about the plant (e.g. common names) will be included in the response, see the list of available plant details
  • plant_language - language code (ISO 639-1) used for language-dependent plant_details (default "en")
  • plant_languages - list of up to 3 language codes (ISO 639-1) used for language-dependent plant_details (do not combine with the parameter plant_language) When used the respective fields in the response will turn into dictionaries with the language code as a key.

Get multiple identifications result

https://api.plant.id/v2/get_identification_result/multiple

Get results of more identifications at once.

Request method:

  • POST

Specify at least one of the following parameters:

  • ids - list of ids provided by the identification response
  • custom_ids - list of ids provided by you in the identification request

Optional parameters:

  • plant_details - list of strings, that determines which information about the plant (e.g. common names) will be included in the response, see the list of available plant details
  • plant_language - language code (ISO 639-1) used for language-dependent plant_details (default "en")
  • plant_languages - list of up to 3 language codes (ISO 639-1) used for language-dependent plant_details (do not combine with the parameter plant_language) When used the respective fields in the response will turn into dictionaries with the language code as a key.