Learn the roles of API account credentials, access tokens, and refresh tokens, how to send them, and how to interpret auth errors.
Deeply API uses API account credentials, an Access Token, and a Refresh Token.
Those credentials serve different purposes, so using the right one matters.
API account credentials: username and password used only with Issue TokenAccess Token: Bearer token used for normal API requests and WebSocket connectionsRefresh Token: token used only with Reissue TokenDo not send the API account credentials or the refresh token to general endpoints. Use the access token instead.
API account credentials are not issued from the dashboard. Request them from contact@deeplyinc.com, and Deeply will send them to you by email. Store them as a secret in your integration, and do not share them in source code or chat messages.
username and password to receive an access_token and a refresh_token.access_token in the Authorization header of normal API requests and WebSocket connections.expires_in seconds, 3600 by default), call Reissue Token with Authorization: Bearer YOUR_REFRESH_TOKEN, and replace both stored tokens with the new values.Include your access token in the Authorization header of all normal API requests using the Bearer token format:
Authorization: Bearer YOUR_ACCESS_TOKENcurl -X GET "http://{{EDGE_IP}}:8100/api/v1/events" -H "Authorization: Bearer YOUR_ACCESS_TOKEN"This page uses the local default host shown in Getting Started. If you want to validate the same request against the public HTTPS environment, replace the host with https://openapi.deeplyinc.com.
If you do not have a token yet, call Issue Token with your API account credentials.
If the access token has expired, call Reissue Token with Authorization: Bearer YOUR_REFRESH_TOKEN.
If authorization fails, you'll receive one of these responses:
{
"detail": {
"message": "Authentication token expired. Please reissue a new token to renew your session."
}
}const response = await fetch('http://{{EDGE_IP}}:8100/api/v1/events', {
method: 'GET',
headers: {
"Authorization": "Bearer YOUR_ACCESS_TOKEN"
}
});
const data = await response.json();