Geocoding API
Introduction
This API allows you to find the geo-coordinates of a known address, place, locality or administrative area, even if the query is incomplete or partly incorrect. It also returns a complete postal address string and address details.
Request Parameters
Loading..Response Schema
Loading..Examples
Let’s look for the term “market” with a countryCode of USA.
Sample API Request
curl --location 'https://api.nextbillion.io/geocode?in=countryCode:USA&key=<your_api_key>&at=40.720685,-74.044772&q=market'
Sample API Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184
{ "items": [ { "title": "New Market, MD, United States", "id": "vaZCqlvidC1a_t19m45pXg", "address": { "label": "New Market, MD, United States", "countryCode": "USA", "countryName": "United States", "stateCode": "MD", "state": "Maryland", "county": "Frederick", "city": "New Market" }, "scoring": { "queryScore": 0.33, "fieldScore": { "city": 1 } }, "position": { "lat": 39.38301, "lng": -77.26968 }, "access": [ { "lat": 39.38301, "lng": -77.26968 } ], "distance": 312170, "mapView": { "west": -77.3438, "south": 39.37098, "east": -77.21166, "north": 39.44301 } }, { "title": "New Market, AL, United States", "id": "x03GFeSXJ50d1SC-q6x1LQ", "address": { "label": "New Market, AL, United States", "countryCode": "USA", "countryName": "United States", "stateCode": "AL", "state": "Alabama", "county": "Madison", "city": "New Market" }, "scoring": { "queryScore": 0.33, "fieldScore": { "city": 1 } }, "position": { "lat": 34.91386, "lng": -86.41 }, "access": [ { "lat": 34.91386, "lng": -86.41 } ], "distance": 1261791, "mapView": { "west": -86.55311, "south": 34.79852, "east": -86.25577, "north": 34.99175 } }, { "title": "New Market, TN, United States", "id": "CzY4gTPbBmhbRkaq8BQlzQ", "address": { "label": "New Market, TN, United States", "countryCode": "USA", "countryName": "United States", "stateCode": "TN", "state": "Tennessee", "county": "Jefferson", "city": "New Market" }, "scoring": { "queryScore": 0.33, "fieldScore": { "city": 1 } }, "position": { "lat": 36.10017, "lng": -83.55205 }, "access": [ { "lat": 36.10017, "lng": -83.55205 } ], "distance": 973901, "mapView": { "west": -83.64015, "south": 35.98819, "east": -83.48022, "north": 36.19184 } }, { "title": "New Market, NC, United States", "id": "1N-vDvPmTyTCjTQNGRZrXQ", "address": { "label": "New Market, NC, United States", "countryCode": "USA", "countryName": "United States", "stateCode": "NC", "state": "North Carolina", "county": "Randolph", "city": "New Market" }, "scoring": { "queryScore": 0.33, "fieldScore": { "city": 1 } }, "position": { "lat": 35.83275, "lng": -79.86305 }, "access": [ { "lat": 35.83275, "lng": -79.86305 } ], "distance": 743518, "mapView": { "west": -79.92535, "south": 35.81112, "east": -79.82425, "north": 35.91557 } }, { "title": "New Market, VA, United States", "id": "QzgS2Pc9oJoOwAmsiT6b-A", "address": { "label": "New Market, VA, United States", "countryCode": "USA", "countryName": "United States", "stateCode": "VA", "state": "Virginia", "county": "Shenandoah", "city": "New Market" }, "scoring": { "queryScore": 0.33, "fieldScore": { "city": 1 } }, "position": { "lat": 38.64791, "lng": -78.67173 }, "access": [ { "lat": 38.64791, "lng": -78.67173 } ], "distance": 458044, "mapView": { "west": -78.77675, "south": 38.60465, "east": -78.5506, "north": 38.73969 } } ] }
API Query Limits
Nextbillion.ai allows a maximum rate limit of 2400 queries per minute or 40 queries/second for continuous requests.
API Error Codes
Response Code | Description | Additional Notes |
---|---|---|
200 | Normal success case. | Normal success case |
400 | Input validation failed. | There is a missing or an invalid parameter or a parameter with an invalid value type is added to the request. |
401 | APIKEY not supplied or invalid. | This error occurs when the wrong API key is passed in the request or the key is missing altogether |
403 | APIKEY is valid but does not have access to requested resources. | You might be querying for a geographical region which is not valid for your account, or requesting a service which is not enabled for you. |
404 | Requested host/path not found. | This error occurs when a malformed hostname is used. |
422 | Could not process the request. | Valid results could not be generated for the given parameters. Please modify the constraints/search query. |
429 | Too many requests. | QPM or API request count quota reached |
500 | Internal Service error. | There was an internal issue with NextBillion.ai services. You can reach out to [email protected] for an explanation. |