> For the complete documentation index, see [llms.txt](https://apidocs.akinon.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://apidocs.akinon.com/commerce-openapis/admin/districts/list-districts.md).

# List districts

Returns a paginated list of districts ordered by name ascending.

Unlike the storefront endpoint, this admin endpoint returns **all** districts regardless of their `is_active` status.

Filter by `name`, `city`, `township`, or `has_retail_store`. Order results with `sort`.

```json
{"openapi":"3.1.0","info":{"title":"Admin API","version":"1.0.0"},"tags":[{"name":"Districts","description":"Administrative endpoints for **districts** — the smallest administrative subdivision in the address hierarchy, filed under a township within a city. Districts refine an address below the township level (neighbourhood/quarter) and can carry their own post code.\n\nA district consists of a display name, the city and township it belongs to, an active/inactive status, an optional post code, and optional multilingual translations of the name. The country is not stored on the district directly; it is reached through the township's city.\n\n## Core Capabilities\n\n**1. District Listing & Filtering**\n* Retrieve a paginated list of all districts (active and inactive), ordered by name ascending.\n* Filter by `name`, `city`, or `township`, restrict to districts that have a retail store with `has_retail_store=true`, or pass a bare `township` identifier.\n* Order results with the `sort` parameter.\n\n**2. District Lifecycle Management**\n* Create a district under a city and township.\n* Fully or partially update an existing district.\n* Deactivate a district (soft delete — sets `is_active` to `false`; the record is not removed).\n\n**3. Multilingual Names**\n* Store translated names under the `translations` field, keyed by language code.\n\n## District Fields\n\n| Field | Type | Description |\n|-------|------|-------------|\n| `pk` | integer | The unique identifier of the district. Assigned by the server; read-only. |\n| `is_active` | boolean | Whether the district is active. Defaults to `true`. Inactive districts are excluded from storefront address lookups. |\n| `name` | string (max 128 chars) | The official name of the district. Required on create and full update. |\n| `city` | integer | The identifier of the city this district belongs to. Required on create and full update. |\n| `township` | integer | The identifier of the township this district belongs to. Required on create and full update. |\n| `postcode` | string (max 255 chars) or `null` | The post/zip code of the district. Optional. |\n| `translations` | object or `null` | A mapping of language codes to translated field values. Example: `{\"tr\": {\"name\": \"Kadıköy\"}}`. Optional; defaults to `{}`. |\n\nThe combination (`city`, `township`, `name`) must be **unique**. A duplicate is rejected with `406 Not Acceptable` carrying `error_code` `address_100_6`.\n\n## Filtering & Ordering\n\n| Parameter | Match | Notes |\n|-----------|-------|-------|\n| `name` | Exact | Filter by district name. |\n| `city` | Exact | Keep only districts in the given city identifier. |\n| `township` | Exact | Keep only districts in the given township identifier. Also accepted as a bare numeric `?township=` value. |\n| `has_retail_store` | Boolean (`true`) | When `true`, keep only districts that have at least one retail store. |\n\nResults are ordered by `name` ascending by default. Use the `sort` query parameter to change the order; prefix with `-` for descending.\n\n## Soft Delete\n\nCalling `DELETE /districts/{id}/` does **not** remove the record from the database. It sets `is_active` to `false`, which hides the district from storefront address forms. The record can be reactivated at any time with `PATCH /districts/{id}/` sending `{\"is_active\": true}`.\n\n## Dynamic Settings & Environment Variables\n\nNo dynamic settings (`dj_dynamic_settings`) affect the district endpoints. In particular, `DEFAULT_COUNTRY_CODE` and `ADDRESS_DISTRICT_REQUIRED` — both registered in `omnishop/address/settings/conf.py` — do not change the behaviour of these endpoints: `ADDRESS_DISTRICT_REQUIRED` only controls whether a district is mandatory in the address forms, and `DEFAULT_COUNTRY_CODE` is consumed by the address and checkout services. **Environment variables:** none are read by these endpoints."}],"servers":[{"description":"Omnitron Remote Proxy (external access — recommended)","url":"https://{omnitron_url}/api/v1/remote/{channel_id}","variables":{"omnitron_url":{"default":"sandbox.akinon.com","description":"Omnitron server URL (e.g., {omnitron.akinon.com})"},"channel_id":{"default":"1","description":"The channel identifier the remote request is routed through"}}},{"description":"Commerce API Server (internal / direct access only)","url":"https://{commerce_url}/api/v1","variables":{"commerce_url":{"default":"sandbox.akinon.com","description":"Internal commerce server URL, reachable only from within the Omnitron network"}}}],"security":[{"tokenAuth":[]}],"components":{"securitySchemes":{"tokenAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Token credential sent in the Authorization header, in the form: `Token <your-token>`. Requires a staff (admin) account."}},"parameters":{"page":{"name":"page","in":"query","required":false,"description":"The page number to return.","schema":{"type":"integer","default":1}},"limit":{"name":"limit","in":"query","required":false,"description":"The number of items to return per page.","schema":{"type":"integer","default":10}},"sort":{"name":"sort","in":"query","required":false,"description":"Orders the results by one or more fields. Separate multiple fields with commas. Prefix a field with a hyphen (`-`) for descending order.","schema":{"type":"string"}}},"schemas":{"PaginatedDistrictList":{"type":"object","description":"A paginated list of districts.","properties":{"count":{"type":"integer","description":"Total number of districts matching the request."},"next":{"type":["string","null"],"format":"uri","description":"URL of the next page, or `null` if this is the last page."},"previous":{"type":["string","null"],"format":"uri","description":"URL of the previous page, or `null` if this is the first page."},"results":{"type":"array","description":"The districts on the current page.","items":{"$ref":"#/components/schemas/District"}}}},"District":{"type":"object","description":"A district record.","properties":{"pk":{"type":"integer","readOnly":true,"description":"The unique identifier of the district."},"is_active":{"type":"boolean","description":"Whether the district is active. Inactive districts are excluded from storefront address lookups."},"name":{"type":"string","maxLength":128,"description":"The official name of the district."},"city":{"type":"integer","description":"The identifier of the city this district belongs to."},"township":{"type":"integer","description":"The identifier of the township this district belongs to."},"postcode":{"type":["string","null"],"maxLength":255,"description":"The post/zip code of the district."},"translations":{"type":["object","null"],"description":"A mapping of language codes to translated field values. Example: `{\"tr\": {\"name\": \"Kadıköy\"}}`.","additionalProperties":{"type":"object","additionalProperties":{"type":"string"}},"default":{}}}},"ValidationError":{"type":"object","description":"Returned when the request contains invalid or missing data. Errors are grouped by the field they apply to: each key is the name of a field from the request and its value is a list of one or more messages describing what is wrong with that field. Messages that do not belong to any single field are grouped under `non_field_errors`.","properties":{"non_field_errors":{"type":"array","description":"Error messages that apply to the request as a whole rather than to a specific field.","items":{"type":"string"}}},"additionalProperties":{"type":"array","description":"The list of error messages for the field named by the key.","items":{"type":"string"}}},"Error":{"type":"object","description":"An error response.","properties":{"detail":{"type":"string","description":"A human-readable description of the error."}},"additionalProperties":true}},"responses":{"ValidationError":{"description":"The request contains invalid or missing data.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationError"}}}},"Unauthorized":{"description":"Authentication credentials were not provided or are invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Forbidden":{"description":"The authenticated user does not have administrator privileges.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"DistrictPageNotFound":{"description":"The requested page of the district list does not exist — the page number is beyond the last page or is not a number.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"paths":{"/districts/":{"get":{"tags":["Districts"],"operationId":"listDistricts","summary":"List districts","description":"Returns a paginated list of districts ordered by name ascending.\n\nUnlike the storefront endpoint, this admin endpoint returns **all** districts regardless of their `is_active` status.\n\nFilter by `name`, `city`, `township`, or `has_retail_store`. Order results with `sort`.","parameters":[{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/sort"},{"name":"name","in":"query","description":"Filter by district name. Exact match.","required":false,"schema":{"type":"string"}},{"name":"city","in":"query","description":"Filter by city identifier. Keeps only districts in the given city.","required":false,"schema":{"type":"integer"}},{"name":"township","in":"query","description":"Filter by township identifier. Keeps only districts in the given township.","required":false,"schema":{"type":"integer"}},{"name":"has_retail_store","in":"query","description":"When `true`, keep only districts that have at least one retail store.","required":false,"schema":{"type":"boolean"}}],"responses":{"200":{"description":"A page of districts.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedDistrictList"}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/DistrictPageNotFound"}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://apidocs.akinon.com/commerce-openapis/admin/districts/list-districts.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
