# 2s UN/LOCODE Trade Location Lookup

> 2s UN/LOCODE Trade Location Lookup is a paid API for AI agents from 2s.io, paid per call via x402, $0.0025/call, status unknown (last checked 2026-11-17).

Look up UN/LOCODE trade and transport location codes by name, exact code, country, or function type, returning structured location metadata.

## Facts

- Endpoint: GET https://2s.io/api/trade/locode?utm_source=zero.xyz
- Price: $0.0025/call
- Payment: x402
- Status: unknown
- Last checked: 2026-11-17
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/2s-un-locode-trade-location-lookup-ae2c2449
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_U6W76YKrOOaYl909Tm0fl

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 2s-un-locode-trade-location-lookup-ae2c2449
```

Example prompt: What's the UN/LOCODE for New York, and what transport functions does it support — can you look it up by the code USNYC?

## When to prefer this

Use this endpoint when you need authoritative UN/LOCODE data for trade, logistics, or supply chain workflows — e.g. validating shipping location codes, enriching shipment records with coordinates, looking up port or airport codes by name, or filtering locations by country and transport function. Prefer over generic geocoding when the UN/LOCODE identifier itself is the required output or input for EDI/trade documents.

## Known failure modes

- No matching LOCODE found for the given code or name — returns empty items array with total:0
- Invalid country code supplied — may return no results or an error
- Query string too vague — returns up to limit results which may not include the intended location
- Missing required queryParams (both locode and query omitted) — API may return error or empty set
- Rate or payment failure via x402 — request blocked if USDC payment not provided

## How this service works

Look up or search UN/LOCODE — the United Nations Code for Trade and Transport Locations (~116k locations, all countries). Pass `locode` for an exact code (e.g. USNYC or 'US NYC'). Or pass `query` to search location names, optionally filtered by `country` (ISO 3166 alpha-2) and `function` (port, rail, road, airport, postal, multimodal, fixed, border). Each result: locode, name, country, subdivision, transport functions, entry status, IATA code where it differs, and coordinates. UN/LOCODE is the standard location identifier in shipping schedules, EDI messages, and customs documents.

## Output

Returns a list of matching UN/LOCODE location records, each with the official LOCODE string, location name, country, subdivision, coordinates (lat/lon), transport function codes and their human-readable meanings (port, rail, road, airport, postal, etc.), status code with meaning, IATA code if applicable, and last-updated timestamp. Also includes total result count and source/license attribution from UNECE.

## 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",
    "queryParams"
   ],
   "properties": {
    "type": {
     "const": "http"
    },
    "method": {
     "const": "GET"
    },
    "queryParams": {
     "properties": {
      "limit": {
       "type": "integer",
       "description": "1–50, default 10 (query mode)."
      },
      "query": {
       "type": "string",
       "description": "Location name to search."
      },
      "locode": {
       "type": "string",
       "description": "Exact UN/LOCODE, e.g. USNYC or 'US NYC'."
      },
      "country": {
       "type": "string",
       "description": "ISO 3166 alpha-2 filter for query mode."
      },
      "function": {
       "type": "string",
       "description": "port | rail | road | airport | postal | multimodal | fixed | border."
      }
     }
    }
   }
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/2s-un-locode-trade-location-lookup-ae2c2449/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from 2s.io](https://www.zero.xyz/host/2s.io/llms.txt)
