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

# CreateTerritory

POST https://api.getedulead.com/v4/territories
Content-Type: application/json

CreateTerritory adds a territory with the next color; a team holds at most 50. The same
 request_id returns the territory it made.

Reference: https://docs.getedulead.com/api-reference/territories/create

## Authentication

- `Authorization` header (bearer token, required) — A team API key, sent as `Authorization: Bearer <key>`.
- `Authorization` header (bearer token, required) — The Cognito access token of a signed-in Edulead user (`edulead auth login`), sent as `Authorization: Bearer <token>`.

## Request

### Query parameters

- `request_id` (string, optional) — Caller-chosen idempotency key. The same key from the same caller within 24 hours returns the original result instead of acting again.

### Body (application/json)

This endpoint expects an edulead.v4.Territory.

- `id` (string, optional) — Identifier of the resource, assigned by Edulead and opaque to callers.
- `name` (string, optional) — The territory's name, trimmed; required on create and when updated. Names need not be unique.
- `states` (list of enum, optional) — Two-letter codes of the states it covers (the 50 states and DC), upper case, distinct, in the order given; may be empty.
  - Allowed values: `AL`, `AK`, `AZ`, `AR`, `CA`, `CO`, `CT`, `DE`, `FL`, `GA`, `HI`, `ID`, `IL`, `IN`, `IA`, `KS`, `KY`, `LA`, `ME`, `MD`, `MA`, `MI`, `MN`, `MS`, `MO`, `MT`, `NE`, `NV`, `NH`, `NJ`, `NM`, `NY`, `NC`, `ND`, `OH`, `OK`, `OR`, `PA`, `RI`, `SC`, `SD`, `TN`, `TX`, `UT`, `VT`, `VA`, `WA`, `WV`, `WI`, `WY`, `DC`
- `color` (integer, optional) — The display color, 1 to 8, chosen on create as the one the team's territories use least.
- `creator_id` (string, optional) — The user or API key that created it; "system" for the default regions Edulead added.
- `create_time` (datetime, optional) — When Edulead created the resource.
- `update_time` (datetime, optional) — When any field last changed.

## Response

### 200

Success

- `territory` (edulead.v4.Territory, optional) — Territory is a named set of US states.

## Types

### edulead.v4.Territory

Territory is a named set of US states.

- `id` (string, optional) — Identifier of the resource, assigned by Edulead and opaque to callers.
- `name` (string, optional) — The territory's name, trimmed; required on create and when updated. Names need not be unique.
- `states` (list of enum, optional) — Two-letter codes of the states it covers (the 50 states and DC), upper case, distinct, in the order given; may be empty.
  - Allowed values: `AL`, `AK`, `AZ`, `AR`, `CA`, `CO`, `CT`, `DE`, `FL`, `GA`, `HI`, `ID`, `IL`, `IN`, `IA`, `KS`, `KY`, `LA`, `ME`, `MD`, `MA`, `MI`, `MN`, `MS`, `MO`, `MT`, `NE`, `NV`, `NH`, `NJ`, `NM`, `NY`, `NC`, `ND`, `OH`, `OK`, `OR`, `PA`, `RI`, `SC`, `SD`, `TN`, `TX`, `UT`, `VT`, `VA`, `WA`, `WV`, `WI`, `WY`, `DC`
- `color` (integer, optional) — The display color, 1 to 8, chosen on create as the one the team's territories use least.
- `creator_id` (string, optional) — The user or API key that created it; "system" for the default regions Edulead added.
- `create_time` (datetime, optional) — When Edulead created the resource.
- `update_time` (datetime, optional) — When any field last changed.

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "territory": {
    "id": "string",
    "name": "string",
    "states": [
      "AL"
    ],
    "color": 1,
    "creator_id": "string",
    "create_time": "2023-01-15T01:30:15.01Z",
    "update_time": "2023-01-15T01:30:15.01Z"
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.getedulead.com/v4/territories"

payload = {}
headers = {
    "Authorization": "Bearer <apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://api.getedulead.com/v4/territories';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <apiKey>', 'Content-Type': 'application/json'},
  body: '{}'
};

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.getedulead.com/v4/territories"

	payload := strings.NewReader("{}")

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

	req.Header.Add("Authorization", "Bearer <apiKey>")
	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.getedulead.com/v4/territories")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{}"

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.getedulead.com/v4/territories")
  .header("Authorization", "Bearer <apiKey>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.getedulead.com/v4/territories', [
  'body' => '{}',
  'headers' => [
    'Authorization' => 'Bearer <apiKey>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.getedulead.com/v4/territories");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <apiKey>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.getedulead.com/v4/territories")! 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()
```