Biklo for developersTESTsandbox-api.biklo.comchange

Address validation rules

GET/v1/geo/address-rules

scope catalog.read

What we enforce when an address is saved, published so you can validate before sending and show your own users a useful message instead of a rejected order.

Query parameters#

NameExample
countryROISO country code — required

Response#

FieldTypeDescription
country_codestringThe country these rules apply to.
streetobjectWhat a street line must look like.
street.min_lengthintegerShortest accepted street line.
street.max_lengthintegerLongest accepted street line.
street.must_contain_digitbooleanWhether a house or building number is required. true rejects "Main Street" with no number — a parcel cannot be delivered to a street.
postal_codeobjectWhat a postal code must look like.
postal_code.patternstringA regular expression the code must match. Apply it in your own system BEFORE sending, so a bad address fails while a human is still looking at it rather than when the courier is booked.
postal_code.examplestringA well-formed code, for your placeholder text.
postal_code.validated_by_county_prefixbooleanWhether the code must also start with the prefix belonging to its county — see postal_prefixes on GET /v1/geo/counties. This is what catches a correct-looking code from the wrong part of the country.
required_fieldsstring[]Which address fields must be present for this country. Countries differ: not every one has counties, and asking for one where it does not apply produces addresses a courier will reject.

Example

{
    "country_code": "RO",
    "street": {
        "min_length": 5,
        "max_length": 50,
        "must_contain_digit": true
    },
    "postal_code": {
        "pattern": "/^\\\\d{6}$/",
        "example": "500123",
        "validated_by_county_prefix": true
    },
    "required_fields": [
        "country_code",
        "county_id",
        "city_id",
        "address",
        "postal_code"
    ]
}

Failures use the shared error envelope — a machine-readable code and a request_id to quote to support. Error handling.

curl -X GET "https://sandbox-api.biklo.com/v1/geo/address-rules?country=RO" \
  -H "Authorization: Bearer bk_test_YOUR_KEY"
<?php

$ch = curl_init('https://sandbox-api.biklo.com/v1/geo/address-rules?country=RO');

curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST  => 'GET',
    CURLOPT_HTTPHEADER     => [
        'Authorization: Bearer bk_test_YOUR_KEY',
    ],
]);

$response = json_decode(curl_exec($ch), true);
curl_close($ch);
using System.Net.Http;
using System.Net.Http.Headers;

var client = new HttpClient();
client.DefaultRequestHeaders.Authorization =
    new AuthenticationHeaderValue("Bearer", "bk_test_YOUR_KEY");

var request = new HttpRequestMessage(
    new HttpMethod("GET"),
    "https://sandbox-api.biklo.com/v1/geo/address-rules?country=RO");

var response = await client.SendAsync(request);
var json = await response.Content.ReadAsStringAsync();
import requests

response = requests.get(
    "https://sandbox-api.biklo.com/v1/geo/address-rules?country=RO",
    headers={"Authorization": "Bearer bk_test_YOUR_KEY"},
)

data = response.json()
const response = await fetch("https://sandbox-api.biklo.com/v1/geo/address-rules?country=RO", {
  method: "GET",
  headers: {
    Authorization: "Bearer bk_test_YOUR_KEY"
  }
});

const data = await response.json();
import java.net.http.*;
import java.net.URI;

var client = HttpClient.newHttpClient();

var request = HttpRequest.newBuilder()
    .uri(URI.create("https://sandbox-api.biklo.com/v1/geo/address-rules?country=RO"))
    .header("Authorization", "Bearer bk_test_YOUR_KEY")
    .method("GET", HttpRequest.BodyPublishers.noBody())
    .build();

var response = client.send(request, HttpResponse.BodyHandlers.ofString());