# Create District

`POST /api/v1/districts`

Creates a new District object. Requires the `create` ability.

## Request body

```json
{
    "name": "Central Texas",
    "district_group_id": "e1a4c8b2-7d3f-4b6e-9a2c-8f5d1e3b7a90",
    "external_id": "CTX"
}
```

## Example request

```bash
curl -X POST "https://app.franchisesee.com/api/v1/districts" \
  -H "Authorization: Bearer $FRANCHISESEE_TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Central Texas",
    "district_group_id": "e1a4c8b2-7d3f-4b6e-9a2c-8f5d1e3b7a90",
    "external_id": "CTX"
}'
```

## Responses

### 201 A single District.

```json
{
    "data": {
        "id": "3f2a1b0c-9d8e-4f7a-b6c5-d4e3f2a1b0c9",
        "name": "Central Texas",
        "external_id": "CTX",
        "district_group_id": "e1a4c8b2-7d3f-4b6e-9a2c-8f5d1e3b7a90",
        "created_at": "2025-03-14T15:22:08.000000Z",
        "updated_at": "2026-10-02T09:41:55.000000Z",
        "districtGroup": {
            "id": "e1a4c8b2-7d3f-4b6e-9a2c-8f5d1e3b7a90",
            "name": "Region",
            "index": 1,
            "created_at": "2025-03-14T15:22:08.000000Z",
            "updated_at": "2026-10-02T09:41:55.000000Z"
        }
    }
}
```

### 401 Authentication failed or missing.

```json
{
    "message": "Unauthenticated."
}
```

### 403 The token lacks the required ability or the caller is not permitted.

```json
{
    "message": "This API token does not have the 'create' ability."
}
```

### 422 Validation failed.

```json
{
    "message": "The name field is required.",
    "errors": {
        "name": [
            "The name field is required."
        ]
    }
}
```
