AgentAPIGate
Back to Catalog
GET /v1/geo/restcountries/by_codePack: local·MCP Tool: geo_restcountries_by_code

REST Countries v3.1 Lookup by ISO-3166 Code

Resolve an ISO 3166-1 alpha-2, alpha-3, or numeric country code to full country metadata, currencies, borders, area, TLD, and population.

API Key Price:$0.0015 / call
x402 Base USDC:$0.0020 / call
Partner Credit:eligible
1. Parameters & Controls
ISO 3166-1 alpha-2 (e.g. "DE", "US", "SG"), alpha-3 (e.g. "DEU"), or 3-digit numeric code ("276")
Get $0.25 Free Key →
curl -sG "https://api.agentapigate.ai/v1/geo/restcountries/by_code" \
  --data-urlencode "code=DE" \
  --data-urlencode "format=md" \
  -H "Authorization: Bearer aag_live_YOUR_KEY" \
  -H "X-AAG-Max-Cost: 0.0100"
1-Click Agent IDE Install
Add to Cursor (1-Click OAuth)
-78% tokens
# REST Countries v3.1 Lookup by ISO-3166 Code (`geo.restcountries.by_code`)
**cca2**: DE · **cca3**: DEU · **area**: 357114 · **population**: 83491249

## name
- **common**: Germany
- **official**: Federal Republic of Germany
- **nativeName**: deu: official: Bundesrepublik Deutschland, common: Deutschland
## currencies
- **EUR**: name: euro, symbol: €
## capital
- [1] Berlin
## borders
- [1] AUT
- [2] BEL
- [3] CZE
- [4] DNK
- [5] FRA
- [6] LUX
- [7] NLD
- [8] POL
- [9] CHE
## tld
- [1] .de

Endpoint Parameters, Cost & Token Economy Reference

Endpoint ID: geo.restcountries.by_code · Method: GET
ParameterTypeReqSample / DefaultDescription
codestringrequiredDEISO 3166-1 alpha-2 (e.g. "DE", "US", "SG"), alpha-3 (e.g. "DEU"), or 3-digit numeric code ("276")
formatenumoptionaljson | compact | mdResponse format; compact or md cuts LLM tokens.
dry_run0 | 1optional1Returns exact pre-flight price quote & validation at $0.00 cost.
Access Rail / MetricValuePolicy & SLA
API Key (PAYG)$0.0015 / call$0/mo · Balance never expires
Remote MCP Toolgeo_restcountries_by_codeOAuth 2.1 Hub & /mcp/local
x402 Base USDC$0.0020 / callZero-signup USDC enabled
P50 Latency1 ms$0 billed on empty or 4xx/5xx
Token Economy574t → 132t (-78%)Partner credit: eligible
Data AttributionSource: REST Countries Canonical v3.1 Country Reference Dataset (gitlab.com/restcountries/restcountries — MPL-2.0 / Open Data)

More geo.restcountries Sibling Endpoints

Frequently Asked Questions

How do I call REST Countries v3.1 Lookup by ISO-3166 Code (geo.restcountries.by_code) over REST and Remote MCP?

Send GET requests to https://api.agentapigate.ai/v1/geo/restcountries/by_code with an aag_live_* / aag_agent_* Bearer key, pay per call via x402 USDC, or call MCP tool geo_restcountries_by_code on https://mcp.agentapigate.ai/mcp.

What does geo.restcountries.by_code cost per call and are failed calls billed?

Each successful HTTP 200 response costs $0.0015 USD from a non-expiring PAYG balance ($0/month minimum). Upstream errors, empty responses, and ?dry_run=1 pre-flight quotes always bill $0.00.

How does ?format=md or ?format=compact optimize AI agent token usage on geo.restcountries.by_code?

Passing ?format=md transforms the response into normalized Markdown (~132 tokens vs ~574 raw tokens, saving 78% of LLM context budget) while preserving structured JSON via ?format=json.

Can I restrict an AI agent key to only local endpoints with a daily USD cap?

Yes. Create a scoped aag_agent_* sub-key via POST /v1/keys with allowed_packs: ["local"], optional allowed_endpoints: ["geo.restcountries.by_code"], read_only: true, and a hard daily_cap_usd enforced atomically in Redis.