Route Risk Analysis
curl --request POST \
--url https://api.vects.ai/risk-assessment/ \
--header 'Content-Type: application/json' \
--data '
{
"routePoints": [
{
"routePoints[].lat": 123,
"routePoints[].lng": 123,
"routePoints[].timestamp": "<string>"
}
],
"riskTypes": [
{}
],
"timeWindow": {
"timeWindow.start": "<string>",
"timeWindow.end": "<string>"
},
"resolution": "<string>"
}
'import requests
url = "https://api.vects.ai/risk-assessment/"
payload = {
"routePoints": [
{
"routePoints[].lat": 123,
"routePoints[].lng": 123,
"routePoints[].timestamp": "<string>"
}
],
"riskTypes": [{}],
"timeWindow": {
"timeWindow.start": "<string>",
"timeWindow.end": "<string>"
},
"resolution": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
routePoints: [
{
'routePoints[].lat': 123,
'routePoints[].lng': 123,
'routePoints[].timestamp': '<string>'
}
],
riskTypes: [{}],
timeWindow: {'timeWindow.start': '<string>', 'timeWindow.end': '<string>'},
resolution: '<string>'
})
};
fetch('https://api.vects.ai/risk-assessment/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.vects.ai/risk-assessment/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'routePoints' => [
[
'routePoints[].lat' => 123,
'routePoints[].lng' => 123,
'routePoints[].timestamp' => '<string>'
]
],
'riskTypes' => [
[
]
],
'timeWindow' => [
'timeWindow.start' => '<string>',
'timeWindow.end' => '<string>'
],
'resolution' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.vects.ai/risk-assessment/"
payload := strings.NewReader("{\n \"routePoints\": [\n {\n \"routePoints[].lat\": 123,\n \"routePoints[].lng\": 123,\n \"routePoints[].timestamp\": \"<string>\"\n }\n ],\n \"riskTypes\": [\n {}\n ],\n \"timeWindow\": {\n \"timeWindow.start\": \"<string>\",\n \"timeWindow.end\": \"<string>\"\n },\n \"resolution\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.vects.ai/risk-assessment/")
.header("Content-Type", "application/json")
.body("{\n \"routePoints\": [\n {\n \"routePoints[].lat\": 123,\n \"routePoints[].lng\": 123,\n \"routePoints[].timestamp\": \"<string>\"\n }\n ],\n \"riskTypes\": [\n {}\n ],\n \"timeWindow\": {\n \"timeWindow.start\": \"<string>\",\n \"timeWindow.end\": \"<string>\"\n },\n \"resolution\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vects.ai/risk-assessment/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"routePoints\": [\n {\n \"routePoints[].lat\": 123,\n \"routePoints[].lng\": 123,\n \"routePoints[].timestamp\": \"<string>\"\n }\n ],\n \"riskTypes\": [\n {}\n ],\n \"timeWindow\": {\n \"timeWindow.start\": \"<string>\",\n \"timeWindow.end\": \"<string>\"\n },\n \"resolution\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"200": {},
"400": {},
"401": {},
"429": {},
"500": {},
"riskPoints": [
{
"riskPoints[].lat": 123,
"riskPoints[].lng": 123,
"riskPoints[].weight": 123,
"riskPoints[].riskLevel": "<string>",
"riskPoints[].threats": [
{}
]
}
],
"summary": {
"summary.overallRisk": "<string>",
"summary.maxRiskWeight": 123,
"summary.averageRisk": 123,
"summary.totalDistance": 123,
"summary.highRiskSegments": 123
},
"threats": [
{
"threats[].id": "<string>",
"threats[].type": "<string>",
"threats[].severity": "<string>",
"threats[].description": "<string>",
"threats[].location": {},
"threats[].timeframe": {},
"threats[].confidence": 123
}
],
"recommendations": [
{
"recommendations[].type": "<string>",
"recommendations[].priority": "<string>",
"recommendations[].description": "<string>",
"recommendations[].alternativeRoute": [
{}
]
}
]
}Risk Assessment
Route Risk Analysis
Assess potential risks and threats along a specified route
POST
/
risk-assessment
/
Route Risk Analysis
curl --request POST \
--url https://api.vects.ai/risk-assessment/ \
--header 'Content-Type: application/json' \
--data '
{
"routePoints": [
{
"routePoints[].lat": 123,
"routePoints[].lng": 123,
"routePoints[].timestamp": "<string>"
}
],
"riskTypes": [
{}
],
"timeWindow": {
"timeWindow.start": "<string>",
"timeWindow.end": "<string>"
},
"resolution": "<string>"
}
'import requests
url = "https://api.vects.ai/risk-assessment/"
payload = {
"routePoints": [
{
"routePoints[].lat": 123,
"routePoints[].lng": 123,
"routePoints[].timestamp": "<string>"
}
],
"riskTypes": [{}],
"timeWindow": {
"timeWindow.start": "<string>",
"timeWindow.end": "<string>"
},
"resolution": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
routePoints: [
{
'routePoints[].lat': 123,
'routePoints[].lng': 123,
'routePoints[].timestamp': '<string>'
}
],
riskTypes: [{}],
timeWindow: {'timeWindow.start': '<string>', 'timeWindow.end': '<string>'},
resolution: '<string>'
})
};
fetch('https://api.vects.ai/risk-assessment/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.vects.ai/risk-assessment/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'routePoints' => [
[
'routePoints[].lat' => 123,
'routePoints[].lng' => 123,
'routePoints[].timestamp' => '<string>'
]
],
'riskTypes' => [
[
]
],
'timeWindow' => [
'timeWindow.start' => '<string>',
'timeWindow.end' => '<string>'
],
'resolution' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.vects.ai/risk-assessment/"
payload := strings.NewReader("{\n \"routePoints\": [\n {\n \"routePoints[].lat\": 123,\n \"routePoints[].lng\": 123,\n \"routePoints[].timestamp\": \"<string>\"\n }\n ],\n \"riskTypes\": [\n {}\n ],\n \"timeWindow\": {\n \"timeWindow.start\": \"<string>\",\n \"timeWindow.end\": \"<string>\"\n },\n \"resolution\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.vects.ai/risk-assessment/")
.header("Content-Type", "application/json")
.body("{\n \"routePoints\": [\n {\n \"routePoints[].lat\": 123,\n \"routePoints[].lng\": 123,\n \"routePoints[].timestamp\": \"<string>\"\n }\n ],\n \"riskTypes\": [\n {}\n ],\n \"timeWindow\": {\n \"timeWindow.start\": \"<string>\",\n \"timeWindow.end\": \"<string>\"\n },\n \"resolution\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vects.ai/risk-assessment/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"routePoints\": [\n {\n \"routePoints[].lat\": 123,\n \"routePoints[].lng\": 123,\n \"routePoints[].timestamp\": \"<string>\"\n }\n ],\n \"riskTypes\": [\n {}\n ],\n \"timeWindow\": {\n \"timeWindow.start\": \"<string>\",\n \"timeWindow.end\": \"<string>\"\n },\n \"resolution\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"200": {},
"400": {},
"401": {},
"429": {},
"500": {},
"riskPoints": [
{
"riskPoints[].lat": 123,
"riskPoints[].lng": 123,
"riskPoints[].weight": 123,
"riskPoints[].riskLevel": "<string>",
"riskPoints[].threats": [
{}
]
}
],
"summary": {
"summary.overallRisk": "<string>",
"summary.maxRiskWeight": 123,
"summary.averageRisk": 123,
"summary.totalDistance": 123,
"summary.highRiskSegments": 123
},
"threats": [
{
"threats[].id": "<string>",
"threats[].type": "<string>",
"threats[].severity": "<string>",
"threats[].description": "<string>",
"threats[].location": {},
"threats[].timeframe": {},
"threats[].confidence": 123
}
],
"recommendations": [
{
"recommendations[].type": "<string>",
"recommendations[].priority": "<string>",
"recommendations[].description": "<string>",
"recommendations[].alternativeRoute": [
{}
]
}
]
}Overview
The Route Risk Analysis API evaluates potential threats and hazards along a specified path or route. This endpoint analyzes various risk factors including geopolitical events, environmental hazards, infrastructure conditions, and real-time threat data to provide comprehensive risk assessments.Authentication
curl -X POST "https://api.vects.ai/risk-assessment/" \
-H "Authorization: Api-Key YOUR_API_KEY" \
-H "Content-Type: application/json"
curl -X POST "https://api.vects.ai/risk-assessment/" \
-H "Authorization: Token YOUR_AUTH_TOKEN" \
-H "Content-Type: application/json"
curl -X POST "https://api.vects.ai/risk-assessment/" \
-H "Content-Type: application/json"
This endpoint supports anonymous access for basic risk assessments, though authenticated requests receive more detailed analysis.
Request Body
array
required
array
Optional array of specific risk types to analyze. If not provided, all risk types are assessed.Available types:
geopolitical, environmental, infrastructure, crime, traffic, weatherobject
string
default:"medium"
Analysis resolution:
low, medium, highlow: Basic risk assessment with major threats onlymedium: Standard assessment with moderate detailhigh: Comprehensive assessment with fine-grained analysis
Example Requests
curl -X POST "https://api.vects.ai/risk-assessment/" \
-H "Authorization: Api-Key YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"routePoints": [
{"lat": 37.7749, "lng": -122.4194},
{"lat": 37.7849, "lng": -122.4094},
{"lat": 37.7949, "lng": -122.3994}
]
}'
curl -X POST "https://api.vects.ai/risk-assessment/" \
-H "Authorization: Api-Key YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"routePoints": [
{"lat": 37.7749, "lng": -122.4194, "timestamp": "2024-01-15T14:00:00Z"},
{"lat": 37.7849, "lng": -122.4094, "timestamp": "2024-01-15T14:15:00Z"},
{"lat": 37.7949, "lng": -122.3994, "timestamp": "2024-01-15T14:30:00Z"}
],
"riskTypes": ["geopolitical", "environmental", "crime"],
"timeWindow": {
"start": "2024-01-15T12:00:00Z",
"end": "2024-01-15T18:00:00Z"
},
"resolution": "high"
}'
curl -X POST "https://api.vects.ai/risk-assessment/" \
-H "Authorization: Api-Key YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"routePoints": [
{"lat": 40.7128, "lng": -74.0060},
{"lat": 41.8781, "lng": -87.6298},
{"lat": 39.7392, "lng": -104.9903},
{"lat": 34.0522, "lng": -118.2437}
],
"riskTypes": ["weather", "geopolitical", "infrastructure"],
"resolution": "high"
}'
Response
array
Array of risk assessment points along the route
object
array
Detailed threat information
Show threats structure
Show threats structure
array
Example Response
{
"riskPoints": [
{
"lat": 37.7749,
"lng": -122.4194,
"weight": 0.2,
"riskLevel": "low",
"threats": ["minor_traffic_congestion"]
},
{
"lat": 37.7849,
"lng": -122.4094,
"weight": 0.7,
"riskLevel": "high",
"threats": ["active_protest", "road_closure"]
},
{
"lat": 37.7949,
"lng": -122.3994,
"weight": 0.3,
"riskLevel": "medium",
"threats": ["construction_zone"]
}
],
"summary": {
"overallRisk": "high",
"maxRiskWeight": 0.7,
"averageRisk": 0.4,
"totalDistance": 15.2,
"highRiskSegments": 1
},
"threats": [
{
"id": "threat_001",
"type": "geopolitical",
"severity": "high",
"description": "Large protest gathering with potential for civil unrest",
"location": {
"lat": 37.7849,
"lng": -122.4094,
"radius": 500
},
"timeframe": {
"start": "2024-01-15T13:00:00Z",
"end": "2024-01-15T17:00:00Z"
},
"confidence": 0.85
},
{
"id": "threat_002",
"type": "infrastructure",
"severity": "medium",
"description": "Road construction causing lane closures",
"location": {
"lat": 37.7949,
"lng": -122.3994,
"radius": 200
},
"timeframe": {
"start": "2024-01-15T08:00:00Z",
"end": "2024-01-15T18:00:00Z"
},
"confidence": 0.95
}
],
"recommendations": [
{
"type": "route_change",
"priority": "high",
"description": "Consider alternative route to avoid protest area",
"alternativeRoute": [
{"lat": 37.7749, "lng": -122.4194},
{"lat": 37.7799, "lng": -122.4144},
{"lat": 37.7949, "lng": -122.3994}
]
},
{
"type": "timing_adjustment",
"priority": "medium",
"description": "Delay travel until after 17:00 to avoid peak protest activity"
},
{
"type": "precaution",
"priority": "medium",
"description": "Monitor real-time traffic updates for construction delays"
}
]
}
Risk Types
Geopolitical Risks
- Political demonstrations and protests
- Civil unrest and conflicts
- Border tensions and restrictions
- Government instability
Environmental Risks
- Natural disasters (earthquakes, floods, storms)
- Extreme weather conditions
- Environmental hazards (pollution, radiation)
- Climate-related threats
Infrastructure Risks
- Road closures and construction
- Bridge and tunnel conditions
- Public transportation disruptions
- Utility outages
Crime Risks
- High crime areas
- Recent criminal activity
- Security incidents
- Theft and violence hotspots
Traffic Risks
- Congestion patterns
- Accident-prone areas
- Rush hour impacts
- Special event traffic
Weather Risks
- Current weather conditions
- Weather forecasts
- Seasonal weather patterns
- Extreme weather alerts
Status Codes
OK
Risk analysis completed successfully
Bad Request
Invalid route points or request parameters
Unauthorized
Invalid or missing API key (for authenticated features)
Too Many Requests
Rate limit exceeded
Internal Server Error
Server error during risk analysis
Error Response
{
"error": "Invalid route points: Route must contain at least 2 points",
"code": "INVALID_ROUTE_POINTS",
"details": {
"field": "routePoints",
"min_points": 2,
"provided_points": 1
}
}
Integration Examples
JavaScript/Web
async function analyzeRoute(routePoints) {
const response = await fetch('https://api.vects.ai/risk-assessment/', {
method: 'POST',
headers: {
'Authorization': 'Api-Key YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
routePoints: routePoints,
resolution: 'high'
})
});
const riskData = await response.json();
// Visualize risk points on map
riskData.riskPoints.forEach(point => {
addRiskMarker(point.lat, point.lng, point.weight);
});
}
Python
import requests
def analyze_route_risk(route_points, api_key):
url = "https://api.vects.ai/risk-assessment/"
headers = {
"Authorization": f"Api-Key {api_key}",
"Content-Type": "application/json"
}
data = {
"routePoints": route_points,
"resolution": "high"
}
response = requests.post(url, headers=headers, json=data)
return response.json()
# Example usage
route = [
{"lat": 37.7749, "lng": -122.4194},
{"lat": 37.7849, "lng": -122.4094}
]
risk_analysis = analyze_route_risk(route, "your_api_key")
Next Steps
- Explore Radius Risk Analysis for area-based assessments
- Learn about Urban Mobility MARL for dynamic risk modeling
- Check out Simulation APIs for scenario planning
⌘I