MapScale Docs
•••
Start here
Start here · 3 minutes

Make your first API request

Search for a place with the Autocomplete API and a restricted trial key.

What you’ll achieve

You will receive structured place predictions for Siam that you can show in a search box.

1. Create a trial key

Create a publishable trial key for your first request. Trial keys include Autocomplete, Tiles and Static Maps; server-only products such as Geocoding and Routing need an account key with those products enabled.

LIVE API PLAYGROUND

Sign in or create an account

Continue to run live requests directly from the docs.

Edit the inputs, send a real request, and inspect the live response.

Request preview
curl \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{"email":"[email protected]","companyName":"Your Company","allowedOrigin":"https://example.com"}' \
  "https://api.mapscale.io/v1/trial-key"
Live response
Default response
{
  "accountId": "acct_trial_123",
  "key": "pk_test_••••••••",
  "keyPrefix": "pk_test_ab12cd34",
  "enabledProducts": [
    "tiles",
    "autocomplete",
    "static"
  ],
  "limits": {
    "rateLimitTier": "trial",
    "note": "Evaluation limits apply."
  },
  "examples": {
    "styleUrl": "https://api.mapscale.io/styles/v1/streets?key=pk_test_••••••••",
    "autocompleteUrl": "https://api.mapscale.io/v1/autocomplete?q=Siam&session_token=demo&key=pk_test_••••••••"
  }
}

2. Send the request

Export the returned key as MAPSCALE_API_KEY, then pass it in X-MapScale-Key. q is the partial place name, lang controls labels and session_token groups one search interaction.

LIVE API PLAYGROUND

Sign in or create an account

Continue to run live requests directly from the docs.

Edit the inputs, send a real request, and inspect the live response.

Editable inputs

Request preview
curl \
  -H "X-MapScale-Key: $MAPSCALE_API_KEY" \
  "https://api.mapscale.io/v1/autocomplete?q=Siam&lang=th"
Live response
Default response
{
  "predictions": [
    {
      "place_id": "place_bangkok_123",
      "description": "Siam Paragon, Pathum Wan, Bangkok",
      "structured_formatting": {
        "main_text": "Siam Paragon",
        "secondary_text": "Pathum Wan, Bangkok"
      }
    }
  ]
}

A second example: a Thai romanisation

"Thong Lo" and "ทองหล่อ" both reach the same neighbourhood — Autocomplete matches on the romanised spelling as well as the Thai script.

LIVE API PLAYGROUND

Sign in or create an account

Continue to run live requests directly from the docs.

Edit the inputs, send a real request, and inspect the live response.

Editable inputs

Request preview
curl \
  -H "X-MapScale-Key: $MAPSCALE_API_KEY" \
  "https://api.mapscale.io/v1/autocomplete?q=thong+lo&lang=th"
Live response
Default response
{
  "predictions": [
    {
      "place_id": "place_bangkok_123",
      "description": "Siam Paragon, Pathum Wan, Bangkok",
      "structured_formatting": {
        "main_text": "Siam Paragon",
        "secondary_text": "Pathum Wan, Bangkok"
      }
    }
  ]
}

3. Read the response

Render predictions[].description in your suggestion list and keep predictions[].place_id. Resolve the selected ID with Place Detail when your key has Geocoding enabled.

Next stepExplore Search & Geocoding

On this page