GET
/
v1
/
osm
/
tags
curl --get 'https://osm.buntinglabs.com/v1/osm/tags' \
     --data "query=trail+head" \
     --data "api_key=demo"
{
  "tags": [
    {
      "dist": "0.133251905441",
      "tag_details": {
        "description": "A trailhead is a designated or customary place where a trip on a trail begins or ends.",
        "tag": "highway=trailhead"
      }
    },
    {
      "dist": "0.159177839756",
      "tag_details": {
        "description": "Trail riding rest area",
        "tag": "tourism=trail_riding_rest"
      }
    }
  ]
}

This endpoint is useful for searching popular OpenStreetMap tags. We indexed OpenStreetMap wiki pages for each tag’s description field and put them in a vector database.

This makes it easy to search for particular features in English and get the tag OSM uses for that feature. For example, searching “trail head” gives highway=trailhead as the first result, which is described as:

A trailhead (highway=trailhead) is a designated or customary place where a trip on a trail begins or ends.

Multiple results are returned, ordered in increasing dist. This allows for autocomplete text boxes, where a user can type in their query and then select the exact tag they want to use.

Request Parameters

query
string
required

The search query that OSM tags and their descriptions will be compared to.

More information about tags can be found on the TagInfo resource website.

api_key
string
required

Your account’s API key. You can create an API key by registering for an account and copy and paste it from your account dashboard.

Response

A successful search query will give a 200 OK response with Content-Type: application/json. Results look like this (query was “national park”):

{
  "tags": [{
    "dist": "0.109221339226",
    "tag_details": {
      "description": "National Park",
      "tag": "protect_class=2"
    }
  }, {
    "dist": "0.116037666798",
    "tag_details": {
      "description": "The boundary of a national park, an area of natural beauty, set aside for conservation and for recreation",
      "tag": "boundary=national_park"
    }
  }]
}

In the event of an error, an error response will be issued, usually with a 5xx error code. The error will be JSON-formatted, with an error field describing the cause.

error
string

The error message if the extract request parameters were incorrectly formatted.

This response field will not be present if the extract succeeds.

Data License

This API serves OpenStreetMap data, which is freely available and is licensed under the Open Data Commons Open Database License (ODbL).