Skip to content

Check Postalcode in Area

Check postalcode in area

With this endpoint you can check if a postalcode lies within Atlas areas

URL

POST https://api.geposit.se/1.1/check/postalcode/in/areas

Mandatory header parameters

  • x-api-key (String) This is your API-key and should be included in the header.

Mandatory POST parameters

  • postalcode (String) This is the postalcode that you want to check. The API assumes that the postalcode is correctly formatted and will only return limited error codes if it is incorrect. For help in validating that the postalcode is correct, see Valid API.

  • country_code (String) The country code of the postalcode. The following country codes are supported:

    • se (Sweden)
    • no (Norway)
    • dk (Denmark)
    • fi (Finland)

Optional POST parameters

  • Attribute filtering/conditioning (String) The following operands can be used to filter for specific values.
Operand Description Description
eq is equal to Exact match to a value
ct contains Contains the value
nc doesn't contain Does not contain the value
in is in one or more Does contain exact match to numeric value
ni is not in one or more Does not contain exact match to numeric value
ne is not equal to Does not match exact value
be value BETWEEN low AND high For time: time[be][]=10:00&time[be][]=12:00
For numeric value: value[be][]=100&value[be][]=1000
For date: date[be][]=2019-01-01&date[be][]=2019-10-10
lt is less than Numeric value is less than specified one
gt is greater than Numeric value is greater than specified one

Examples:

Check postalcode against areas where revenue greater than 150. Where revenue is a custom_field.

/check/postalcode/in/areas?country_code=se&postalcode=12947&revenue[gt]=150

Check postalcode against areas where the regdate is between 2020-01-01 and 2020-03-01. Where regdate is a custom_field.

/check/postalcode/in/areas?country_code=se&postalcode=12947&regdate[be][]=2020-01-01&regdate[be][]=2020-03-01

Example Request

curl -X POST -H "X-api-key: {API_KEY}" https://api.geposit.se/1.1/check/postalcode/in/areas -d "country_code=se&postalcode=16471"
client()->post("check/postalcode/in/areas", [
    "query" => [
        "postalcode" => "16471",
        "country_code" => "se",
    ],
    "headers" => [
        "x-api-key" => "your-api-key"
    ],
]);

Response

The response will be in JSON format. Every response comes with a status flag (Integer) where:

  • status = 0 - Incoming postalcode is invalid / generic error.
  • status = 1 - Incoming postalcode is valid and exists.

Valid response

  • areas (Array) Array with zero or more area object(s). An empty array indicates that the postalcode is not part of any area.

  • area_id (String) The unique identifier of the area. This id can be used to fetch more detailed information about the area, using the get area details endpoint.

  • name (String) The name of the area.

  • geography_status (String) Denotes if the geography (the postalcode) has been modified in any way in the context of the given area.

  • A value of 1 means that the geography is unmodified.

  • A value of 2 means that the geography has been modified and that some addresses might be excluded from the geography in this area.

    If geography_status = 2 you need to verify the full address using the API endpoint check address in area in order to determine if it is part of an area.

{
   "status": 1,
    "areas": [
        {
            "area_id": "551",
            "name": "Area Name 1",
            "geography_status": "1",
           "my_own_attribute1":"my_own_attribute_value",
           "my_own_attribute2":"my_own_attribute_value"
        },
        {
            "area_id": "552",
            "name": "Area Name 2",
            "geography_status": "1",
            "my_own_attribute1":"my_own_attribute_value",
            "my_own_attribute2":"my_own_attribute_value"
        }
    ]
}
{
    "status": 1,
    "areas": []
}

Invalid response

{
  "status": 0,
  "error": "Incorrect postalcode"
}
{
  "status": 0,
  "error": "Invalid country code parameter"
}
{
  "status": 0,
  "error": "Generic error"
}