Using the Digital Harbour API
What is an API?
An API (Application Programming Interface) is a way for software systems to communicate with each other. Instead of interacting with a platform through a visual interface, an API lets you send requests directly to a server and receive data back - programmatically.
This means you can pull data from Digital Harbour directly into your own applications, scripts, dashboards, or research workflows, without having to manually download files or use the web interface.
What Can the Digital Harbour API Do?
The Digital Harbour Public API gives you programmatic access to the same environmental and vessel data available on the platform. With it, you can:
- Retrieve time-series environmental data from buoys, weather stations, and ocean platforms
- Query metadata records describing available datasets
- List platforms and instruments contributing data to Digital Harbour
- Access static vessel information and historical AIS position data
Getting an API Key
All requests to the Digital Harbour API require an API key for authentication. Your API key is accessible once you've created a Digital Harbour account. Click the profile icon in the top right corner -> Profile -> Copy API Key -> API -> Authorize.
Once authorized, your API key will be included in every request as a header:
x-api-key: YOUR_API_KEY
Keep your API key private. Do not share it publicly or commit it to your version control software.
Making Your First Request
All API requests are made over HTTPS to the base URL:
https://covedigitalharbour.com/public-api/v1/
Every request must include the following headers:
| Header | Value |
|---|---|
x-api-key | Your API key |
Accept | application/vnd.api+json |
Example: Using cURL
The simplest way to test the API is with cURL, a command-line tool for making HTTP requests. The screenshot below shows what a typical request and its headers look like:

Here is an example request using cURL to retrieve available metadata records:
curl -X GET 'https://covedigitalharbour.com/public-api/v1/getMetadataRecords' \
-H "Accept: application/vnd.api+json" \
-H "x-api-key: YOUR_API_KEY"
Example: Using Python
import requests
url = "https://covedigitalharbour.com/public-api/v1/getMetadataRecords"
headers = {
"Accept": "application/vnd.api+json",
"x-api-key": "YOUR_API_KEY"
}
response = requests.get(url, headers=headers)
data = response.json()
print(data)
Example: Using JavaScript (fetch)
const response = await fetch(
'https://covedigitalharbour.com/public-api/v1/getMetadataRecords',
{
headers: {
'Accept': 'application/vnd.api+json',
'x-api-key': 'YOUR_API_KEY'
}
}
);
const data = await response.json();
console.log(data);
Pagination
Some endpoints return large datasets and support pagination using a next_token. If a response includes a next_token field, pass it as a query parameter in your next request to retrieve the following page of results:
curl -X GET 'https://covedigitalharbour.com/public-api/v1/getData?metadata_record_id=YOUR_ID&start_time=...&end_time=...&next_token=YOUR_NEXT_TOKEN' \
-H "Accept: application/vnd.api+json" \
-H "x-api-key: YOUR_API_KEY"
Continue requesting until no next_token is returned in the response.
Response Format
All responses are returned as JSON. A successful response returns an HTTP 200 OK status. Common error codes:
| Status | Meaning |
|---|---|
200 OK | Request was successful |
400 Bad Request | Missing or invalid parameters |
403 Forbidden | Invalid or missing API key |
500 Internal Server Error | Server-side error |
Next Steps
See the Endpoint Reference for a full list of available endpoints, their parameters, and example responses.
Available Endpoints
- Get Data — Retrieve time-series environmental data from a platform or metadata record
- Get Metadata Records — List datasets available to your account
- Get Platforms — List platforms and instruments contributing data
- Get Vessels — Retrieve static vessel information
- Get Positions — Retrieve historical AIS position data for a vessel