VesselAPI Documentation

Welcome to VesselAPI. This API provides access to real-time and short-term historical AIS vessel tracking, port events, NAVTEX safety messages, global port data, and navigation infrastructure.

Base URL: https://api.vesselapi.com/v1

Quick Start

  1. Sign up for an API key at vesselapi.com
  2. Include your API key in the Authorization header
  3. Make requests to the endpoints
  4. Process the JSON responses

API Categories

Documentation is organized by API category:

Authentication

All API requests require authentication using an API key. Include your API key in the Authorization header of every request.

Header Format

Authorization: Bearer YOUR_API_KEY

Example Request

curl -X GET "https://api.vesselapi.com/v1/vessel/123456789?filter.idType=mmsi" \
     -H "Authorization: Bearer YOUR_API_KEY"

Usage Quotas

Each subscription tier has a monthly request quota. When your key exceeds its monthly quota, the API returns HTTP 429. Track remaining usage via the X-RateLimit-Remaining response header.

Best Practice: Monitor X-RateLimit-Remaining to avoid hitting your quota. Implement exponential backoff when receiving 429 errors.

Error Handling

The API uses standard HTTP status codes and returns detailed error information in JSON format.

Error Types

invalid_request_error

The request had invalid parameters or was malformed.

HTTP Status: 400 Bad Request

authentication_error

Invalid API key or authentication failure.

HTTP Status: 401 Unauthorized

not_found_error

The requested resource was not found.

HTTP Status: 404 Not Found

rate_limit_error

Monthly request quota exceeded.

HTTP Status: 429 Too Many Requests

api_error

An internal server error occurred. These errors include a tracking ID for support.

HTTP Status: 500 Internal Server Error

service_unavailable_error

The service is temporarily unavailable. Retry after a brief delay.

HTTP Status: 503 Service Unavailable

Error Codes

Code Description
resource_missing The requested resource (vessel, port, etc.) could not be found
invalid_parameter A parameter value is invalid or malformed
invalid_mmsi The provided MMSI (Maritime Mobile Service Identity) is not valid. MMSI must be a 9-digit number
invalid_imo The provided IMO number is not valid. IMO must be a 7-digit number
invalid_coordinates The provided latitude/longitude coordinates are invalid
invalid_time_range The time range is invalid (e.g., end time before start time, or range too large)
missing_parameter A required parameter was not provided
invalid_api_key The provided API key is invalid or has been revoked
rate_limit_exceeded Your API key has exceeded its monthly request quota
internal_error An unexpected error occurred on the server. Contact support with the error_id if it persists
database_error A database operation failed. This is a transient error; retry the request after a brief delay
service_unavailable The service is temporarily unavailable. Retry after a brief delay

Error Response Format

All errors return a JSON object with an error key. The fields included vary by error type.

400 Bad Request

Includes param and doc_url fields to help identify the issue.

{
  "error": {
    "type": "invalid_request_error",
    "message": "Invalid MMSI: abc123",
    "code": "invalid_mmsi",
    "param": "mmsi",
    "doc_url": "https://vesselapi.com/docs#invalid_mmsi"
  }
}

401 Unauthorized

{
  "error": {
    "type": "authentication_error",
    "message": "api key is invalid or not found",
    "code": "invalid_api_key"
  }
}

404 Not Found

{
  "error": {
    "type": "not_found_error",
    "message": "Vessel with MMSI 999999999 not found.",
    "code": "resource_missing"
  }
}

429 Too Many Requests

{
  "error": {
    "type": "rate_limit_error",
    "message": "API monthly quota exceeded",
    "code": "rate_limit_exceeded"
  }
}

500 Internal Server Error

Includes a unique tracking ID and timestamp for support.

{
  "error": {
    "type": "api_error",
    "message": "An internal error occurred. Please reference error ID 550e8400-e29b-41d4-a716-446655440000 when contacting support if this issue persists.",
    "code": "internal_error",
    "error_id": "550e8400-e29b-41d4-a716-446655440000",
    "timestamp": "2025-10-31T15:30:45Z"
  }
}

Reference the error_id when contacting support for faster resolution.

503 Service Unavailable

{
  "error": {
    "type": "service_unavailable_error",
    "message": "The service is temporarily unavailable. Retry after a brief delay.",
    "code": "service_unavailable"
  }
}

Pagination

List endpoints support pagination using cursor-based navigation.

Parameters

pagination.limit

Number of results to return per page (max 50, default 20)

pagination.nextToken

Cursor for the next page of results (provided in response)

Response Format

{
  "vessels": [...],
  "nextToken": "eyJsYXN0X2lkIjoxMjM0NTY3ODl9"
}

The array key varies by endpoint (e.g., vessels, vesselPositions, ports, portEvents, navtexMessages, emissions, casualties, inspections, dgpsStations, lightAids, radioBeacons, modus). The nextToken field is at the top level of the response.

Best Practices

Cache Responses

Static vessel data and port data are updated daily. Cache these responses to reduce API usage. AIS position data changes every 2-30 seconds for moving vessels, so cache TTLs should match your freshness requirements.

Handle Rate Limits

Implement exponential backoff when receiving 429 errors. Start with a 1-second delay and double it for each subsequent retry.

Use Pagination Efficiently

Request only the data you need. Use reasonable page sizes (20-50 items) and store pagination keys for subsequent requests.

Validate Input

Validate MMSI (9 digits) and IMO (7 digits) numbers on the client side before making API requests.

Monitor Error IDs

Log error IDs from 500 errors for troubleshooting. Include them when contacting support.

Ready to Get Started?

Try the endpoints interactively in the API Explorer or sign up for an API key.