Skip to main content

Authentication

To use the Operation Track API, you must authenticate each request using your API Key. This key should be passed in the request headers using the x-api-key field.


๐Ÿงพ Authentication Formatโ€‹

Include the following HTTP header in every request:

โœ… Replace your-api-key-here with the key generated from the API And Webhooks section.


๐Ÿ“ฆ Usage Examplesโ€‹

Below are examples of how to authenticate using different HTTP clients and tools:


โœ… fetch (JavaScript)โ€‹

fetch("https://api.operationtrack.com/v1/vehicles", {
method: "GET",
headers: {
"x-api-key": "your-api-key-here",
"Content-Type": "application/json"
}
})
.then(res => res.json())
.then(data => console.log(data))
.catch(err => console.error("Request failed:", err));

โœ… axios (JavaScript)โ€‹

import axios from 'axios';

axios.get("https://api.operationtrack.com/v1/vehicles", {
headers: {
"x-api-key": "your-api-key-here"
}
})
.then(response => console.log(response.data))
.catch(error => console.error("Error fetching data:", error));

โœ… curl (Shell)โ€‹

curl -X GET https://api.operationtrack.com/v1/vehicles \
-H "x-api-key: your-api-key-here" \
-H "Content-Type: application/json"

โœ… requests (Python)โ€‹

import requests

headers = {
"x-api-key": "your-api-key-here",
"Content-Type": "application/json"
}

response = requests.get("https://api.operationtrack.com/v1/vehicles", headers=headers)
print(response.json())