Create City
API operation: Open the endpoint in the API reference
Use POST /countries/{country}/cities to create a city under one country. The current public operation is City.register.
If available, the operation is restricted to role levels 0 and 1. It copies the route's country value into country_id before validating the request. The API Reference lists both name and country_id as required request fields, while the route also supplies the country value.
Optional fields described here include administrator_id and enabled. See the operation guide for the full request, response, and error schemas.
Legacy SDK example
const response = await ordering.countries(countryId).cities().save(data)
The SDK helper shown is cities(); confirm the SDK package and version before using it.
OpenAPI reference
Operation: POST /countries/{country}/cities
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
country | integer | Yes | — |
Request body fields
| Name | Type | Required |
|---|---|---|
administrator_id | integer | null | No |
country_id | integer | Yes |
enabled | boolean | No |
name | any | Yes |
Responses
| Code | Description |
|---|---|
| 200 | OK (Envelope) |
| 400 | Bad Request (ErrorResponse) |
| 401 | Unauthorized |
| 404 | Not Found |
| 429 | Too Many Requests (ErrorResponse) |
| 500 | Internal Server Error (ErrorResponse) |
| 503 | Service Unavailable (ErrorResponse) |