To make requests to our API, you need to authenticate.
We use a combination of an API key and your login credentials for authentication.
Once you are authenticated, we send you a Bearer Token in return.
API Key
You can copy & paste the API Key from your dashboard in the API section.
Please note that you need an active Business plan subscription to interact with the API.
Bearer Token
A token that can be used to make authenticated requests to perform all kinds of requests to our API.
It’s recommended to store them temporarily as they are valid for 1 hour before they auto-expire.
Get Bearer Token
cURL
curl -X POST 'https://api.webtozip.com/auth/v1/token?grant_type=password' \-H "apikey: WTZ_API_KEY" \-H "Content-Type: application/json" \-d '{ "email": "api@webtozip.com", "password": "my-password"}'
JavaScript (fetch)
fetch("https://api.webtozip.com/auth/v1/token?grant_type=password", {
"method": "POST",
"headers": {
"apikey": "WTZ_API_KEY",
"Content-Type": "application/json",
},
"body": {
"email": "api@webtozip.com",
"password": "my-password"
}
})
.then((res) => res.text())
.then(console.log.bind(console))
.catch(console.error.bind(console));
Response
If the API key and login credentials are correct, you get a 200 response containing a JSON object:
{
"access_token":"eyJhbGciOiJIUzI1NiIsImtpZCI6IjFKaXNZY1lBN1YyVzc2aUMiLC....",
"token_type":"bearer",
"expires_in":3600,
"expires_at":1697451249,
"refresh_token":"8HiHekCal...",
"user":{...}
}
All you need to interact with the Rest API in the following sections are the access_token and the API key.
Please replace WTZ_API_KEY with your own API key.