Two points
Send a start and finish to POST /api/v2/route. Read distance_m, duration_s, and the GeoJSON geometry.
PUBLIC API V2 · ROUTING + OPTIMIZATION
Search for a place, route by car or on foot, then optimize a whole fleet. One API key and one base URL: https://api.afdal.tech.
api.afdal.tech/api/v2/optimize{
"mode": "drive",
"depot": {"lat": 33.8938, "lon": 35.5018},
"stops": [{"id": "A1", "address": "Hamra",
"lat": 33.8963, "lon": 35.4841}],
"fleet": {"vehicles": 1, "capacity": 4}
}
RoutingDrive or walk, through ordered points
OptimizationDriving only, with fleet constraints and GeoJSON
PlacesAddress and point-of-interest search
START HERE
Use X-API-Key for routes, optimization and place search. The modes endpoint is public. Keep your key on your server, never in a browser bundle.
We can set a suitable query and location allowance for your integration.
Contact Afdal →Routing supports drive and walk; optimization supports drive only.
Route and optimization responses include GeoJSON LineString coordinates in [longitude, latitude] order.
export AFDAL_API_KEY="your-key"
curl -X POST "https://api.afdal.tech/api/v2/route" \
-H "X-API-Key: $AFDAL_API_KEY" \
-H "Content-Type: application/json" \
-d '{"mode":"drive","points":[
{"lat":33.8938,"lon":35.5018},
{"lat":33.8963,"lon":35.4841},
{"lat":33.8884,"lon":35.5198}
]}'PUBLIC V2 OPERATIONS
Base URL: https://api.afdal.tech
Request and response details: Read the v2 guide ↗
/api/v2/modesAvailable travel modesReturns {"routing":["drive","walk"],"optimization":["drive"]}. No key required.
/api/v2/routeRoad route and geometrySend mode and an ordered points array of {"lat":…,"lon":…} objects. Points are not reordered. Returns distance in metres, duration in seconds, route legs, and GeoJSON geometry.
/api/v2/optimizeStop order, vehicles and geometrySend a depot, stops, optional fleet and planning. Only mode: "drive" is accepted. The response includes each vehicle’s ordered stops, phone numbers, unassigned IDs, distance, duration and full road-following GeoJSON. The road matrix is used for optimization; there is no straight-line fallback.
/api/v2/geocodeAddresses and points of interestUse q for search text. Add focus_lat and focus_lon together to bias results near a location. Returns names, labels and coordinates.
REAL ROAD GEOMETRY
Afdal returns the chosen stop order and a road-following path for each vehicle. Use the distance, duration, and GeoJSON geometry in your own application.
{
"routes": [{
"vehicle_id": 1,
"stops": [{"kind": "depot"}, {"order_id": "A1", "kind": "delivery"}],
"geometry": {
"type": "LineString",
"coordinates": [[35.5018, 33.8938], ...]
},
"routing_engines": ["afdal"]
}],
"matrix_source": "afdal"
}LEARN BY RUNNING
The downloadable notebook shows each request and draws its returned road geometry. The Python runner saves complete JSON and GeoJSON files.
Send a start and finish to POST /api/v2/route. Read distance_m, duration_s, and the GeoJSON geometry.
Send a depot and stops to POST /api/v2/optimize. See the chosen visit order and the vehicle’s distance, driving time, and path.
Offer two vehicles and a short shift. Inspect each used vehicle’s stops, distance_m, duration_s, and geometry.
Give each stop a load and arrival window. Set the same fleet.capacity for both vehicles, then check arrivals, cumulative loads, and unassigned stops.
Driving time excludes service and waiting. Time windows use minutes after midnight: 540 means 09:00. The driving profile chooses a preferred road path; it does not guarantee the fewest metres.
BUILD WITH V2
The v2 package contains JSON requests, a Python runner, a guided Jupyter notebook, a Postman collection, and a README. No credentials are included.
Four guided requests, Python, notebook, Postman, and GeoJSON export.
Endpoints, fields, authentication, responses, and limits.
Modes, routing, places, optimization, and GeoJSON export.
Import six v2 requests and set your API key in Postman.
YOUR OPERATION, CONNECTED
Ask for an API key or a walkthrough with your own data.