> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.etera.dev/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.etera.dev/_mcp/server.

# Create a new city

POST https://api.etera.dev/context/cities/
Content-Type: application/json


          Create a new city with its supported verticals. The city ID must be unique,
          and the city code must also be unique. This endpoint validates all required
          fields and formats before creating the city.
          
          **Validation Rules:**
          - id: lowercase letters, numbers, and hyphens only
          - cityCode: uppercase letters and underscores only
          - iataCode: exactly 3 uppercase letters
          - scope: must include at least one valid vertical
        

Reference: https://docs.etera.dev/platform/context/context-api/cities/post-cities

## Servers

- `https://api.etera.dev/context` (Production, default)
- `https://api-stage.etera.dev/context` (Staging)
- `https://api-dev.etera.dev/context` (Development)

## Request

### Body (application/json)

This endpoint expects an object.

- `id` (string, required) — Unique city identifier (lowercase with hyphens)
- `name` (string, required) — City name
- `scope` (list of CitiesPostRequestBodyContentApplicationJsonSchemaScopeItems, required) — Supported verticals for this city
- `cityCode` (string, required) — City code (uppercase with underscores)
- `iataCode` (string, required) — Airport IATA code (3 uppercase letters)
- `country` (string, required) — Country name
- `media` (string, optional, nullable)
- `isActive` (boolean, optional, default: true) — Whether the city is active

## Response

### 200

- `cities_postCities_Response_200`
  - CitiesPostCitiesResponse2000
  - CitiesPostCitiesResponse2001

## Types

### CitiesPostRequestBodyContentApplicationJsonSchemaScopeItems

- "RESTAURANT"
- "EXPERIENCE"
- "HOTEL"

### CitiesPostCitiesResponse2000

- `success` (boolean, required)
- `message` (string, required)
- `data` (CitiesPostResponsesContentApplicationJsonSchemaOneOf0Data, optional)

### CitiesPostCitiesResponse2001

- `error` (string, required)
- `message` (string, required)

### CitiesPostResponsesContentApplicationJsonSchemaOneOf0Data

- `city` (CitiesPostResponsesContentApplicationJsonSchemaOneOf0DataCity, required)

### CitiesPostResponsesContentApplicationJsonSchemaOneOf0DataCity

- `id` (string, required)
- `name` (string, required)
- `scope` (list of CitiesPostResponsesContentApplicationJsonSchemaOneOf0DataCityScopeItems, required)
- `cityCode` (string, required)
- `iataCode` (string, required)
- `country` (string, required)
- `media` (string, required, nullable)

### CitiesPostResponsesContentApplicationJsonSchemaOneOf0DataCityScopeItems

- "RESTAURANT"
- "EXPERIENCE"
- "HOTEL"

## Examples

**Request**

```json
{
  "id": "singapore",
  "name": "Singapore",
  "scope": [
    "RESTAURANT",
    "EXPERIENCE"
  ],
  "cityCode": "SINGAPORE",
  "iataCode": "SIN",
  "country": "Singapore"
}
```

**Response**

```json
{
  "success": true,
  "message": "string",
  "data": {
    "city": {
      "id": "string",
      "name": "string",
      "scope": [
        "RESTAURANT"
      ],
      "cityCode": "string",
      "iataCode": "string",
      "country": "string",
      "media": "string"
    }
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.etera.dev/context/cities/"

payload = {
    "id": "singapore",
    "name": "Singapore",
    "scope": ["RESTAURANT", "EXPERIENCE"],
    "cityCode": "SINGAPORE",
    "iataCode": "SIN",
    "country": "Singapore"
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.etera.dev/context/cities/';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"id":"singapore","name":"Singapore","scope":["RESTAURANT","EXPERIENCE"],"cityCode":"SINGAPORE","iataCode":"SIN","country":"Singapore"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.etera.dev/context/cities/"

	payload := strings.NewReader("{\n  \"id\": \"singapore\",\n  \"name\": \"Singapore\",\n  \"scope\": [\n    \"RESTAURANT\",\n    \"EXPERIENCE\"\n  ],\n  \"cityCode\": \"SINGAPORE\",\n  \"iataCode\": \"SIN\",\n  \"country\": \"Singapore\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.etera.dev/context/cities/")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"id\": \"singapore\",\n  \"name\": \"Singapore\",\n  \"scope\": [\n    \"RESTAURANT\",\n    \"EXPERIENCE\"\n  ],\n  \"cityCode\": \"SINGAPORE\",\n  \"iataCode\": \"SIN\",\n  \"country\": \"Singapore\"\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.etera.dev/context/cities/")
  .header("Content-Type", "application/json")
  .body("{\n  \"id\": \"singapore\",\n  \"name\": \"Singapore\",\n  \"scope\": [\n    \"RESTAURANT\",\n    \"EXPERIENCE\"\n  ],\n  \"cityCode\": \"SINGAPORE\",\n  \"iataCode\": \"SIN\",\n  \"country\": \"Singapore\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.etera.dev/context/cities/', [
  'body' => '{
  "id": "singapore",
  "name": "Singapore",
  "scope": [
    "RESTAURANT",
    "EXPERIENCE"
  ],
  "cityCode": "SINGAPORE",
  "iataCode": "SIN",
  "country": "Singapore"
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.etera.dev/context/cities/");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"id\": \"singapore\",\n  \"name\": \"Singapore\",\n  \"scope\": [\n    \"RESTAURANT\",\n    \"EXPERIENCE\"\n  ],\n  \"cityCode\": \"SINGAPORE\",\n  \"iataCode\": \"SIN\",\n  \"country\": \"Singapore\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [
  "id": "singapore",
  "name": "Singapore",
  "scope": ["RESTAURANT", "EXPERIENCE"],
  "cityCode": "SINGAPORE",
  "iataCode": "SIN",
  "country": "Singapore"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.etera.dev/context/cities/")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```