Authentication

To access our API, you first 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

Request examples

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

Response

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

{
"id_token" : "YOUR_LEAF_TOKEN"
}

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

Note:

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