Skip to content

This search API is typically used when the input is a full address.

Request

Endpoint

https://dplace-api.themap.world/maps/api/place/textsearch/json

Query params

ParamRequiredDescription
queryRequiredThe search text, for example: "lotte phu thuy"
radiusOptionalSearch radius around the focus point, in meters, max 50000, for example: 5000 (= 5km)
sizeOptionalNumber of results returned
has_deprecated_adminOptionaltrue if you want to return old_formatted_address, old_address_components

Example

curl --location 'https://dplace-api.themap.world/maps/api/place/textsearch/json?query=75 Trương Công Định, Phường Phú Lợi, Thành phố Cần Thơ&has_deprecated_admin=true&radius=5000&key=YOUR_API_KEY'

Response

textsearch/json wraps the response in the following top-level fields:

FieldWhen presentContent
statusalwaysOK, ZERO_RESULTS, INVALID_REQUEST, or UNKNOWN_ERROR
resultsalwaysarray of place objects (empty array on ZERO_RESULTS / errors)
error_messageon INVALID_REQUEST / UNKNOWN_ERRORerror description
html_attributionsalways[] — no third-party attribution data

status

ValueMeaning
OKsuccess, results found
ZERO_RESULTSsuccess but no results matched
INVALID_REQUESTmissing or invalid parameter (HTTP 400)
UNKNOWN_ERRORserver-side error: timeout, backend unreachable (HTTP 502/500)

results

Each item in results is a place object with the fields shown in the example response body above:

FieldWhen presentContent
place_idalwaysunique identifier for the place
distancewhen focus.point.lat/lon is passeddistance from the focus point, in km
namealwaysplace name
formatted_addressalwaysstandardized full address
old_formatted_addressalwaysaddress before an administrative merge, or "" if none
geometryalwayslocation (lat/lng) and viewport (northeast/southwest bounds)
typesalwaysarray of place type classifications

error_message

When the request has an invalid parameter, textsearch/json still returns HTTP 200 with status: "INVALID_REQUEST":

{
  "status": "INVALID_REQUEST",
  "error_message": "query is required",
  "results": [],
  "html_attributions": []
}

On a server-side failure, status is UNKNOWN_ERROR:

{
  "status": "UNKNOWN_ERROR",
  "error_message": "backend unreachable",
  "results": [],
  "html_attributions": []
}

Example:

{
  "status": "OK",
  "results": [
    {
      "place_id": "1:address:d2a3105720e541a49c5f3140c0fa19ab",
      "name": "75 Trương Công Định",
      "address_components": [
        {
          "long_name": "75",
          "short_name": "75",
          "types": [
            "street_number"
          ]
        },
        {
          "long_name": "Trương Công Định",
          "short_name": "Trương Công Định",
          "types": [
            "route"
          ]
        },
        {
          "long_name": "Phường Phú Lợi",
          "short_name": "Phường Phú Lợi",
          "types": [
            "administrative_area_level_2"
          ]
        },
        {
          "long_name": "Thành phố Cần Thơ",
          "short_name": "Thành phố Cần Thơ",
          "types": [
            "administrative_area_level_1"
          ]
        },
        {
          "long_name": "Việt Nam",
          "short_name": "VN",
          "types": [
            "country"
          ]
        }
      ],
      "formatted_address": "75 Trương Công Định, Phường Phú Lợi, Thành phố Cần Thơ, Việt Nam",
      "old_address_components": [
        {
          "long_name": "75",
          "short_name": "75",
          "types": [
            "street_number"
          ]
        },
        {
          "long_name": "Trương Công Định",
          "short_name": "Trương Công Định",
          "types": [
            "route"
          ]
        },
        {
          "long_name": "Phường 2",
          "short_name": "Phường 2",
          "types": [
            "administrative_area_level_3"
          ]
        },
        {
          "long_name": "Thành phố Sóc Trăng",
          "short_name": "Thành phố Sóc Trăng",
          "types": [
            "administrative_area_level_2"
          ]
        },
        {
          "long_name": "Tỉnh Sóc Trăng",
          "short_name": "Tỉnh Sóc Trăng",
          "types": [
            "administrative_area_level_1"
          ]
        },
        {
          "long_name": "Việt Nam",
          "short_name": "VN",
          "types": [
            "country"
          ]
        }
      ],
      "old_formatted_address": "75 Trương Công Định, Phường 2, Thành phố Sóc Trăng, Tỉnh Sóc Trăng, Việt Nam",
      "geometry": {
        "location": {
          "lat": 9.6029245,
          "lng": 105.9675911
        },
        "viewport": {
          "northeast": {
            "lat": 9.6038245,
            "lng": 105.9687911
          },
          "southwest": {
            "lat": 9.6020245,
            "lng": 105.96639110000001
          }
        }
      },
      "types": [
        "street_address"
      ]
    }
  ],
  "html_attributions": []
}