For Agents
Look up city records with name, country, coordinates, population, and capital status by querying API Ninjas' single /city endpoint.
Get started with API Ninjas City API in minutes using your preferred integration method.
# Add to your MCP client config (Claude Desktop, Cursor, Windsurf)
{
"jentic": {
"url": "https://api.jentic.com/mcp",
"auth": "oauth"
}
}
# Then ask your agent:
"look up a city by name"
# → Jentic returns the GET /events tool with parameter schema, agent executes.What an agent can do with API Ninjas City API API.
Look up a city by name and receive its country, coordinates, population, and capital flag
Filter cities by country code to surface only matches inside a chosen jurisdiction
Constrain results to a population range using min_population and max_population
Limit the number of returned records with the limit parameter for pagination control
GET STARTED
Use for: I need to look up the population and coordinates of Lisbon, Find all capital cities in Africa, Search for cities in France with population over 500,000, Get the latitude and longitude for Buenos Aires
Not supported: Does not handle street-level geocoding, reverse geocoding from coordinates, or routing — use for city-level lookup of name, country, coordinates, and population only.
Jentic publishes the only available OpenAPI specification for API Ninjas City API, keeping it validated and agent-ready.
Jentic publishes the only available OpenAPI specification for API Ninjas City API, keeping it validated and agent-ready. The endpoint returns city records including name, country, latitude and longitude, population, and capital status, covering over 50,000 cities on the free plan and over 5,000,000 cities, towns, and villages on premium. It is a single-endpoint lookup that supports filtering by name, country, minimum and maximum population, and limit. Authentication is by X-Api-Key header.
Cross-reference unfamiliar place names in agent text against a structured city database
Patterns agents use API Ninjas City API API for, with concrete tasks.
★ Geocode a City Name in Agent Output
When an agent generates content that mentions a city, it can call /city with the city name to confirm the city exists, retrieve its coordinates, and ground later steps in real geographic data. This is a lightweight alternative to a full geocoding service for cases where only a city-level resolution is required.
Call GET /city with name=Lisbon and read the returned latitude, longitude, and population fields
Filter Cities by Population
Generate a list of mid-sized cities in a country for a market-research, travel, or content workflow by calling /city with a country code, min_population, and max_population. The endpoint returns each matching city with its coordinates, which can then feed a map widget or downstream analytics step. Limit controls how many are returned per call.
Call /city with country=FR min_population=100000 max_population=500000 limit=20 to list mid-sized French cities
Capital City Lookup
Build a quiz or factual lookup feature that returns the capital of a country by querying /city with the country code and filtering for the is_capital flag in the response. The same call surfaces population and coordinates, which is enough to render a single-card answer in a chat or knowledge experience.
Call /city with country=PT and pick the record where is_capital is true to surface Lisbon's coordinates and population
Agent Integration via Jentic
An AI agent built on Jentic can search for the API Ninjas city lookup operation by intent and execute it without holding the X-Api-Key in agent context. Jentic's MAXsystem keeps the credential isolated, which matters when many agents share a single API Ninjas key for low-cost data lookups.
Use Jentic search for 'look up a city by name', load the /city operation, execute it with name=Buenos Aires, and read the latitude, longitude, and population from the response
1 endpoints — jentic publishes the only available openapi specification for api ninjas city api, keeping it validated and agent-ready.
METHOD
PATH
DESCRIPTION
/city
Look up cities by name, country, or population range
/city
Look up cities by name, country, or population range
Three things that make agents converge on Jentic-routed access.
Credential isolation
The X-Api-Key is stored encrypted in the Jentic vault. Agents receive scoped execution tokens at call time and never hold the raw key, which is helpful when many agents share a single API Ninjas account.
Intent-based discovery
Agents search by intent such as 'look up a city by name' and Jentic returns the matching /city operation with its full input schema, so the agent can call it without reading the docs.
Time to first call
Direct integration: under an hour for a single endpoint with simple key auth. Through Jentic: a few minutes from search to first executed call.
Alternatives and complements available in the Jentic catalogue.
Geocodio
Full geocoder that resolves any address to coordinates, not just city centres
Choose Geocodio when you need street-level geocoding; choose API Ninjas City when a city-level lookup is enough
OpenCage Geocoding
Forward and reverse geocoding with worldwide coverage
Use OpenCage when you need reverse geocoding from coordinates back to a place; API Ninjas City only resolves names to coordinates
ipgeolocation.io
Resolve IP addresses to city, country, and coordinates
Use ipgeolocation.io to derive a starting city from a visitor IP, then enrich with API Ninjas City for population and capital metadata
Specific to using API Ninjas City API API through Jentic.
Why is there no official OpenAPI spec for API Ninjas City API?
API Ninjas does not publish an OpenAPI specification. Jentic generates and maintains this spec so that AI agents and developers can call API Ninjas City API via structured tooling. It is validated against the live API and kept up to date. Get started at https://app.jentic.com/sign-up.
What authentication does the API Ninjas City API use?
The endpoint requires an API key passed as the X-Api-Key header. When called through Jentic the key is held in the Jentic vault and a scoped execution token is granted to the agent at call time, never the raw key.
Can I filter cities by population with the API Ninjas City API?
Yes. GET /city accepts min_population and max_population query parameters which constrain the returned cities to the chosen range. Combine with country to filter inside a single jurisdiction and with limit to cap the number of records returned.
What are the rate limits for the API Ninjas City API?
API Ninjas applies a per-account monthly request quota that depends on the subscription tier rather than the OpenAPI spec. Check your API Ninjas dashboard for the current monthly ceiling and respect any 429 responses with exponential backoff.
How do I look up a city through Jentic?
Install the Jentic SDK with pip install jentic, search for 'look up a city by name', load the GET /city operation, and execute it with the name and any optional filters such as country or population. Sign up at https://app.jentic.com/sign-up to get a Jentic agent key.
How many cities does the API Ninjas City API cover?
The free plan covers over 50,000 cities. Premium plans cover more than 5,000,000 cities, towns, and villages, which is enough for fine-grained address-level lookups. Use the country and population filters to keep result sets manageable.