> ## Documentation Index
> Fetch the complete documentation index at: https://docs.datadocked.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Port Search

> Search ports by UN/LOCODE or name (case-insensitive contains match). Minimum 3 characters. Results are paginated at 50 ports per page. Costs 1 credit per request (only charged when ports are found). Rate limit: 50 requests/min.

Search ports by UN/LOCODE or name to look up coordinates and the canonical `port_call` code used by other endpoints.

> [!NOTE]
>
> **Credits:** 1 credit per request, only charged when ports are found.

## Usage

Matching is **case-insensitive** and uses a "contains" match against both the UN/LOCODE and the port name. The `query` must be at least **3 characters** long.

```
?query=rotterdam&page=1
```

## Pagination

Results are paginated at **50 ports per page**. The response includes `total`, `page`, and `limit` so you can walk through all matches.

## Rate limit

**50 requests per minute**

## Response Fields

* `total`: Total ports matching the query across all pages
* `page`: Current page number
* `limit`: Maximum ports per page (50)
* `items[]`:
  * `port_call`: UN/LOCODE identifier, or `null` for anchorages and terminals without a code
  * `port_address`: Port name with country
  * `latitude`: Latitude in decimal degrees
  * `longitude`: Longitude in decimal degrees

> [!TIP]
>
> Use the returned `port_call` code with the [Port Calls By Port](https://docs.datadocked.com/api-reference/port/port-calls-by-port.md) endpoint to pull vessel traffic for that port.


## OpenAPI

````yaml GET /get-ports
openapi: 3.1.0
info:
  title: Data Docked Maritime API
  description: >-
    A comprehensive maritime data API providing real-time vessel tracking, port
    operations, inspection data, and more. Access AIS data, vessel particulars,
    management information, and historical tracking data.
  version: 1.0.0
  contact:
    name: Data Docked Support
    url: https://datadocked.com/contact
servers:
  - url: https://datadocked.com/api/vessels_operations
    description: Production server
security:
  - apiKey: []
tags:
  - name: Account
    description: Account management endpoints
  - name: Vessel Operations
    description: Vessel data, location, and tracking endpoints
  - name: Port Operations
    description: Port calls and port data endpoints
paths:
  /get-ports:
    get:
      tags:
        - Port Operations
      summary: Port Search
      description: >-
        Search ports by UN/LOCODE or name (case-insensitive contains match).
        Minimum 3 characters. Results are paginated at 50 ports per page. Costs
        1 credit per request (only charged when ports are found). Rate limit: 50
        requests/min.
      operationId: getPorts
      parameters:
        - name: query
          in: query
          required: true
          description: >-
            Search term matched against port UN/LOCODE and name.
            Case-insensitive contains match. Minimum 3 characters.
          schema:
            type: string
            minLength: 3
          example: rotterdam
        - name: page
          in: query
          required: true
          description: Page number for pagination. Starts at 1.
          schema:
            type: integer
            minimum: 1
          example: 1
      responses:
        '200':
          description: Successful response with matching ports
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PortSearchResponse'
        '400':
          description: >-
            Bad request - Invalid parameters (e.g. query shorter than 3
            characters)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized - Invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    PortSearchResponse:
      type: object
      properties:
        total:
          type: integer
          description: Total number of ports matching the query across all pages.
        page:
          type: integer
          description: Current page number.
        limit:
          type: integer
          description: Maximum ports per page (50).
        items:
          type: array
          description: List of matching ports.
          items:
            type: object
            properties:
              port_call:
                type: string
                nullable: true
                description: >-
                  UN/LOCODE identifier. null for anchorages or terminals without
                  an assigned code.
              port_address:
                type: string
                description: Port name followed by country.
              latitude:
                type: number
                description: Latitude in decimal degrees.
              longitude:
                type: number
                description: Longitude in decimal degrees.
    Error:
      type: object
      properties:
        error:
          type: string
          description: Error type
        message:
          type: string
          description: Error message
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        Your personal API key found in your profile dashboard at
        https://datadocked.com/dashboard/my_keys

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.