This tutorial is in order to get your first token and start making some requests using the version 1.0 of Sandbox Botdoc API. In order to use this version, you have to put “v1” on the API’s endpoint.
To a better understanding about the versioning, please go to api.botdoc.io/documentation/#versioning
and to a better understanding about the Sandbox, please go to api.botdoc.io/documentation/#sandbox-platform
Instructions
So let’s get started.
The first thing you need to do is sign up and create your first application:
To do so you need to go to: Sandbox Developer PortalCreate your account and then create your first application.
As soon you hit save, you’ll get your API KEY.
Please, DO NOT share! Store it in a secure place, it’s sensitive data.Getting the token:
Now you have the API Key, you need to get your token.
In order to get your token you have to make a request to:
https://sandboxapi.botdoc.io/v1/auth/get_token as POST and passing a json as data:
e.g.{ "api_key": "your-api-key", "email": "your-email@domain.com" }
If your API Key and email are correct, you’ll get this json as response:{ "token": "your-token" }
With this token you can start making requests!
However tokens have an expiration date, they last 8 hours and you can refresh to get a new token using the original within 7 days.Refresh your token:
In order to refresh your token you have to make a request to
https://sandboxapi.botdoc.io/v1/auth/token_refresh as POST and passing a json as data:
e.g.{ "token": "your-old-token" }
If your token is valid and has until 7 days old, you’ll get your new token and the response to your request will be the same as getting the token.Verifying your token:
You can also verify if your token is still valid before making requests.In order to verify your token you have to make a request to
https://sandboxapi.botdoc.io/v1/auth/token_verify/ as POST and passing a json as data:
e.g.{ "token": "your-token" }
If your token is valid, you’ll receive the token itself and the response to your request will be the same as getting the token.Now you know how to get and manage your tokens, let’s start making some requests!
For more details about the authentication you can take a look at our Botdoc API Reference on api.botdoc.io/documentation/#authentication