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

Create a city

Creates a new city under a country.

name and country are required. The combination of country and name must be unique at the application layer; a duplicate is rejected with 406 Not Acceptable carrying non_field_errors and error_code fields.

Translations are optional. When supplied, provide them as an object keyed by language code where each value maps field names to translated strings: {"tr": {"name": "İstanbul"}}.

post
/cities/
Authorizations
AuthorizationstringRequired

Token credential sent in the Authorization header, in the form: Token <your-token>. Requires a staff (admin) account.

Body

The body of a city create or full update request.

is_activebooleanOptional

Whether the city is active. Defaults to true when omitted on create.

namestring · max: 128Required

The display name of the city.

countryintegerRequired

The identifier of the country this city belongs to.

priorityinteger · nullableOptional

The sort priority of the city. Optional.

postcodestring · max: 255 · nullableOptional

The post/zip code associated with the city. Optional.

translationsobject · nullableOptional

Translated field values keyed by language code. Example: {"tr": {"name": "İstanbul"}}.

Default: {}
Responses
201

The created city.

application/json

A city record.

pkintegerRead-onlyOptional

The unique identifier of the city.

is_activebooleanOptional

Whether the city is active. Inactive cities are excluded from storefront address lookups.

namestring · max: 128Optional

The display name of the city.

countryintegerOptional

The identifier of the country this city belongs to.

priorityinteger · nullableOptional

The sort priority of the city. Lower values appear first; null sorts after all numbered priorities.

postcodestring · max: 255 · nullableOptional

The post/zip code associated with the city.

translationsobject · nullableOptional

A mapping of language codes to translated field values. Example: {"tr": {"name": "İstanbul"}}.

Default: {}
post/cities/
POST /api/v1/remote/1/cities/ HTTP/1.1
Host: sandbox.akinon.com
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 120

{
  "is_active": true,
  "name": "Istanbul",
  "country": 1,
  "priority": 1,
  "postcode": null,
  "translations": {
    "tr": {
      "name": "İstanbul"
    }
  }
}
{
  "pk": 3,
  "is_active": true,
  "name": "Istanbul",
  "country": 1,
  "priority": 1,
  "postcode": null,
  "translations": {
    "tr": {
      "name": "İstanbul"
    }
  }
}

Last updated

Was this helpful?