Free libPostal REST service

This service based on the libpostal and libpostal-rest open source projects.



API example by using C# (source code provided):

Here is a small program that ChatGPT kindly generated for you: the source code and executable file.
You should allow download of these files despite the browser warnings because there is nothing "suspicious" in them 😁

					Note: you can compile this program by downloading the source code and issuing command from the command prompt:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe parseaddr.cs
This should work on any PC with Windows OS (from Windows 7 to Windows 11).



API examples by using curl program:

For Windows, you may download latest curl executable from https://curl.se/windows/

Parser

Request

curl -X POST -d "{\"query\": \"100 main st buffalo ny\"}" :8080/parser

Response

[
  {
    "label": "house_number",
    "value": "100"
  },
  {
    "label": "road",
    "value": "main st"
  },
  {
    "label": "city",
    "value": "buffalo"
  },
  {
    "label": "state",
    "value": "ny"
  }
]

Expand without language options

Request

curl -X POST -d "{\"query\": \"100 main st buffalo ny\"}" :8080/expand

Response

[
  "100 main saint buffalo new york",
  "100 main saint buffalo ny",
  "100 main street buffalo new york",
  "100 main street buffalo ny"
]

Expand with language options

					IMPORTANT NOTE: if the langs array contains an invalid language specifier, e.g. "xyz", the string 
					will not be expanded for that specified language input and instead the original query string will be returned.
				

Request

curl -X POST -d "{\"query\": \"100 main st buffalo ny\", \"langs\": [\"de\"]}" :8080/expand

Response

[
  ""100 main sankt buffalo ny""
]

Expand and Parse without language option

Request

curl -X POST -d "{\"query\": \"100 main st buffalo ny\"}" :8080/expandparser

Response

[
    {
        "data": "100 main st buffalo ny",
        "parsed": [
            {
                "label": "house_number",
                "value": "100"
            },
            {
                "label": "road",
                "value": "main st"
            },
            {
                "label": "city",
                "value": "buffalo"
            },
            {
                "label": "state",
                "value": "ny"
            }
        ],
        "type": "query"
    },
    {
        "data": "100 main saint buffalo ny",
        "parsed": [
            {
                "label": "house_number",
                "value": "100"
            },
            {
                "label": "road",
                "value": "main"
            },
            {
                "label": "city",
                "value": "saint buffalo"
            },
            {
                "label": "state",
                "value": "ny"
            }
        ],
        "type": "expansion"
    },
    {
        "data": "100 main saint buffalo new york",
        "parsed": [
            {
                "label": "house_number",
                "value": "100"
            },
            {
                "label": "road",
                "value": "main"
            },
            {
                "label": "city",
                "value": "saint buffalo"
            },
            {
                "label": "state",
                "value": "new york"
            }
        ],
        "type": "expansion"
    },
    {
        "data": "100 main street buffalo ny",
        "parsed": [
            {
                "label": "house_number",
                "value": "100"
            },
            {
                "label": "road",
                "value": "main street"
            },
            {
                "label": "city",
                "value": "buffalo"
            },
            {
                "label": "state",
                "value": "ny"
            }
        ],
        "type": "expansion"
    },
    {
        "data": "100 main street buffalo new york",
        "parsed": [
            {
                "label": "house_number",
                "value": "100"
            },
            {
                "label": "road",
                "value": "main street"
            },
            {
                "label": "city",
                "value": "buffalo"
            },
            {
                "label": "state",
                "value": "new york"
            }
        ],
        "type": "expansion"
    }
]