Skip to main content

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

NameTypeRequiredDescription
countryintegerYes—

Request body fields

NameTypeRequired
administrator_idinteger | nullNo
country_idintegerYes
enabledbooleanNo
nameanyYes

Responses

CodeDescription
200OK (Envelope)
400Bad Request (ErrorResponse)
401Unauthorized
404Not Found
429Too Many Requests (ErrorResponse)
500Internal Server Error (ErrorResponse)
503Service Unavailable (ErrorResponse)
Open this operation in the API reference