canonical: https://jentic.com/apis/distancematrix-ai/distancematrix-ai

# DistanceMatrix.ai API

Jentic publishes the only available OpenAPI specification for DistanceMatrix.ai API, keeping it validated and agent-ready. DistanceMatrix.ai provides distance, travel-time, and geocoding services worldwide with support for driving, walking, bicycling, and transit modes, including real-time traffic. The two operations cover bulk distance/duration calculations between origin/destination pairs and forward geocoding of free-form addresses to coordinates. It is positioned as a lower-cost alternative to Google's Distance Matrix and Geocoding APIs.

## For AI agents

Calculate driving, walking, transit, and bicycling distances and durations with real-time traffic, and geocode addresses to coordinates worldwide. Useful for logistics, ride-hailing, and field-service agents.

## Scope

Does not handle turn-by-turn navigation, map tile rendering, reverse geocoding, or fleet routing optimisation - use for distance/duration calculations and forward geocoding only.

## Capabilities

- Calculate distances and travel times between origin/destination pairs via `/maps/api/distancematrix/json`
- Apply real-time traffic predictions to driving distance results when departure_time is supplied
- Switch routing mode between driving, walking, bicycling, and transit on each request
- Forward geocode free-form addresses to latitude/longitude coordinates via `/maps/api/geocode/json`
- Filter by language, region, and avoid options (tolls, highways, ferries) for routing

## Use cases

### Delivery and Field-Service Routing

Logistics, food delivery, and field-service businesses can compute distance and ETA between dispatch locations and many destinations using a single `/maps/api/distancematrix/json` call. Supplying a departure_time returns traffic-aware durations for accurate ETAs. The bulk request format reduces network overhead compared to per-pair calls and is well suited to dispatch-time route assignment.

Example prompt: Call `/maps/api/distancematrix/json` with one origin (depot) and 10 destinations, mode='driving', and departure_time='now' to get traffic-aware ETAs.

### Address Cleansing and Geocoding for CRM Systems

CRM and ops teams can run customer or supplier address strings through `/maps/api/geocode/json` to obtain validated coordinates and standardised address components. This improves map rendering, territory assignment, and downstream routing accuracy. Geocoding at import time avoids per-display latency in dashboards and customer apps.

Example prompt: POST address strings to `/maps/api/geocode/json` one at a time and store the returned latitude/longitude on the customer record for map display.

### Multi-Modal Travel Time Comparison

Travel apps, real estate platforms, and commute tools can compare travel times across driving, walking, cycling, and transit by issuing parallel requests with different mode parameters. This is the core data behind 'how long does it take to get to work' style features and rental search filters that enforce a maximum commute. The lower per-request cost compared with Google Maps makes it attractive for high-volume consumer apps.

Example prompt: For origin/destination pair, call `/maps/api/distancematrix/json` once per mode in [driving, walking, bicycling, transit] and return the durations in a single response object.

### AI Agent Logistics Assistant

AI agents handling logistics or travel planning can ask DistanceMatrix.ai for distances and ETAs through Jentic without managing API keys directly. The two operations are exposed as named tools, and the apiKey is held in your Jentic One instance so it never enters the agent's context. Agents typically chain a `/maps/api/geocode/json` call with `/maps/api/distancematrix/json` to convert addresses into a routing answer.

Example prompt: Search Jentic for 'calculate driving time between addresses', load the `/maps/api/distancematrix/json` operation, and execute it with origins, destinations, and departure_time='now'.

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| GET | `/maps/api/distancematrix/json` | Compute distances and durations between origin/destination pairs |
| GET | `/maps/api/geocode/json` | Forward geocode an address into coordinates |

## Key resources

- **Distance Matrix** — Bulk distance and travel-time calculations between origin/destination pairs across modes
- **Geocoding** — Forward geocoding of free-form addresses to latitude/longitude

## AI readiness

This API is usable in Jentic One now. Its AI-readiness score against Jentic's framework shows where it stands today and where improvements would make it even easier for agents to use.

- **Score:** 48 / 100
- **Maturity:** Foundational
- **Dimensions:**
  - Foundational Compliance: 100 / 100
  - Developer Experience & Jentic Compatibility: 59 / 100
  - AI-Readiness & Agent Experience: 49 / 100
  - Agent Usability: 94 / 100
  - Security: 15 / 100
  - AI Discoverability: 88 / 100
- **View full report:** https://jentic.com/apis/distancematrix-ai/distancematrix-ai/scorecard
- **How the score is calculated:** https://docs.jentic.com/reference/api-readiness-framework/overview/
- **More about the dimensions:** https://docs.jentic.com/reference/api-readiness-framework/specification/#dimensional-model-overview

### Score it yourself

Every API in the directory is allowlisted, so you can re-score it with no key required.

- **Score your own API:** https://jentic.com/scorecard.md
- **Scoring CLI agent skill:** https://github.com/jentic/jentic-api-scorecard/blob/main/skills/jentic-api-scorecard/SKILL.md

```sh
npx @jentic/api-scorecard-cli score <openapi-url>
```

## Why Jentic

- **Setup:** Wiring DistanceMatrix.ai by hand means placing its key in the 'key' query parameter and formatting distance and geocode requests yourself. Through Jentic you install once, import the DistanceMatrix.ai API from the API Directory, store the key once, and your agent calls it.
- **Permission scoping:** DistanceMatrix.ai passes its inputs as query parameters, so scope your agent to the operations it needs, such as distance-matrix calculations or forward geocoding. You choose the operations it may call, so geocoding is not included if you only grant distance calculations.
- **Credential handling:** Your DistanceMatrix.ai API key is stored once, encrypted, by your own Jentic One instance and injected at execution time. It never enters the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'calculate driving time' or 'geocode an address', and Jentic returns the matching DistanceMatrix.ai operation with its input schema so the agent calls the right endpoint without browsing the reference docs.

## Related APIs

- **Google APIs** — Google's Distance Matrix and Geocoding APIs (the canonical reference)
- **HERE Maps** — Enterprise-grade routing, geocoding, and matrix routing APIs
- **TomTom Routing** — TomTom's routing and matrix routing APIs
- **Positionstack** — Forward and reverse geocoding API

## FAQ

### Why is there no official OpenAPI spec for DistanceMatrix.ai API?

DistanceMatrix.ai does not publish an OpenAPI specification. Jentic generates and maintains this spec so that AI agents and developers can call DistanceMatrix.ai API via structured tooling. It is validated against the live API and kept up to date. Get started with Jentic One, the self-hosted execution layer.

### What authentication does the DistanceMatrix.ai API use?

It uses an API key passed via the 'key' query parameter on every request. Keys are issued from the DistanceMatrix.ai dashboard. Through Jentic, the key is stored encrypted in your Jentic One instance and injected at execution, so the agent never sees the raw key.

### Can I get traffic-aware travel times with the DistanceMatrix.ai API?

Yes, supply departure_time on the `/maps/api/distancematrix/json` call (e.g. 'now' or a future Unix timestamp) and DistanceMatrix.ai returns traffic-adjusted durations for the driving mode. Without departure_time, durations are returned without traffic.

### What are the rate limits for the DistanceMatrix.ai API?

Rate limits are tier-dependent: free plans cap at a low daily volume, while paid plans publish per-second and per-day caps from the DistanceMatrix.ai dashboard. The OpenAPI spec does not encode plan-specific limits. Check your dashboard for the exact figures applied to your key.

### How do I geocode an address with DistanceMatrix.ai through Jentic?

Search Jentic for 'geocode an address', load the schema for `/maps/api/geocode/json`, and execute it with the address string. Jentic returns the geocoded result with latitude, longitude, and standardised address components.

### How does the DistanceMatrix.ai API compare with Google Maps?

DistanceMatrix.ai positions itself as a lower-cost alternative to Google's Distance Matrix and Geocoding APIs with a similar request shape. Pricing per call is significantly lower, but coverage and traffic-data quality vary by region. Test your specific cities before migrating high-value workloads.

### Can I limit what my agent is allowed to do with the DistanceMatrix.ai API?

Yes. Jentic One runs self-hosted, so your own rules decide which of the two DistanceMatrix.ai operations your agent may call: distance and travel-time calculations on `/maps/api/distancematrix/json` and forward geocoding on `/maps/api/geocode/json.` If you grant only distance calculations, the agent cannot geocode addresses, and vice versa. You also hold the DistanceMatrix.ai API key in your own instance, where it is injected at execution time and never exposed to the agent.
