Docs

Quickstart

From sign-up to your first vessel track in a few minutes. Everything is plain HTTPS and JSON. Base URL: https://api.aistrail.com. All times are UTC (ISO 8601), speeds in knots, angles in degrees.

Not for navigation. AIS data can be missing, delayed or wrong. Do not use AIS Trail for navigation, collision avoidance, search and rescue or any other safety-of-life purpose.

1. Sign up and confirm your email

Create an account with your work email address and a password of at least 10 characters; name and company are optional. AIS Trail is a service for professional users: when you sign up you confirm that you use it for your business or profession and accept the Terms of service, including the Refund and cancellation policy. The Privacy policy explains how we handle your data.

We email you a link to confirm the address. It works once, for 48 hours. Nothing arrived after a few minutes? Check your spam folder, then sign in and choose Resend link in the banner at the top of the dashboard. You can create API keys once the address is confirmed.

Your account starts on the Free plan: 500 credits a month, 1 request per second and the last 7 days of history, no card needed. Free is for trying the API; for production, see Upgrade and pay.

2. Create an API key

On the API keys page of your dashboard, name the key after the app or server that will use it and choose Create key. A key is ap_live_ followed by 32 characters. It is shown once, so copy it into a secret manager or an environment variable straight away. You can keep up to 5 active keys, for example one per app or environment. All keys of your account share its plan and its credits, and revoking a key takes effect immediately.

Send the key in a header on every request:

Authorization: Bearer ap_live_YOUR_KEY

The API does not accept the key in the URL (the live data WebSocket stream is the one exception), so it does not end up in logs, browser history or proxies. Call the API from your server or scripts, not from browser code: a key in a web page would be public.

The examples below read the key from an environment variable:

export AIS_TRAIL_KEY=ap_live_YOUR_KEY

3. Make your first request

Check that the key works with GET /v1/usage: it returns your plan, its limits and your credits, and uses no credits itself.

curl -H "Authorization: Bearer $AIS_TRAIL_KEY" "https://api.aistrail.com/v1/usage"

Response on a new Free account, trimmed:

{
  "plan": "free",
  "label": "Free",
  "limits": { "credits": 500, "rps": 1, "history_days": 7, "bbox": false, "track_points": 1000, "live": false, … },
  "sources": ["barentswatch", "digitraffic", "dma", "kystverket", "noaa"],
  "live": { "included": false, "sources": [], "ws_limit": 0, "ws_open": 0 },
  "credits": {
    "remaining": 500,
    "plan": { "monthly": 500, "used": 0, "remaining": 500, "period_start": "2026-10-01T00:00:00Z", "resets_at": "2026-11-01T00:00:00Z" },
    "packs": [], "packs_remaining": 0, "used_this_period": 0
  },
  "ws_open": 0,
  "period_resets_at": "2026-11-01T00:00:00Z",
  "private_vessels": { "access": "not_available" }
}

The same in Python with requests (pip install requests). The small get helper waits and retries when the API asks you to (see Limits and errors) and raises on any other error. The Python examples on this page build on each other: run them in one session or one file.

# Python
import os
import time

import requests

API = "https://api.aistrail.com"
s = requests.Session()
s.headers["Authorization"] = "Bearer " + os.environ["AIS_TRAIL_KEY"]


def get(path, params=None):
    """GET from the API. Waits and retries when the answer has Retry-After; raises on any other error."""
    while True:
        r = s.get(API + path, params=params, timeout=60)
        if r.status_code in (429, 503) and "Retry-After" in r.headers:
            time.sleep(int(r.headers["Retry-After"]))
            continue
        if not r.ok:
            try:
                problem = r.json()
            except ValueError:
                problem = {"detail": r.text}
            raise RuntimeError(f"{r.status_code} {problem.get('title', '')}: {problem.get('detail', '')}")
        return r


usage = get("/v1/usage").json()
print(usage["label"], "plan,", usage["credits"]["remaining"], "credits left")

A 401 Unauthorized means the header is missing, or the key is mistyped or revoked. The Overview page of your dashboard also shows a ready-to-run track request for a recent day.

curl -H "Authorization: Bearer $AIS_TRAIL_KEY" \
  "https://api.aistrail.com/v1/vessels/search?q=MYSTAR"
# Python
found = get("/v1/vessels/search", {"q": "MYSTAR"}).json()
for v in found["results"]:
    print(v["mmsi"], v["imo"], v["name"], v["last_seen"])

Searches the name and call sign (any part, case-insensitive), the start of an MMSI and exact IMO numbers; q takes 2 to 64 characters. Results are ordered by when the vessel was last seen, newest first; each has mmsi, name, imo, callsign, ship_type, length_m, last_seen and sources. Use limit (up to 50) and offset; the response carries next_offset.

GET /v1/vessels/{mmsi} returns the current identity (name, IMO, call sign, ship type, length, width, draught, destination, ETA) and a log of the distinct static reports the vessel has sent.

Search and lookups cover the sources of your plan and, on plans without live data (Free and Starter), data up to 24 hours ago. Pleasure craft, sailing vessels and Class B transponders without a valid IMO number are private vessels: search leaves them out and a lookup answers 404, as for a vessel never seen.

5. Fetch tracks and port calls

curl -H "Authorization: Bearer $AIS_TRAIL_KEY" \
  "https://api.aistrail.com/v1/vessels/276859000/track?from=2026-10-08T00:00:00Z&to=2026-10-09T00:00:00Z&resolution=1m"

On a Free key, use a date within the last 7 days: an older from returns 403 History limit.

# Python: one day of 1-minute positions, three days ago (inside Free's 7 days, outside the 24-hour delay)
from datetime import datetime, timedelta, timezone

day = datetime.now(timezone.utc).date() - timedelta(days=3)
one_day = {"from": day.isoformat(), "to": (day + timedelta(days=1)).isoformat()}
page = get("/v1/vessels/276859000/track", {**one_day, "resolution": "1m"}).json()
print(page["meta"]["count"], "positions, last page:", page["meta"]["complete"])
for p in page["positions"][:3]:
    print(p["ts"], p["lat"], p["lon"], p["sog"])

The response is {"meta": {…}, "positions": […]}. Each position has mmsi, ts, lat, lon, sog, cog, heading, nav_status (ITU-R M.1371 code), source and flags.

  • resolution=raw (the default) returns every fix; 1m and 1h return the latest real fix per vessel per minute or hour (no interpolation).
  • One query may span at most raw 24 hours, 1m 7 days, 1h 366 days. Longer ranges: split them.
  • from defaults to to minus 24 hours; to defaults to now minus 24 hours, the embargo cutoff (now on Pro and Business, which include live data); see meta.embargo_cutoff.
  • A page holds up to 1,000 rows on Free, so one day at 1m can take two pages: meta.complete is then false (see Page through results).
  • Fixes that imply a physically impossible jump are kept and marked flags: "implausible_jump", so you can decide what to do with them.

By IMO number

Ships change MMSI when they change flag. GET /v1/vessels/imo/{imo}/track follows the ship across MMSIs: each MMSI is counted only for the periods it reported this IMO number, and every row carries its mmsi. GET /v1/vessels/imo/{imo} lists the MMSIs and their periods. If you pass an IMO where an MMSI is expected, the API answers 400 with the right URL.

Port calls

A port call starts when a ship stops inside a port area and ends when it leaves; GET /v1/vessels/{mmsi}/port-calls lists them with the port, arrival, departure (null while in port), draught on arrival and departure, a cargo estimate and the previous and next port. Find port ids with GET /v1/ports?q=… and get a port's arrivals or departures with GET /v1/ports/{port_id}/calls?event=arrival. See Port calls.

curl -H "Authorization: Bearer $AIS_TRAIL_KEY" \
  "https://api.aistrail.com/v1/vessels/276859000/port-calls?from=2026-10-08&to=2026-10-22"

6. Query an area

Starter, Pro and Business plans can ask for every vessel inside a bounding box (Starter and Pro up to 2°×2°, Business up to 10°×10°). On Free, area queries return 403 Plan limit.

curl -H "Authorization: Bearer $AIS_TRAIL_KEY" \
  "https://api.aistrail.com/v1/area?bbox=54.95,10.6,55.6,11.25&from=2026-10-08T10:00:00Z&to=2026-10-08T12:00:00Z&resolution=1m"

bbox is lat_min,lon_min,lat_max,lon_max; a larger box than your plan allows returns 400 Bad request, and boxes across the antimeridian are not supported. Rows come day by day and, at raw resolution, area by area within a day; inside each group they are ordered by vessel and time. The default window is the hour before to. Heavy area queries (1m or 1h, or a side longer than 2°) may wait briefly and then answer 503 Server busy with Retry-After; no credits are taken.

7. Page through results

Large results are split into pages: 5,000 rows by default (1,000 on Free); set limit up to your plan's maximum of 1,000 rows on Free or 50,000 on paid plans. Follow meta.next until meta.complete is true. The cursor is opaque and signed; rows never repeat or go missing at page boundaries. Area pages are time-boxed on the server, so a page can hold fewer rows than limit: keep following next. Every page uses credits for the vessel-days it returns; a track page does not charge again for a vessel-day the previous page already counted.

# Python: every raw position of one ship on that day, page by page
rows = []
path, params = "/v1/vessels/imo/9892690/track", {**one_day, "resolution": "raw"}
while path:
    page = get(path, params).json()
    rows += page["positions"]
    path, params = page["meta"]["next"], None    # relative URL with the cursor; null on the last page
print(len(rows), "positions")
// JavaScript (Node 18+), an area query (Starter, Pro and Business)
const KEY = process.env.AIS_TRAIL_KEY;
const sleep = (s) => new Promise((done) => setTimeout(done, s * 1000));
(async () => {
  let url = "/v1/area?bbox=54.95,10.6,55.6,11.25&from=2026-10-08T10:00:00Z&to=2026-10-08T12:00:00Z";
  const rows = [];
  while (url) {
    const r = await fetch("https://api.aistrail.com" + url, { headers: { Authorization: `Bearer ${KEY}` } });
    const wait = r.headers.get("Retry-After");
    if ((r.status === 429 || r.status === 503) && wait) { await sleep(Number(wait)); continue; }
    if (!r.ok) throw new Error(`${r.status}: ${(await r.json()).detail}`);
    const page = await r.json();
    rows.push(...page.positions);
    url = page.meta.next;
  }
  console.log(rows.length);
})();

8. JSON, GeoJSON, CSV or Excel

  • format=geojson (application/geo+json): a track is one LineString per vessel with the fix times in properties.coordTimes; an area is a FeatureCollection of Points. Paging info is in the top-level meta.
  • format=csv: columns mmsi, ts, lat, lon, sog, cog, heading, nav_status, source, flags. Paging and attribution come in headers: X-Next-Cursor, Link: <…>; rel="next", X-Complete, X-Count, X-Attribution.
  • format=xlsx (Excel workbook): the same columns as csv on one sheet, header row frozen; the same headers as csv.
curl -sD headers.txt -H "Authorization: Bearer $AIS_TRAIL_KEY" -o page1.csv \
  "https://api.aistrail.com/v1/vessels/276859000/track?from=2026-10-08&to=2026-10-09&format=csv"
grep -i '^link:' headers.txt   # next page, if any

9. Attribution

The data comes from public sources whose licenses require attribution when you redistribute it. Every data response lists the sources it was built from in meta.attribution (or the X-Attribution header for CSV and Excel). Keep that text when you publish or pass on the data. Details: Data sources.

10. Limits and errors

  • Credits. Data responses use credits for what they return: 1 per vessel-day of track or area data, 1 per vessel from vessel details, batch, IMO lookup and search, 1 per port-call record, 1 per event record, 1 per point of vessel density or sea depth, 1 per started square degree of density statistics, 1 per submarine cable returned, 1 per live position (full table: Credits). Empty results and errors use none, and neither do /v1/usage and the stream. Credits are shared by all keys of your account. Monthly credits renew every billing period (every calendar month in UTC on Free) and are used before credit packs. Responses carry X-Credits-Used and X-Credits-Remaining; your dashboard shows the same balance.
  • Per second. Each key may send up to your plan's requests per second, with short bursts up to twice that. At most 2 requests per key are processed at a time.
  • Per query. A query that runs longer than the server limit is stopped with 503 and is not billed: narrow the box or the time range, or use a coarser resolution.

Every plan's numbers are in Plan limits. Errors are RFC 9457 problem details (application/problem+json): branch on the status and title, show detail to people. The ones you are most likely to meet:

StatusTitleWhat to do
400Bad request, Window too largeFix the parameter named in detail, or split a long time range.
401UnauthorizedSend a valid, unrevoked key as Authorization: Bearer …
403History limit, Plan limitYour plan does not cover this: a date older than 7 days on Free, an area query or a port call search across ports on Free, or live data on Free or Starter. Upgrade on the Plan page (see Upgrade and pay).
404Not foundThe vessel is not in the sources of your plan, or is a private vessel.
429Rate limited, Too many concurrent requestsWait Retry-After seconds, then retry.
402Out of creditsNo credits left: buy a credit pack or upgrade, or wait for credits_reset_at. Do not retry.
503Query timeoutNarrow the query; retrying it unchanged will time out again.
503Server busy, Live data unavailableWait Retry-After seconds, then retry.

A simple rule covers all of them: retry only when the response has a Retry-After header, after waiting that many seconds; otherwise fix the request. The get helper in step 3 does exactly that. Every status and title: Errors.

11. Upgrade and pay

Starter ($29 a month or $290 a year), Pro ($129 a month or $1,290 a year) and Business ($249 a month or $2,490 a year) give you more credits, up to 12 months of history (up to 24 months on Business) and area queries; Pro and Business also include live data; compare them in Pricing and Plan limits. Prices are in US dollars and exclude VAT or sales tax, and yearly billing costs ten times the monthly price (two months free).

  • Subscribe. On the Plan page of your dashboard, choose monthly or yearly billing and choose Subscribe to Starter, Subscribe to Pro or Subscribe to Business. Paddle's checkout opens; your payment details go to Paddle, not to us.
  • Paddle is our merchant of record. Paddle sells you the subscription, charges your payment method, adds VAT or sales tax where due and sends your receipts and invoices. The subscription renews automatically until you cancel it.
  • Your keys switch at once. As soon as the payment goes through, every key of your account uses the new limits; you keep the same keys and change nothing in your code. We confirm the new plan by email.
  • Credit packs. On any plan, Free included, Buy 20,000 credits on the Plan page adds a one-time pack ($49, valid for 12 months) after Paddle's checkout; packs add up and are used after your monthly credits.
  • Change or cancel. The Your subscription card on the Plan page switches plans and moves between monthly and yearly billing; before you confirm, it shows the amount due today or the credit. Manage billing opens Paddle's customer portal for invoices, your payment method and billing address. A cancellation takes effect at the end of the billing period; after that your account and its keys use the Free limits.

Cancellation, plan changes and refunds in detail: Refund and cancellation policy. If a payment fails, your account moves to the Free plan until the payment goes through; update your payment method from the Plan page. If your plan was set up by our team, the Plan page says so: write to us to change it.

12. Live data

Live data is included in Pro and Business, at no extra charge; Free and Starter do not include it. It applies to all keys of your account at once, opens the live endpoints and the WebSocket stream, and removes the 24-hour delay on history: meta.embargo_cutoff becomes null and history reaches the archive's latest write, about every 5 minutes.

Live data covers the northern Baltic (the waters off Helsinki and Kotka, the Archipelago Sea around Turku and the Gulf of Bothnia), the North Atlantic coast from the Skagerrak to the Barents Sea and Svalbard, and the waters around the stations of the AIS Trail receiver network, and comes only from the live sources open to customers, today barentswatch, digitraffic and the receiver network's stations (rx-<id>), and only within their coverage (see Data sources). Positions and names from other feeds are never merged in. The free live map also shows ships from feeds that are not part of the API, so a vessel you see on the map may have no live position here.

Latest positions inside a box (each side up to your plan's area limit; max_age in seconds, default one day):

curl -H "Authorization: Bearer $AIS_TRAIL_KEY" \
  "https://api.aistrail.com/v1/positions?bbox=59.9,24.6,60.3,25.2&max_age=600"

The answer has count, truncated (at most 2,000 vessels per request), positions and meta with the sources and their attribution. Each position has the track fields plus the vessel's name, imo, ship_type, size, destination and ETA when known, age_s and received_at. One vessel: GET /v1/vessels/{mmsi}/position, or the live_position field of GET /v1/vessels/{mmsi}.

For positions as they arrive, open the WebSocket wss://api.aistrail.com/v1/stream and send one subscription within 5 seconds: up to 10 boxes in bbox and/or up to 1,000 MMSIs in mmsi. The server answers {"type": "subscribed"} with the sources and their attribution, then sends {"type": "position"} messages, and {"type": "status"} when the live view stops or resumes being current.

# Python, with websockets 14 or later (pip install websockets)
import asyncio
import json
import os

from websockets.asyncio.client import connect


async def main():
    headers = {"Authorization": "Bearer " + os.environ["AIS_TRAIL_KEY"]}
    async with connect("wss://api.aistrail.com/v1/stream", additional_headers=headers) as ws:
        await ws.send(json.dumps({"bbox": [[59.9, 24.6, 60.3, 25.2]], "mmsi": [276859000]}))
        async for raw in ws:
            msg = json.loads(raw)
            if msg["type"] == "position":
                print(msg["mmsi"], msg["ts"], msg["lat"], msg["lon"], msg["sog"])
            else:
                print(msg)    # "subscribed" first; "status" when the live view goes stale or recovers


asyncio.run(main())

Open streams are limited per account (Pro 2, Business 5), and the stream uses no credits. Clients that cannot send headers on a WebSocket may pass the key as ?key= on this endpoint only. Close codes, stale-data headers and the rest: Live data in the API reference.

13. Use it from an AI assistant (MCP)

To let Claude, ChatGPT, Cursor or another MCP client look up ships for you, connect it to the AIS Trail MCP server: setup, the tools and how your key and credits apply are on the MCP server page.

14. Where to get help

  • Service status. GET https://api.aistrail.com/v1/status needs no key and says ok or degraded, with the reasons (see Status).
  • Reference. The API reference, Errors, Data sources and the machine-readable openapi.json.
  • The API or your account. Write to [email protected] from your account's email address. Include the request (method and URL), the time in UTC and the status, title and detail of the response. Never send a full key: the start of it that the API keys page shows is enough.
  • Payments, invoices and refunds. Paddle handles them and answers at paddle.net; our side is in the Refund and cancellation policy.
  • A mistake in these docs. Use Suggest an edit at the end of every docs page.

Found a mistake, or something unclear? Suggest an edit and we will fix the page.