This is the Trefle API documentation. The Trefle API aims to deliver all plants informations under an accessible interface.
All API access is over HTTPS, and accessed from https://trefle.io. All data is sent and received as JSON.
What You Need
In order to make queries, you'll need to create an account and get your personal access token first.
Your access token will allow you to makes queries on the Trefle API. Keep it private.
- Create an account on trefle.io
- Confirm your email address
- Login on your account
- Grab your Trefle access token
Make your first query
For the first examples, we will give you the choice between:
- Using your web browser, which is the simplest, but will be limited when we'll need to code a bit.
- Using your terminal, with
- Using javascipt, with NodeJS and the
node-fetchlibrary (install it with
yarn add node-fetch).
We will first try to list all the plants.
Open your browser and navigate to
It return a big JSON response like this:
The Trefle structure
Before going further, we need to know a bit how data is organized in the trefle API.
The whole API structure is defined by the following classification:
For example, the balsam fir hierarchy is:
Plant and Species
For commodity reasons, we added a
Plant level between Genus and Species. A plant is the main species of a species, without all the forms, varieties, subspecies etc...
For each plant, we have one main species and several other "sub" species (which can be subspecies, varieties, hybrids, cultivars etc...).
For example, our balsam fir have:
- One species (which is our "plant"):
- One sub-species:
Abies balsamea ssp. lasiocarpa
- Two varieties:
Abies balsamea var. phanerolepisand
Abies balsamea var. balsamea