---
title: "Create a new managed site"
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.hostedez.com/llms.txt
> Use this file to discover all available pages before exploring further.

Path: Hosted EZ REST API

`POST /v1/sites`

## Authentication

- `sessionCookie`, apiKey, in cookie

## Header parameters

- `createSite.header.Idempotency-Key` (string, optional) — Optional idempotency key (1 to 255 printable ASCII characters) scoped to caller and route.
  - minLength 1; maxLength 255

## Request body

_Required._

- `createSite.app` (string, required)
  - one of `"wordpress"`, `"nextcloud"`, `"laravel"`, `"drupal"`, `"php"`, `"static"`
- `createSite.name` (string, required)
  - minLength 1; maxLength 120
- `createSite.adminEmail` (string, optional)
  - maxLength 254
- `createSite.adminUser` (string, optional)
  - maxLength 60
- `createSite.includeDatabase` (boolean, optional)
  - default `false`
- `createSite.phpVersion` (string, optional)
  - one of `"8.3"`, `"8.4"`, `"8.5"`; default `"8.5"`
- `createSite.staticConfig` (object, optional)
  - `createSite.staticConfig.cleanUrls` (boolean, optional)
  - `createSite.staticConfig.customHeaders` (array<object>, optional)
    - `createSite.staticConfig.customHeaders.headers` (map<string>, required)
    - `createSite.staticConfig.customHeaders.pathPrefix` (string, required)
      - example `"/assets/"`
  - `createSite.staticConfig.notFoundPage` (string, optional)
    - maxLength 256
  - `createSite.staticConfig.spaFallback` (boolean, optional)

## Example request

```json
{
  "adminEmail": "string",
  "adminUser": "string",
  "app": "wordpress",
  "includeDatabase": false,
  "name": "string",
  "phpVersion": "8.3",
  "staticConfig": {
    "cleanUrls": true,
    "customHeaders": [
      {
        "headers": {
          "property1": "string",
          "property2": "string"
        },
        "pathPrefix": "/assets/"
      }
    ],
    "notFoundPage": "string",
    "spaFallback": true
  }
}
```

## Code samples

### cURL

```curl
curl --request POST \
  --url https://api.hostedez.com/v1/sites \
  --header 'Content-Type: application/json' \
  --header '__Secure-better-auth.session_token: <value>' \
  --data '
{
  "adminEmail": "string",
  "adminUser": "string",
  "app": "wordpress",
  "includeDatabase": false,
  "name": "string",
  "phpVersion": "8.3",
  "staticConfig": {
    "cleanUrls": true,
    "customHeaders": [
      {
        "headers": {
          "property1": "string",
          "property2": "string"
        },
        "pathPrefix": "/assets/"
      }
    ],
    "notFoundPage": "string",
    "spaFallback": true
  }
}
'
```

### TypeScript

```typescript
const url = 'https://api.hostedez.com/v1/sites';
const options = {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    '__Secure-better-auth.session_token': '<value>'
  },
  body: JSON.stringify({
    adminEmail: 'string',
    adminUser: 'string',
    app: 'wordpress',
    includeDatabase: false,
    name: 'string',
    phpVersion: '8.3',
    staticConfig: {
      cleanUrls: true,
      customHeaders: [{headers: {property1: 'string', property2: 'string'}, pathPrefix: '/assets/'}],
      notFoundPage: 'string',
      spaFallback: true
    }
  })
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.hostedez.com/v1/sites"

payload = {
    "adminEmail": "string",
    "adminUser": "string",
    "app": "wordpress",
    "includeDatabase": False,
    "name": "string",
    "phpVersion": "8.3",
    "staticConfig": {
        "cleanUrls": True,
        "customHeaders": [
            {
                "headers": {
                    "property1": "string",
                    "property2": "string"
                },
                "pathPrefix": "/assets/"
            }
        ],
        "notFoundPage": "string",
        "spaFallback": True
    }
}
headers = {
    "Content-Type": "application/json",
    "__Secure-better-auth.session_token": "<value>"
}

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

print(response.text)
```

## Responses

### 202

Site provisioning accepted

#### Example

```json
{
  "app": "wordpress",
  "assistedMoveRequested": true,
  "createdAt": "2019-08-24T14:15:22Z",
  "currentHost": "string",
  "domain": "string",
  "failReason": "signin",
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "includesEmail": true,
  "isStaging": true,
  "kind": "new",
  "lastSyncedAt": "2019-08-24T14:15:22Z",
  "mailboxesCount": 0,
  "maintenanceEnabled": true,
  "name": "string",
  "parentSiteId": "186e495c-10c6-4f33-a5ef-3f9806a2ea6b",
  "phpVersion": "",
  "slug": "string",
  "status": "creating",
  "statusSince": 0,
  "storageBytes": 0,
  "tempAddress": "string",
  "updatedAt": "2019-08-24T14:15:22Z",
  "userId": "string"
}
```

- `createSite.response.202.app` (string | null, required)
  - one of `"wordpress"`, `"nextcloud"`, `"laravel"`, `"drupal"`, `"php"`, `"static"`, `null`
- `createSite.response.202.assistedMoveRequested` (boolean, required)
- `createSite.response.202.createdAt` (string, required)
  - format `date-time`
- `createSite.response.202.currentHost` (string | null, required)
- `createSite.response.202.domain` (string | null, required)
- `createSite.response.202.failReason` (string | null, required)
  - one of `"signin"`, `"too_large"`, `"unsupported"`, `null`
- `createSite.response.202.id` (string, required)
  - format `uuid`
- `createSite.response.202.includesEmail` (boolean, required)
- `createSite.response.202.isStaging` (boolean, required)
- `createSite.response.202.kind` (string, required)
  - one of `"new"`, `"move"`
- `createSite.response.202.lastSyncedAt` (string | null, required)
  - format `date-time`
- `createSite.response.202.mailboxesCount` (integer, required)
  - format `int32`
- `createSite.response.202.maintenanceEnabled` (boolean, required) — Whether maintenance mode is currently active on this Hosted EZ site.
- `createSite.response.202.name` (string, required)
- `createSite.response.202.parentSiteId` (string | null, required)
  - format `uuid`
- `createSite.response.202.phpVersion` (string, required)
  - one of `""`, `"8.3"`, `"8.4"`, `"8.5"`
- `createSite.response.202.slug` (string, required)
- `createSite.response.202.status` (string, required)
  - one of `"creating"`, `"moving"`, `"ready"`, `"live_temporary"`, `"switching"`, `"live"`, `"suspended"`, `"failed"`, `"deleting"`
- `createSite.response.202.statusSince` (integer, required)
  - format `int64`
- `createSite.response.202.storageBytes` (integer, required)
  - format `int64`
- `createSite.response.202.tempAddress` (string, required)
- `createSite.response.202.updatedAt` (string, required)
  - format `date-time`
- `createSite.response.202.userId` (string, required)

### 400

Invalid request

#### Example

```json
{
  "error": {
    "code": "string",
    "issues": [
      {
        "message": "string",
        "path": "string"
      }
    ],
    "message": "string"
  }
}
```

- `createSite.response.400.error` (object, required)
  - `createSite.response.400.error.code` (string, required)
  - `createSite.response.400.error.message` (string, required)
  - `createSite.response.400.error.issues` (array<object>, optional)
    - `createSite.response.400.error.issues.message` (string, required)
    - `createSite.response.400.error.issues.path` (string, required)

### 401

Unauthenticated

#### Example

```json
{
  "error": {
    "code": "string",
    "issues": [
      {
        "message": "string",
        "path": "string"
      }
    ],
    "message": "string"
  }
}
```

- `createSite.response.401.error` (object, required)
  - `createSite.response.401.error.code` (string, required)
  - `createSite.response.401.error.message` (string, required)
  - `createSite.response.401.error.issues` (array<object>, optional)
    - `createSite.response.401.error.issues.message` (string, required)
    - `createSite.response.401.error.issues.path` (string, required)

### 403

Forbidden origin

#### Example

```json
{
  "error": {
    "code": "string",
    "issues": [
      {
        "message": "string",
        "path": "string"
      }
    ],
    "message": "string"
  }
}
```

- `createSite.response.403.error` (object, required)
  - `createSite.response.403.error.code` (string, required)
  - `createSite.response.403.error.message` (string, required)
  - `createSite.response.403.error.issues` (array<object>, optional)
    - `createSite.response.403.error.issues.message` (string, required)
    - `createSite.response.403.error.issues.path` (string, required)

### 409

Idempotency key reused with a different request

#### Example

```json
{
  "error": {
    "code": "string",
    "issues": [
      {
        "message": "string",
        "path": "string"
      }
    ],
    "message": "string"
  }
}
```

- `createSite.response.409.error` (object, required)
  - `createSite.response.409.error.code` (string, required)
  - `createSite.response.409.error.message` (string, required)
  - `createSite.response.409.error.issues` (array<object>, optional)
    - `createSite.response.409.error.issues.message` (string, required)
    - `createSite.response.409.error.issues.path` (string, required)


Source: https://docs.hostedez.com/api/createSite/index.md
