---
title: "Create a site and deploy it"
url: https://docs.corefinity.com/api/recipes/create-a-site-and-deploy-it
type: page
last_updated: 2026-11-13
feature: recipe-create-a-site-and-deploy-it
---
# Create a site and deploy it

Create a WordPress site, follow it until it is ready, connect its repository and deploy.

Creating a site opens a contract for it. This recipe creates the WordPress site `journal.harbourandfinch.example.com`, switches it to git deployments and deploys its repository.

## Before you start

- A token with the `read` and `write` [scopes](/api/scopes) and the Deploy tick, which starting the deployment needs, and `exec` to read the new site's login in step 4.
- A role with the Manage Deployment Source, Manage Deployment Repositories and Create Deployments permissions, for steps 5 to 7.
- Steps 2 to 8 need [two-factor enrolment](/api/two-factor) when your company requires it.
- No step waits for a maintenance window.

> **Warning:** Every successful create is billable. There is no test mode.

1. **Choose a version**

   List the application versions offered where the site will run. This step is optional.

   ```bash
   curl "https://manage.corefinity.com/api/app-versions?platform=wordpress&placement=region:uk" \
     -H "Authorization: Bearer $COREFINITY_TOKEN" -H "Accept: application/json"
   ```

2. **Create the site**

   Send where the site runs, its package, the site itself and the environments to create with it. `content: fresh` installs the application; `content: empty` leaves the site empty for your own code.

   ```bash
   curl -X POST https://manage.corefinity.com/api/corestack/sites \
     -H "Authorization: Bearer $COREFINITY_TOKEN" -H "Accept: application/json" \
     -H "Content-Type: application/json" \
     -d '{
       "placement": {"kind": "platform", "region": "uk"},
       "package": "cs4",
       "site": {"platform": "wordpress", "domain": "journal.harbourandfinch.example.com", "content": "fresh", "php_version": "8.3"},
       "environments": []
     }'
   ```

   | Status | Meaning                                   |
   | ------ | ----------------------------------------- |
   | `201`  | The create has started                    |
   | `202`  | The create is accepted and waits for room |

   Either way the answer carries the new site and the operation to follow. Note `site.id` and `operation.id`.

3. **Follow the operation**

   Read the operation every few seconds until its `status` is `completed` or `failed`; see [Long-running work](/api/long-running-work).

   ```bash
   curl https://manage.corefinity.com/api/corestack/operations/5120 \
     -H "Authorization: Bearer $COREFINITY_TOKEN" -H "Accept: application/json"
   ```

4. **Read the first login**

   A fresh install creates an administrator, shown once; skip this step for an `empty` site. This request needs the `exec` scope and no body, and answers `200`.

   ```bash
   curl -X POST https://manage.corefinity.com/api/corestack/sites/1051/provisioning/reveal \
     -H "Authorization: Bearer $COREFINITY_TOKEN" -H "Accept: application/json"
   ```

   ```json
   {
     "credentials": {
       "admin": {"url": "https://journal.harbourandfinch.example.com/wp-admin/", "username": "journal_admin", "password": "Example-admin-2026"},
       "revealed_at": "2026-11-03T09:20:00+00:00",
       "note": "Shown once. Store it in your password manager."
     },
     "revealed_at": "2026-11-03T09:20:00+00:00",
     "remaining": 0
   }
   ```

5. **Switch the site to git deployments**

   A new site deploys by upload. Switching to git answers `201` with the `operation` that moves the site's files into the releases layout; follow it as in step 3.

   The switch replaces the upload layout with the releases layout; switching back to `manual` moves the files back.

   ```bash
   curl -X PUT https://manage.corefinity.com/api/corestack/sites/1051/deployments/mode \
     -H "Authorization: Bearer $COREFINITY_TOKEN" -H "Accept: application/json" \
     -H "Content-Type: application/json" \
     -d '{"mode": "git"}'
   ```

6. **Connect the repository**

   Read the site's deployment settings to find, in `connections`, the `id` of a repository connection you may use. Then set the repository and branch, which answers `200` with the settings as they are now.

   ```bash
   curl https://manage.corefinity.com/api/corestack/sites/1051/deployments \
     -H "Authorization: Bearer $COREFINITY_TOKEN" -H "Accept: application/json"

   curl -X PUT https://manage.corefinity.com/api/corestack/sites/1051/deployments/repository \
     -H "Authorization: Bearer $COREFINITY_TOKEN" -H "Accept: application/json" \
     -H "Content-Type: application/json" \
     -d '{"connection_id": 4217, "repo": "northwind-digital/harbourandfinch", "branch": "main", "root_directory": null, "auto_deploy": false}'
   ```

7. **Deploy**

   Deploy the connected branch. A deployment replaces the release the site serves with one built from that branch.

   The answer is `201` with the new deployment, `status` `queued`.

   ```bash
   curl -X POST https://manage.corefinity.com/api/corestack/sites/1051/deployments \
     -H "Authorization: Bearer $COREFINITY_TOKEN" -H "Accept: application/json" \
     -H "Content-Type: application/json" \
     -d '{}'
   ```

8. **Follow the deployment**

   A deployment is read on the site's deployment settings, not on the operations endpoint. Read them again until the deployment at the top of `deployments` has the `status` `succeeded`, `failed`, `cancelled` or `skipped`.

   ```bash
   curl https://manage.corefinity.com/api/corestack/sites/1051/deployments \
     -H "Authorization: Bearer $COREFINITY_TOKEN" -H "Accept: application/json"
   ```

## Create in a CoreCluster

To create the site in one of your CoreClusters, send the same request to `POST /corestack/clusters/{cluster}/sites`. The site is sized by a `tier` there, not a `package`; the endpoint's reference page lists its fields.

## If it is refused

| Status | `reason`             | What to do                                                                                                                                |
| ------ | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| `422`  | `invalid`            | Correct the field named in `field` and `errors`. A rule of the create can refuse a field with a reason of its own; the `message` says why |
| `403`  | `forbidden`          | You may not create sites for this company, or your role lacks the permission named in `permission`                                        |
| `404`  | `feature_off`        | Site creation, or deployments, is not on for your company                                                                                 |
| `409`  | `no_payment_method`  | Add a card or a Direct Debit mandate to your billing account first                                                                        |
| `429`  | `rate_limited`       | A person can create 100 sites an hour. Wait for the seconds in `Retry-After`; see [Rate limits](/api/rate-limits)                         |
| `409`  | `already_revealed`   | The login was shown already or has expired, or the site has none: an `empty` site, or an install that has not finished                    |
| `409`  | `mode`               | The site still deploys by upload; do step 5 first and wait for its operation                                                              |
| `422`  | `no_repository`      | No repository is connected; do step 6 first                                                                                               |
| `409`  | `deployment_running` | Wait for the running deployment to finish                                                                                                 |
| `409`  | `busy`               | Another change to the site is in progress. Wait for it to finish                                                                          |

## Next

- [Go live with a domain](/api/recipes/go-live-with-a-domain)
- [Take a snapshot and keep it](/api/recipes/take-a-snapshot)
