---
name: barentswatch-ais-api-ingestion
description: "How to get BarentsWatch AIS API data into a pandas DataFrame and Parquet: access, the request, the format, limits, quirks and terms."
---

# Load BarentsWatch live AIS positions into pandas and Parquet

Source entry: https://signal-lab-jet.vercel.app/datasets/barentswatch-ais-api
Provider: https://developer.barentswatch.no/docs/category/ais
Checked against the provider's documentation: 2026-11-05

## Access
- Register a free client at developer.barentswatch.no to get a client id/secret, then complete the OpenID Connect flow to get a bearer access token.
- The snippet reads BARENTSWATCH_ACCESS_TOKEN from the environment; it does not perform the OpenID Connect handshake itself.

## Request
```bash
curl -H "Authorization: Bearer $BARENTSWATCH_ACCESS_TOKEN" 'https://live.ais.barentswatch.no/v1/combined'
```

## Format
JSON AIS position records (mmsi, latitude, longitude, speedOverGround, msgtime and similar fields) as documented on the live AIS OpenAPI host; exact schema is on live.ais.barentswatch.no.

## Load into pandas and Parquet
Needs Python 3 with requests, pandas and pyarrow.
```python
"""BarentsWatch live AIS sample -> pandas -> Parquet. Needs a registered client and an OpenID Connect token.

Reads the access token from BARENTSWATCH_ACCESS_TOKEN; register a free client and complete
the OpenID Connect flow to obtain one before running this.
"""
import os
import requests
import pandas as pd

TOKEN = os.environ["BARENTSWATCH_ACCESS_TOKEN"]
URL = "https://live.ais.barentswatch.no/v1/combined"
r = requests.get(URL, headers={"Authorization": f"Bearer {TOKEN}"}, timeout=60)
r.raise_for_status()
payload = r.json()
df = pd.json_normalize(payload if isinstance(payload, list) else payload.get("data", []))
df.to_parquet("barentswatch_ais_sample.parquet", index=False)
print(len(df), "AIS position rows")

```
Run by us on 2026-11-05 (python 3.13 | not executed — credentials required). Result: Not executed without credentials (requires free BarentsWatch client registration and OpenID access token in BARENTSWATCH_ACCESS_TOKEN).

## Limits
- Rate/performance limits: Not stated beyond describing the AIS host as a live service.
- Authentication is mandatory; there is no keyless or anonymous access tier.

## Quirks
- The live AIS host (live.ais.barentswatch.no) is documented separately from the main developer.barentswatch.no API catalogue.
- Do not add a separate Kystverket entry for this feed; Kystverket corroborates the same underlying Norwegian Coastal Administration AIS data.

## Terms and attribution
- BarentsWatch publishes API data under NLOD unless a specific dataset says otherwise, and commercial use is allowed if you follow its guidelines and credit "Data delivered by BarentsWatch" (or the Norwegian form).
- Terms page: https://data.norge.no/nlod/en/2.0

## Sources
- https://www.barentswatch.no/en/articles/api-terms-and-conditions/: "Information from BarentsWatch APIs are made available by the Norwegian Licence for Open Government Data (NLOD)"
- https://www.barentswatch.no/en/articles/api-terms-and-conditions/: "You may use data from BarentsWatch commercially as long as you follow the guidelines"

## Help improve this skill
Missing a source, or see something to improve? Call the MCP tool suggest_source or feedback (or POST /api/suggest or /api/feedback). Reviewed ideas: https://signal-lab-jet.vercel.app/agent-suggestions

Information for educational purposes only. Free tiers, limits and licenses belong to the providers and may change; check the provider's own terms before using the data.
