For the complete documentation index, see llms.txt. This page is also available as Markdown.

Addresses

Endpoints for customer addresses — the delivery and billing addresses kept in the address book of a user account. An address consists of the recipient's name and phone number, its place in the geographic hierarchy (country → city → township → district), a free-text address line, a title such as "Home", and optional corporate billing details.

Important: These endpoints are scoped to the calling account. Every request only sees and changes the addresses that belong to the user who owns the token. They do not list or manage the addresses of other customers — an address owned by another user is reported as not found. Unlike most endpoints in this reference, administrator privileges are not required: any authenticated account can call them, and read requests without credentials succeed with an empty result.

Core Capabilities

1. Address Book Listing

  • Retrieve every active customer address of the calling account in a single response.

  • Retrieve the same data with the related country, city, township, district, retail store, and user expanded into full objects through the detailed variants.

  • Order results with the sort parameter.

2. Address Lifecycle

  • Create an address. An address whose content matches an address the account deleted earlier brings that earlier record back instead of creating a new one.

  • Retrieve or update an address. Changing the content of an address replaces it with a new record (see How Updates Work).

  • Deactivate an address (soft delete — the record is kept but no longer returned).

3. Primary Address

  • Mark an address as the primary one; every other address of the account loses its primary flag.

4. Delivery Address Selection

  • Select an address for scheduled delivery through PATCH /addresses/{id}/set_address/.

Address Fields

Field
Type
Description

pk

integer

The unique identifier of the address. Read-only.

title

string (2–128 chars)

A label for the address, for example Home. Required.

first_name

string (2–30 chars)

The recipient's first name. Required.

last_name

string (2–30 chars)

The recipient's last name. Required.

phone_number

string

The recipient's phone number. Required. Must be at least ADDRESS_PHONE_MIN_LENGTH characters long (11 by default). May require phone verification (see Phone Number Verification).

email

string

The e-mail address of the address owner. Set to the calling account's e-mail.

country

integer

The identifier of the country. Required.

city

integer

The identifier of the city. Required. Must belong to country.

township

integer

The identifier of the township. Required; null is not accepted. Must belong to city.

district

integer or null

The identifier of the district. Optional unless ADDRESS_DISTRICT_REQUIRED is enabled. Must belong to township.

line

string (10–255 chars)

The street address. Required.

postcode

string (max 64 chars) or null

The post/zip code. Optional.

notes

string or null

Delivery instructions. Optional.

company_name

string (max 255 chars) or null

The company name for corporate invoices. Optional.

tax_office

string (max 64 chars) or null

The tax office for corporate invoices. Optional.

tax_no

string (max 20 chars) or null

The tax number for corporate invoices. Optional.

e_bill_taxpayer

boolean

Whether the owner is registered for electronic invoicing. Defaults to false.

identity_number

string or null

The national identity number of the recipient. Optional. Checked according to IDENTITY_NUMBER_VALIDATOR.

address_type

string

customer, retail_store, pickup_location, or checkout_provider. Defaults to customer. Only customer addresses are returned by these endpoints: an address created with another type is saved, but it is not listed and reading it by identifier returns 404.

retail_store

integer or null

The identifier of a related retail store. Optional.

remote_id

string (max 1024 chars) or null

The identifier of the address in an external system. Optional.

user

integer or null

The identifier of the owning user. Set to the calling account.

primary

boolean

Whether this is the primary address of the account. Sending true makes the address primary and clears the flag on every other address of the account. To change the primary address, mark another address as primary.

is_corporate

boolean

true when any of company_name, tax_office, tax_no, or e_bill_taxpayer is set. Read-only.

hash_data

string

A fingerprint of the address content, used to detect duplicates. Read-only.

extra_field

object or null

The values of the country-specific extra fields configured through ADDRESS_SERIALIZER_FIELDS, keyed by field name. null when no such value is stored. Read-only: extra fields are sent as top-level request fields, not inside this object.

Validation Rules

  • city must belong to country, township to city, and district to township. A mismatch is rejected with 400 Bad Request and a message under non_field_errors; only the first mismatch is reported.

  • Minimum lengths are enforced on title (2), first_name (2), last_name (2), line (10), and phone_number (ADDRESS_PHONE_MIN_LENGTH).

  • Countries can require additional fields, change the rules of existing fields, or attach extra validators through ADDRESS_SERIALIZER_FIELDS.

Duplicate Detection

Each address carries a fingerprint (hash_data) calculated from the owner and its content fields: email, phone_number, first_name, last_name, country, city, township, district, line, title, postcode, notes, company_name, tax_office, tax_no, e_bill_taxpayer, identity_number, and the country-specific extra fields. address_type, retail_store, remote_id, and primary are not part of the fingerprint.

  • Creating an address whose fingerprint matches an active address of the account is rejected with 406 Not Acceptable and error code address_100_6.

  • Creating an address whose fingerprint matches a deactivated address brings that address back: it is reactivated and returned with its original pk.

How Updates Work

  • When an update changes the fingerprint, the current record is deactivated and the new content is saved as a different record with a new pk. If the new content matches an address the account deleted earlier, that earlier record is reactivated and returned instead. If it matches another active address of the account, that address is returned and the updated address is deactivated. Always use the pk from the response for later requests.

  • When an update leaves the fingerprint unchanged, the record keeps its pk.

  • primary is not part of the fingerprint, so an update that changes only primary marks the address as primary without creating a new record.

Soft Delete

DELETE /addresses/{id}/ does not remove the record. It deactivates the address and clears its primary flag. The address is no longer listed and reading it by identifier returns 404. Creating an address with the same content later reactivates it.

Listing, Filtering & Ordering

  • The list is not paginated: every matching address is returned in one response, inside the usual count / next / previous / results envelope. next and previous are always null; page and limit are ignored.

  • No filter parameters are supported; other query parameters are ignored.

  • Results are ordered with the primary address first, then by last modification, newest first. sort accepts the address fields stored in the database — for example pk, title, first_name, last_name, city, primary — optionally prefixed with -. Unknown field names are ignored.

  • When the calling account is a guest account, the list contains only its most recently created address.

Phone Number Verification

When phone verification for addresses is enabled (the address-phone block of VERIFICATION_TOKEN_CONF), saving an address whose phone_number differs from the phone number of the calling account requires registered (non-guest) accounts to prove that they control the entered number:

  1. Request and confirm a one-time code for the entered phone number through the verification endpoints. The code is sent by SMS to the entered number, and a verification token is returned.

  2. Send the token with the create or update request, either in the X-Verification-Token header or in a verification_token body field.

Without a valid token the request is rejected with 400 Bad Request and an error under verification_token. The token can be used only once; it is consumed after the address is saved. No verification is needed when the phone number matches the account's phone number or when the feature is disabled (default).

Rate Limiting

Address creation (POST /addresses/) is rate-limited; reads, updates, and deletions are not.

  • By default each account may create 5 addresses per 60 seconds. The limit can be changed through the create-address entry of THROTTLING_SETTINGS.

  • Requests over the limit are rejected with 429 Too Many Requests. The first request over the limit is let through once; the caller's session and IP address are then flagged, and no further request is let through while the flag is active. The IP address flag lasts for SECURITYCOP_IP_BAN_TIMEOUT (6 hours by default).

  • Optional nested windows (windows) add stricter caps per IP address across all accounts. No request over these caps is let through.

Dynamic Settings & Environment Variables

The following dynamic settings (dj_dynamic_settings) change the behaviour of these endpoints. Changes made in the management panel are picked up by every server process within about a minute.

Key
Type & Constraints
Default
Effect
Affected operations

ADDRESS_PHONE_MIN_LENGTH

integer

11

The minimum length of phone_number. Shorter values are rejected with 400 and an error under phone_number.

Create, update.

ADDRESS_DISTRICT_REQUIRED

boolean

false

When true, district is required and cannot be null. When false, district is optional and may be null.

Create, update.

IDENTITY_NUMBER_VALIDATOR

one of omnicore.address.validators.null_identity_validator (no validation) or omnicore.address.validators.tc_identity_number_validator (Turkish Republic identity number)

omnicore.address.validators.null_identity_validator

How identity_number is checked. With the Turkish validator the value must be an 11-digit number that does not start with 0 and passes the checksum; otherwise it is rejected with 400 and an error under identity_number.

Create, update.

ADDRESS_SERIALIZER_FIELDS

object keyed by country code (for example TR) plus a default key; each value is a list of entries {"field": string, "validators": [{"klass": string, "kwargs": object}], "kwargs": object}. field and validators are required in every entry (validators may be an empty list); klass and kwargs are required in every validator. A missing default key is added as an empty list.

{"default": []}

Country-specific field rules. The entries for the address's country apply; when the country has no entry, the default entries apply. For a field that already exists, kwargs changes its rules (for example {"required": true} or {"max_length": 20}) and each validator is added to it; kwargs has no effect on phone_number, identity_number, and address_type, although their validators still apply. A field name that does not exist becomes an extra field: it is accepted as a top-level string field, is required unless kwargs contains "required": false, is not returned at the top level, and is stored inside extra_field. Extra fields are part of the duplicate fingerprint, so changing one creates a new record.

Create, update.

THROTTLING_SETTINGS

object; the create-address entry is {"count": integer, "duration": seconds}, optionally with "windows": [[seconds, max_count], ...]

No create-address entry (the built-in limit of 5 per 60 seconds applies)

Changes the address creation limit (see Rate Limiting).

Create.

SECURITYCOP_IP_BAN_TIMEOUT

integer (seconds)

21600 (6 hours)

How long an IP address stays flagged after it exceeded the address creation limit (see Rate Limiting).

Create.

VERIFICATION_TOKEN_CONF

object keyed by default or a verification purpose; each block accepts only enabled (boolean), allowed_channels (list), token_ttl_seconds (integer ≥ 1), and recaptcha_required (boolean)

{"default": {"enabled": false}}

When the address-phone block has "enabled": true, saving an address with a phone number that differs from the account's phone number requires a verification token (see Phone Number Verification). The default block alone never enables it.

Create, update.

The following Django settings are configured per deployment in the server configuration. They cannot be changed from the management panel, and no environment variable sets them.

Setting
Type
Default
Effect
Affected operations

USER_MAX_ADDRESS

integer

Not set (no limit)

The limit on active addresses per account. The check runs before a new address is saved and rejects the request only when the account already has more than this number of active addresses; an account can therefore reach one more address than the configured value. For example, with USER_MAX_ADDRESS = 2 the third address is accepted and the fourth is rejected. Rejected requests return 406 Not Acceptable with error code user_100_3. All active addresses of the account are counted, whatever their address_type. 0 or not set means no limit.

Create (including the reactivation of a deleted address). Updates are not checked.

CITY_FILTER_ENABLED

boolean

Not set (false)

When true and the calling account has a city stored in its attributes, the address city must be that city; otherwise the request is rejected with 400 and an error under city. Accounts without a stored city are not restricted.

Create, update.

SCHEDULED_DELIVERY_CONF

object

Scheduled delivery inactive

Scheduled delivery is inactive unless the deployment enables it in its server configuration. While it is active, selecting an address with set_address, creating the first address of an account, updating an address, and deleting an address also remove the items that are no longer available from the basket of the calling account. The address records are not changed by this. While it is inactive (default), set_address changes nothing and these side effects do not happen.

Set address, create, update, delete.

Environment variables: No environment variables are read by these endpoints.

Settings that do not affect these endpoints: DEFAULT_COUNTRY_CODE, DEFAULT_SHIPPING_COST, IDENTITY_NUMBER_REQUIRED_AMOUNT, PICKUP_LOCATION_PROVIDER, PICKUP_LOCATION_PROVIDER_BASE_URL, REMOTE_DELIVERY_OPTION_PROVIDER, and CHECKOUT_DELIVERY_OPTION_SELECTION_PAGE are registered by the address module but are used by checkout and storefront flows. ANONYMOUS_ADDRESS_EXPIRE_SECONDS applies only to addresses created without an account and has no effect on token-authenticated calls.

Last updated

Was this helpful?