Get City Information
curl --request POST \
--url https://api.aisa.one/apis/v1/api-ninjas/get-city \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"country": "US",
"limit": 15,
"max_lat": 0,
"max_lon": 0,
"max_population": 1,
"min_lat": 0,
"min_lon": 0,
"min_population": 1,
"name": "London",
"offset": 1
}
'import requests
url = "https://api.aisa.one/apis/v1/api-ninjas/get-city"
payload = {
"country": "US",
"limit": 15,
"max_lat": 0,
"max_lon": 0,
"max_population": 1,
"min_lat": 0,
"min_lon": 0,
"min_population": 1,
"name": "London",
"offset": 1
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
country: 'US',
limit: 15,
max_lat: 0,
max_lon: 0,
max_population: 1,
min_lat: 0,
min_lon: 0,
min_population: 1,
name: 'London',
offset: 1
})
};
fetch('https://api.aisa.one/apis/v1/api-ninjas/get-city', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.aisa.one/apis/v1/api-ninjas/get-city",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'country' => 'US',
'limit' => 15,
'max_lat' => 0,
'max_lon' => 0,
'max_population' => 1,
'min_lat' => 0,
'min_lon' => 0,
'min_population' => 1,
'name' => 'London',
'offset' => 1
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.aisa.one/apis/v1/api-ninjas/get-city"
payload := strings.NewReader("{\n \"country\": \"US\",\n \"limit\": 15,\n \"max_lat\": 0,\n \"max_lon\": 0,\n \"max_population\": 1,\n \"min_lat\": 0,\n \"min_lon\": 0,\n \"min_population\": 1,\n \"name\": \"London\",\n \"offset\": 1\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.aisa.one/apis/v1/api-ninjas/get-city")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"country\": \"US\",\n \"limit\": 15,\n \"max_lat\": 0,\n \"max_lon\": 0,\n \"max_population\": 1,\n \"min_lat\": 0,\n \"min_lon\": 0,\n \"min_population\": 1,\n \"name\": \"London\",\n \"offset\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/api-ninjas/get-city")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"country\": \"US\",\n \"limit\": 15,\n \"max_lat\": 0,\n \"max_lon\": 0,\n \"max_population\": 1,\n \"min_lat\": 0,\n \"min_lon\": 0,\n \"min_population\": 1,\n \"name\": \"London\",\n \"offset\": 1\n}"
response = http.request(request)
puts response.read_body{
"details": [
{
"country": "<string>",
"is_capital": true,
"latitude": 123,
"longitude": 123,
"name": "<string>",
"population": 123,
"region": "<string>"
}
]
}API Ninjas
Get City Information
Get City Information
POST
https://api.aisa.one
/
apis
/
v1
/
api-ninjas
/
get-city
Get City Information
curl --request POST \
--url https://api.aisa.one/apis/v1/api-ninjas/get-city \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"country": "US",
"limit": 15,
"max_lat": 0,
"max_lon": 0,
"max_population": 1,
"min_lat": 0,
"min_lon": 0,
"min_population": 1,
"name": "London",
"offset": 1
}
'import requests
url = "https://api.aisa.one/apis/v1/api-ninjas/get-city"
payload = {
"country": "US",
"limit": 15,
"max_lat": 0,
"max_lon": 0,
"max_population": 1,
"min_lat": 0,
"min_lon": 0,
"min_population": 1,
"name": "London",
"offset": 1
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
country: 'US',
limit: 15,
max_lat: 0,
max_lon: 0,
max_population: 1,
min_lat: 0,
min_lon: 0,
min_population: 1,
name: 'London',
offset: 1
})
};
fetch('https://api.aisa.one/apis/v1/api-ninjas/get-city', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.aisa.one/apis/v1/api-ninjas/get-city",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'country' => 'US',
'limit' => 15,
'max_lat' => 0,
'max_lon' => 0,
'max_population' => 1,
'min_lat' => 0,
'min_lon' => 0,
'min_population' => 1,
'name' => 'London',
'offset' => 1
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.aisa.one/apis/v1/api-ninjas/get-city"
payload := strings.NewReader("{\n \"country\": \"US\",\n \"limit\": 15,\n \"max_lat\": 0,\n \"max_lon\": 0,\n \"max_population\": 1,\n \"min_lat\": 0,\n \"min_lon\": 0,\n \"min_population\": 1,\n \"name\": \"London\",\n \"offset\": 1\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.aisa.one/apis/v1/api-ninjas/get-city")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"country\": \"US\",\n \"limit\": 15,\n \"max_lat\": 0,\n \"max_lon\": 0,\n \"max_population\": 1,\n \"min_lat\": 0,\n \"min_lon\": 0,\n \"min_population\": 1,\n \"name\": \"London\",\n \"offset\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/api-ninjas/get-city")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"country\": \"US\",\n \"limit\": 15,\n \"max_lat\": 0,\n \"max_lon\": 0,\n \"max_population\": 1,\n \"min_lat\": 0,\n \"min_lon\": 0,\n \"min_population\": 1,\n \"name\": \"London\",\n \"offset\": 1\n}"
response = http.request(request)
puts response.read_body{
"details": [
{
"country": "<string>",
"is_capital": true,
"latitude": 123,
"longitude": 123,
"name": "<string>",
"population": 123,
"region": "<string>"
}
]
}Request contract
- Method and path: POST /apis/v1/api-ninjas/get-city
- Availability: enabled
- Request URL template:
https://api.aisa.one/apis/v1/api-ninjas/get-city
{
"operationId": "api-ninjas.get-city",
"method": "POST",
"path": "/apis/v1/api-ninjas/get-city",
"servers": [
{
"url": "https://api.aisa.one"
}
],
"parameters": [],
"security": [
{
"bearerAuth": []
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"properties": {
"country": {
"description": "ISO-3166 alpha-2 country code to filter cities (e.g., 'US', 'GB', 'JP').",
"examples": [
"US",
"GB",
"JP"
],
"type": "string"
},
"limit": {
"description": "Number of results to return per request (range: 1-30). Premium feature only.",
"maximum": 30,
"minimum": 1,
"type": "integer"
},
"max_lat": {
"description": "Maximum latitude coordinate for geographic filtering (range: -90 to 90).",
"maximum": 90,
"minimum": -90,
"type": "number"
},
"max_lon": {
"description": "Maximum longitude coordinate for geographic filtering (range: -180 to 180).",
"maximum": 180,
"minimum": -180,
"type": "number"
},
"max_population": {
"description": "Maximum population count for filtering cities.",
"minimum": 0,
"type": "integer"
},
"min_lat": {
"description": "Minimum latitude coordinate for geographic filtering (range: -90 to 90).",
"maximum": 90,
"minimum": -90,
"type": "number"
},
"min_lon": {
"description": "Minimum longitude coordinate for geographic filtering (range: -180 to 180).",
"maximum": 180,
"minimum": -180,
"type": "number"
},
"min_population": {
"description": "Minimum population count for filtering cities.",
"minimum": 0,
"type": "integer"
},
"name": {
"description": "City name to search for (e.g., 'London', 'New York').",
"examples": [
"London",
"Tokyo"
],
"type": "string"
},
"offset": {
"description": "Pagination offset to skip the first N results.",
"minimum": 0,
"type": "integer"
}
},
"type": "object"
}
}
},
"required": false
},
"x-aisa-status": "enabled",
"components": {
"securitySchemes": {
"bearerAuth": {
"scheme": "bearer",
"type": "http"
}
}
}
}
Cost and request rules
Usage-based pricing. Default request estimate: $0.00089 USD. The final charge depends on actual usage. Your account price may differ; use a request quote where supported.Authorizations
Body
application/json