Hello Developers!

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

So let’s get started.

1. 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 Portal

Create your account and then create your first application.

 

As soon you hit save, you’ll get your API KEY.
Please, DO NOT share, and store it in a secure place, it’s sensitive data.

2. 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.

3. 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.

4. 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