> 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/retail-stores/create-a-retail-store.md).

# Create a retail store

Creates a retail store.

`name`, `township`, `address`, `phone_number`, and `erp_code` are required. An image can be uploaded with a `multipart/form-data` request or referenced by `image_path`. The combination of `name`, `township`, and `store_type` must be unique.

```json
{"openapi":"3.1.0","info":{"title":"Admin API","version":"1.0.0"},"tags":[{"name":"Retail Stores","description":"Administrative endpoints for **retail stores** — physical brick-and-mortar stores that act as fulfilment nodes in omnichannel flows. A retail store is geolocated (`latitude`/`longitude`), placed in the address hierarchy through its `township` (which resolves to a city and country) and an optional `district`, and carries operational flags such as click-and-collect, in-store return, and fast delivery.\n\nThis is the admin management API over these records — it returns the full table, including inactive stores. The storefront-facing store-locator endpoints are separate.\n\n## Core Capabilities\n\n**1. Listing, Filtering & Store Locator**\n* Retrieve the list of retail stores. The list is returned with related objects (township, city, country, district) expanded, ordered by `sort_order`, then city, township, and store name.\n* Filter by location (`country`, `city`, `township`, `district`), `name`, `click_and_collect`, or `store_type`.\n* Find the stores nearest to a point, or the stores within a radius, with the geo query parameters (see **Store Locator**).\n\n**2. Store Lifecycle Management**\n* Create a store.\n* Retrieve a single store.\n* Fully update a store with `PUT`. **Partial update (`PATCH`) is not supported** (`405 Method Not Allowed`).\n* Delete a store (see **Deleting a Retail Store**).\n\n## Retail Store Fields\n\n| Field | Type | Description |\n|-------|------|-------------|\n| `pk` | integer | The unique identifier of the store. Read-only. |\n| `name` | string (max 255) | The store name. Required. Unique together with `township` and `store_type`. |\n| `township` | integer | The identifier of the township the store is in. Required. In list responses this is expanded to an object (township → city → country). |\n| `district` | integer or `null` | The identifier of the district the store is in. Optional. Expanded in list responses. |\n| `address` | string | The street address. Required. |\n| `phone_number` | string (max 128) | The store phone number. Required. |\n| `fax_phone_number` | string (max 128) or `null` | The store fax number. Optional. |\n| `image` | string (uri) or `null` | The store image. Optional. Upload with a `multipart/form-data` request, or set `image_path` to reference an already-uploaded file. |\n| `image_path` | string or `null` | Write-only helper — the storage path of an already-uploaded image, used instead of uploading a file. |\n| `store_hours` | array or `null` | Weekly opening hours: a list of up to 7 entries, each a two-element `[open, close]` pair of `HH:MM:SS` times (either may be `null` for a closed day). |\n| `latitude` | string (decimal) or `null` | Latitude, up to 11 digits with 8 decimal places. Used by the store locator. |\n| `longitude` | string (decimal) or `null` | Longitude, up to 11 digits with 8 decimal places. Used by the store locator. |\n| `is_active` | boolean | Whether the store is active. Defaults to `true`. |\n| `click_and_collect` | boolean | Whether the store supports click-and-collect pickup. Defaults to `false`. |\n| `store_type` | integer or `null` | The identifier of the store type. Optional. Part of the uniqueness constraint with `name` and `township`. |\n| `kapida_enabled` | boolean | Whether ship-from-store / at-door fulfilment is enabled. Defaults to `false`. |\n| `fast_delivery` | boolean | Whether the store supports fast delivery. Defaults to `false`. |\n| `config` | object | Free-form JSON configuration. Defaults to an empty object. |\n| `group` | integer or `null` | The identifier of the store group this store belongs to. Optional. |\n| `sort_order` | integer or `null` | The primary ordering key for listings. Optional. |\n| `erp_code` | string (max 128) or `null` | The store's ERP code, used for store-level stock lookups. |\n| `translations` | object | Translations of the translatable fields (`name`), keyed by language code. Defaults to an empty object. |\n| `related_retail_stores` | array of integer | Read-only list of the identifiers of linked stores. |\n| `absolute_url` | string | Read-only. Present in list responses only — the storefront URL of the store. |\n| `created_date` | string (date-time) | Read-only. When the store was created. |\n| `modified_date` | string (date-time) | Read-only. When the store was last modified. |\n\n## Store Locator\n\nThe list endpoint supports nearest-store and radius queries through query parameters. Distance search activates only when `latitude`, `longitude`, `radius`, and `quantity` are all supplied.\n\n| Parameter | Type | Effect |\n|-----------|------|--------|\n| `latitude` | number | The reference point latitude. |\n| `longitude` | number | The reference point longitude. |\n| `radius` | number | The search radius. When `nearest` is not truthy, only stores within this radius are returned. |\n| `quantity` | integer | The maximum number of stores to return. |\n| `nearest` | boolean | When truthy, returns the `quantity` closest stores ordered by distance, ignoring the radius. |\n\n## Pagination\n\nThis endpoint returns **all** matching stores in a single page; the `page` and `limit` parameters are accepted for envelope consistency but do not paginate the result. The response keeps the standard `{count, next, previous, results}` shape, with `next` and `previous` always `null`.\n\n## Deleting a Retail Store\n\n> **Important:** `DELETE /retailstores/{id}/` is a **hard delete** — the record is removed from the database. A store that is still referenced by other records (for example order or shipping addresses) is protected and cannot be deleted; detach those references first.\n\n## Filtering & Ordering\n\n| Parameter | Match |\n|-----------|-------|\n| `country` | Stores whose (active) country has the given identifier. |\n| `city` | Stores whose (active) city has the given identifier. |\n| `township` | Stores in the given (active) township. |\n| `district` | Stores in the given (active) district. |\n| `name` | Exact match on the store name. |\n| `click_and_collect` | Boolean click-and-collect flag. |\n| `store_type` | The store type by identifier, with nested `store_type__name` / `store_type__label` exact matches. |\n\nResults are ordered by `sort_order`, then city name, township name, and store name. Use the `sort` parameter to override the order; prefix a field with a hyphen for descending order.\n\n## Dynamic Settings & Environment Variables\n\nNo dynamic settings (`dj_dynamic_settings`) are read by these endpoints, and no environment variables are read directly. The store-locator behaviour is driven entirely by the request query parameters described above."}],"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."}},"schemas":{"RetailStoreRequest":{"type":"object","description":"The body of a retail-store create or full update request.","required":["name","township","address","phone_number","erp_code"],"properties":{"name":{"type":"string","maxLength":255,"description":"The store name. Unique together with `township` and `store_type`."},"township":{"type":"integer","description":"The identifier of the township the store is in."},"district":{"type":["integer","null"],"description":"The identifier of the district the store is in."},"address":{"type":"string","description":"The street address."},"phone_number":{"type":"string","maxLength":128,"description":"The store phone number."},"fax_phone_number":{"type":["string","null"],"maxLength":128,"description":"The store fax number."},"image":{"type":["string","null"],"format":"uri","description":"The store image. Upload with `multipart/form-data`, or set `image_path` instead."},"image_path":{"type":["string","null"],"description":"The storage path of an already-uploaded image, used instead of uploading a file."},"store_hours":{"type":["array","null"],"description":"Weekly opening hours — up to 7 `[open, close]` pairs of `HH:MM:SS` times (either may be `null`).","maxItems":7,"items":{"type":"array","minItems":2,"maxItems":2,"items":{"type":["string","null"],"format":"time"}}},"latitude":{"type":["string","null"],"format":"decimal","description":"Latitude, up to 11 digits with 8 decimal places."},"longitude":{"type":["string","null"],"format":"decimal","description":"Longitude, up to 11 digits with 8 decimal places."},"is_active":{"type":"boolean","description":"Whether the store is active. Defaults to `true`."},"click_and_collect":{"type":"boolean","description":"Whether the store supports click-and-collect. Defaults to `false`."},"store_type":{"type":["integer","null"],"description":"The identifier of the store type."},"kapida_enabled":{"type":"boolean","description":"Whether ship-from-store / at-door fulfilment is enabled. Defaults to `false`."},"fast_delivery":{"type":"boolean","description":"Whether the store supports fast delivery. Defaults to `false`."},"config":{"type":"object","description":"Free-form JSON configuration."},"group":{"type":["integer","null"],"description":"The identifier of the store group this store belongs to."},"sort_order":{"type":["integer","null"],"description":"The primary ordering key for listings."},"erp_code":{"type":["string","null"],"maxLength":128,"description":"The store's ERP code."},"translations":{"type":["object","null"],"description":"Translations of the translatable fields (`name`), keyed by language code.","additionalProperties":{"type":"object","additionalProperties":{"type":"string"}},"default":{}}}},"RetailStore":{"type":"object","description":"A retail store — a physical store used as a fulfilment node. This flat shape is returned by retrieve, create, and update; the list endpoint returns the expanded `RetailStoreDetailed` shape.","properties":{"pk":{"type":"integer","readOnly":true,"description":"The unique identifier of the store."},"name":{"type":"string","maxLength":255,"description":"The store name. Unique together with `township` and `store_type`."},"township":{"type":"integer","description":"The identifier of the township the store is in."},"district":{"type":["integer","null"],"description":"The identifier of the district the store is in."},"address":{"type":"string","description":"The street address."},"phone_number":{"type":"string","maxLength":128,"description":"The store phone number."},"fax_phone_number":{"type":["string","null"],"maxLength":128,"description":"The store fax number."},"image":{"type":["string","null"],"format":"uri","description":"The store image URL."},"image_path":{"type":["string","null"],"description":"Write-only helper — the storage path of an already-uploaded image, used instead of uploading a file."},"store_hours":{"type":["array","null"],"description":"Weekly opening hours — up to 7 entries, each a two-element `[open, close]` pair of `HH:MM:SS` times (either may be `null`).","maxItems":7,"items":{"type":"array","minItems":2,"maxItems":2,"items":{"type":["string","null"],"format":"time"}}},"latitude":{"type":["string","null"],"format":"decimal","description":"Latitude, up to 11 digits with 8 decimal places."},"longitude":{"type":["string","null"],"format":"decimal","description":"Longitude, up to 11 digits with 8 decimal places."},"is_active":{"type":"boolean","description":"Whether the store is active. Defaults to `true`."},"click_and_collect":{"type":"boolean","description":"Whether the store supports click-and-collect. Defaults to `false`."},"store_type":{"type":["integer","null"],"description":"The identifier of the store type."},"kapida_enabled":{"type":"boolean","description":"Whether ship-from-store / at-door fulfilment is enabled. Defaults to `false`."},"fast_delivery":{"type":"boolean","description":"Whether the store supports fast delivery. Defaults to `false`."},"config":{"type":"object","description":"Free-form JSON configuration. Defaults to an empty object."},"group":{"type":["integer","null"],"description":"The identifier of the store group this store belongs to."},"sort_order":{"type":["integer","null"],"description":"The primary ordering key for listings."},"erp_code":{"type":["string","null"],"maxLength":128,"description":"The store's ERP code, used for store-level stock lookups."},"translations":{"type":["object","null"],"description":"Translations of the translatable fields (`name`), keyed by language code. Example: `{\"en\": {\"name\": \"Downtown Store\"}}`.","additionalProperties":{"type":"object","additionalProperties":{"type":"string"}},"default":{}},"related_retail_stores":{"type":"array","readOnly":true,"description":"The identifiers of linked stores.","items":{"type":"integer"}},"created_date":{"type":"string","format":"date-time","readOnly":true,"description":"When the store was created."},"modified_date":{"type":"string","format":"date-time","readOnly":true,"description":"When the store was last modified."}}},"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"}}}}}},"paths":{"/retailstores/":{"post":{"tags":["Retail Stores"],"operationId":"createRetailStore","summary":"Create a retail store","description":"Creates a retail store.\n\n`name`, `township`, `address`, `phone_number`, and `erp_code` are required. An image can be uploaded with a `multipart/form-data` request or referenced by `image_path`. The combination of `name`, `township`, and `store_type` must be unique.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RetailStoreRequest"}}}},"responses":{"201":{"description":"The created retail store.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RetailStore"}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}}}}}
```


---

# 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/retail-stores/create-a-retail-store.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.
