Use the transport API from an AI agent
Get a Free key without a browser, connect an MCP client, or use the REST API for scheduled travel data.
Start with llms.txt for an operation list and usage rules. Import OpenAPI 3.1 for the exact parameters, response fields and problem details. The same key works with REST and MCP. Configure it as a secret on the tool runner. Keep it out of tool arguments, prompts and logs.
Get a Free key over HTTP
- Use an HTTP client outside the browser. Send
GET /agent-registration/challengeto this portal. The response containschallenge,difficultyandexpires_at. - Find a nonce whose SHA-256 digest starts with
difficultyzero bits. Hash the exact ASCII bytes ofchallenge + ":" + nonce. The nonce is a 16-digit lowercase hexadecimal string. Use code to compute it, not a language model. - Send
POST /agent-registrationto the same portal and from the same client network, withContent-Type: application/jsonand a JSON object containingchallengeandnonce. Submit beforeexpires_at. The registration contract describes the request and response.
This Python function computes the nonce:
from hashlib import sha256
def solve(challenge, difficulty):
prefix = (challenge + ":").encode("ascii")
for i in range(1 << 64):
nonce = f"{i:016x}"
digest = sha256(prefix + nonce.encode("ascii")).digest()
if int.from_bytes(digest, "big") >> (256 - difficulty) == 0:
return nonce
The 201 response contains account_id, api_key, claim_secret and plan: "free". Store
the secrets separately. The portal cannot show them again, and replaying the challenge won’t
recover them. Reuse the key until you no longer need the account. The hosted API has no usage
cap today, but agent registration is capped at five per client network and 200 overall in a
rolling day. On registration 429, wait for Retry-After, then get a fresh challenge.
If the deployment does not offer agent registration, a person can
create a key in the console.
To take ownership, sign in to the console and enter the claim_secret in
Claim an agent account. Do not paste the API key. Claiming does not change the agent’s key
or usage. It records who owns the account. Use Contact us in the console to discuss a paid plan.
Connect an MCP client
Add https://mcp.triptopology.com/mcp as a Streamable HTTP server in a client that can send
Authorization: Bearer <API key> on each request. There is no OAuth flow, standalone event
stream or session to resume. In the local portal stack, use http://localhost:8082/mcp.
Tool names match the REST operation IDs. For example, call getPlaces with
{"q":"FRA","kind":"airport","limit":5}. The result contains the API’s status and JSON
data; on API errors it is marked as a tool error and includes retry_after when supplied.
Discovery does not count toward usage. Each admitted tool request counts like a REST call.
Define a journey tool
For runners that don’t import OpenAPI, this is a minimal function definition.
Adapt the wrapper to your runner. The function name is local; wire it to
GET /v1/journeys and URL-encode the arguments as query parameters.
The tool uses the API defaults for the departure window and page size.
{
"name": "get_journeys",
"description": "Find recurring-schedule journey options on an origin-local date. Returns local times and running days, not live availability.",
"parameters": {
"type": "object",
"properties": {
"from": {
"type": "string",
"description": "Origin city or place ID, or an unambiguous exact name."
},
"to": {
"type": "string",
"description": "Destination city or place ID, or an unambiguous exact name."
},
"date": { "type": "string", "description": "YYYY-MM-DD in the origin's time zone." },
"modes": {
"type": "string",
"enum": ["all", "ground"],
"description": "Use ground to exclude flights."
},
"cursor": {
"type": "string",
"description": "Copy meta.next_cursor from the same query to continue."
}
},
"required": ["from", "to", "date"],
"additionalProperties": false
}
}
With the demo network, these arguments return the train, bus and flight option shown in the dated journey guide:
{ "from": "geonames:2886242", "to": "geonames:1850147", "date": "2026-12-03" }
Choose the smallest useful operation
Use getCities or getPlaces when you have a partial name, getConnections when asked
about direct services, and getDestinations to explore from one endpoint. Use getJourneys
only when there’s a date and the caller wants timed options. Ask for the intended city if
ambiguous_endpoint returns candidates. Never turn an empty list into “no service exists.”
Keep the running days, local times and operators with the answer. Verify schedule and availability before booking.
Read code on a problem response. Fix invalid inputs or credentials rather than retrying
unchanged. For cursor_expired, restart without a cursor. For a transient 503, honor
Retry-After and cap retries. If quota enforcement is on and a tool call returns 429, use the code to tell whether the key’s minute limit
or the account’s monthly quota was hit and wait for the indicated reset. See
rate limits and quotas.