Authentication API
The Authentication API is used to generate JWT tokens that allow you to authenticate and access the Damage API.
The Authentication API is used to generate secure tokens that allow you to authenticate and access Damage API. When you call this endpoint successfully, the API returns three important credentials:
access_token(JWT) – Used to renew your session without requesting a new API key.refresh_token– Used in theAuthorizationheader for making authenticated API requests.- session (Inspection ID) – Must be included in every Damage API request under the
sessionkey.
These tokens are mandatory for all subsequent API calls to ensure security and controlled access.
Method | Base URL | Endpoint |
POST | https://reports.inspektlabs.com | /api/authenticate |
Click the button below to download the Postman collection for the API.
Getting an API Key
Please contact the Inspektlabs technical team to obtain your API key.
Parameters
Field | Type | Required | Description |
key | string | Yes | Your API key |
client_id | string | No | Optional client identifier |
Payload
{
"key": "<YOUR_API_KEY>",
"client_id": "<YOUR_CLIENT_ID>"
}Replace YOUR_API_KEY and YOUR_CLIENT_ID with your actual values.
or simply:
{
"key": "<YOUR_API_KEY>"
}Response
{
"session": "SESSION_ID",
"access_token": "JWT_ACCESS_TOKEN",
"refresh_token": "JWT_REFRESH_TOKEN"
}Field | Type | Description |
session | string | A temporary session ID assigned for this login |
access_token | string | A token used to refresh the session without re-authenticating |
refresh_token | string | A JWT token to be included in the Authorization header for further API calls |
Error message and status code
Status Code | Message | Description |
200 | Success | Request successful. Response contains session, access_token, and refresh_token. |
400 | Invalid API key | Request body missing required fields, malformed, or contains invalid values. |
401 | API Key not valid | The provided API key is invalid or expired. |
405 | Method not allowed | The HTTP method used is not supported (only POST is allowed). |
Here are examples of how to make this API request using different programming languages
Python
import requests
url = "https://reports.inspektlabs.com/api/authenticate"
payload = {
"key": "<YOUR_API_KEY>",
"client_id": "<YOUR_CLIENT_ID>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())JavaScript (Node.js)
const fetch = require("node-fetch");
(async () => {
const res = await fetch("https://reports.inspektlabs.com/api/authenticate", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
key: "<YOUR_API_KEY>",
client_id: "<YOUR_CLIENT_ID>"
})
});
const data = await res.json();
console.log(data);
})();Java
import java.net.http.*;
import java.net.URI;
import java.nio.charset.StandardCharsets;
public class AuthExample {
public static void main(String[] args) throws Exception {
String json = "{\"key\":\"<YOUR_API_KEY>\",\"client_id\":\"<YOUR_CLIENT_ID>\"}";
HttpRequest request = HttpRequest.newBuilder()
.uri(new URI("https://reports.inspektlabs.com/api/authenticate"))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(json, StandardCharsets.UTF_8))
.build();
HttpClient client = HttpClient.newHttpClient();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}Go
package main
import (
"bytes"
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://reports.inspektlabs.com/api/authenticate"
payload := []byte(`{"key":"<YOUR_API_KEY>","client_id":"<YOUR_CLIENT_ID>"}`)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(payload))
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
fmt.Println(string(body))
}Postman
- Open Postman → Click New Request
- Method:
POST - URL:
https://reports.inspektlabs.com/api/authenticate - Headers →
Content-Type: application/json - Body → Raw → JSON:
{
"key": "<YOUR_API_KEY>",
"client_id": "<YOUR_CLIENT_ID>"
}cURL
curl -X POST "https://reports.inspektlabs.com/api/authenticate" \
-H "Content-Type: application/json" \
-d '{
"key": "<YOUR_API_KEY>",
"client_id": "<YOUR_CLIENT_ID>"
}'Replace YOUR_API_KEY and YOUR_CLIENT_ID with your actual values.
←Home
Damage API→
On this page
- Authentication API
- Getting an API Key
- Parameters
- Payload
- Response
- Error message and status code
- Python
- JavaScript (Node.js)
- Java
- Go
- Postman
- cURL