Authentication

To access our API, you just have to register using this link. After confirming your email, you will be able to request a token (JWT) through this endpoint:

https://api.withleaf.io/api/authenticate

You will receive your Leaf Token as response.

All set! Include this token in your API calls and you will have access to Leaf's API.

curl -X POST \
-H 'Content-Type: application/json' \
-d '{ "username":"username", "password":"password", "rememberMe":"true" }' \
'https://api.withleaf.io/api/authenticate'

This request will return your access token to Leaf's API:

{
"id_token" : "YOUR_LEAF_TOKEN"
}

note: Your Leaf Token lasts for 30 days with "rememberMe": "true" in the json. If you want it to last only 24h, feel free to set "rememberMe" to "false".
After expiration, just make the same request to the same endpoint and you will get a new access token.