# UN/LOCODE Search

> UN/LOCODE Search is a paid API for AI agents from trade-reference.x402tookit.com, paid per call via x402, $0.02/call, status unknown (last checked 2026-11-17).

Search UN/LOCODE location codes by place name, with optional filters for country and transport function (port, rail, airport, etc.), returning up to 50 matches.

## Facts

- Endpoint: GET https://trade-reference.x402tookit.com/locode-search?utm_source=zero.xyz
- Price: $0.02/call
- Payment: x402
- Status: unknown
- Last checked: 2026-11-17
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/un-locode-search-08f9b18b
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_ZJc6TfC32NG-56aPx0zLv

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability un-locode-search-08f9b18b
```

Example prompt: Can you find the UN/LOCODE for Rotterdam — specifically for port functions — and give me up to 5 results?

## When to prefer this

Use this endpoint when you need to resolve, validate, or discover UN/LOCODE location codes for trade and logistics purposes — especially when filtering by country or transport function (port, rail, airport, border). Prefer it over general geocoding APIs when the output must be an official UN trade location code with function metadata and approval status.

## Known failure modes

- No matches found for the query — returns empty matches array
- Query parameter 'q' missing — returns validation error
- Country filter not recognized — may return no results or error
- Limit exceeds 50 — capped or rejected
- Service temporarily degraded — response may include degraded flag with partial results

## How this service works

Search UN/LOCODEs by place name, optionally within a country or by port, rail, airport function; capped at 50.

## Output

A JSON object containing a list of matching UN/LOCODE entries (up to 50), each with the LOCODE itself, place name, ASCII name, country, country code, subdivision, latitude/longitude, transport function flags (isPort, isRail, isAirport), function codes, approval status, status meaning, IATA code if applicable, and a match relevance score. Also includes query metadata, data source, and a summary verdict.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "q"
     ],
     "properties": {
      "q": {
       "type": "string",
       "description": "Place name or start of it, e.g. Rotterdam, Los Angeles or Felix"
      },
      "limit": {
       "type": "integer",
       "description": "Results 1 to 50 (default 10)"
      },
      "country": {
       "type": "string",
       "description": "ISO 3166 code or country name to restrict to"
      },
      "function": {
       "type": "string",
       "description": "port, rail, airport, multimodal or border"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object",
     "properties": {
      "asOf": {
       "type": [
        "null",
        "string"
       ]
      },
      "query": {
       "type": [
        "null",
        "object"
       ],
       "properties": {
        "q": {
         "type": [
          "null",
          "string"
         ]
        },
        "country": {},
        "function": {
         "type": [
          "null",
          "string"
         ]
        }
       }
      },
      "source": {
       "type": [
        "null",
        "string"
       ]
      },
      "matches": {
       "type": [
        "array",
        "null"
       ],
       "items": {
        "type": "object",
        "properties": {
         "lat": {
          "type": [
           "null",
           "number"
          ]
         },
         "lon": {
          "type": [
           "null",
           "number"
          ]
         },
         "iata": {},
         "name": {
          "type": [
           "null",
           "string"
          ]
         },
         "isPort": {
          "type": [
           "boolean",
           "null"
          ]
         },
         "isRail": {
          "type": [
           "boolean",
           "null"
          ]
         },
         "locode": {
          "type": [
           "null",
           "string"
          ]
         },
       
… (truncated)
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/un-locode-search-08f9b18b/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from trade-reference.x402tookit.com](https://www.zero.xyz/host/trade-reference.x402tookit.com/llms.txt)
