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-herewith 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())