NewHost Docs

API reference

Applications

Node.js / Next.js applications, their deployments and environment variables.

List applications

GET/v1/apps

Requires a secret key with the read scope.

Parameters

NameInTypeDescription
limitqueryintegerItems per page, 1-100 (default 50).
offsetqueryintegerItems to skip (default 0).

Request

curl "https://api.newhost.co.za/v1/apps" \
  -H "Authorization: Bearer sk_live_..."

Response

{
  "data": [
    {
      "id": "clx8app0001",
      "name": "Shop front",
      "slug": "shop-front",
      "framework": "NEXTJS",
      "nodeVersion": "22",
      "repoUrl": "https://github.com/acme/shop.git",
      "branch": "main",
      "installCommand": "npm ci",
      "buildCommand": "npm run build",
      "startFile": "server.js",
      "primaryDomain": "shop-front.apps.newhost.co.za",
      "status": "RUNNING",
      "autoDeploy": true,
      "createdAt": "2026-09-01T08:00:00.000Z",
      "updatedAt": "2026-09-20T10:15:00.000Z"
    }
  ],
  "has_more": false
}

Create an application

POST/v1/apps

Creates the site on a NewHost server and starts the first deployment. Counts towards your plan's app limit.

Requires a secret key with the write scope. Returns 201 on success.

Body

FieldTypeDescription
namerequiredstringDisplay name (2-60 characters).
frameworkrequiredstringNEXTJS, NODE, EXPRESS or NUXT (default NEXTJS).
repoUrlstringGit repository (https:// or git@).
branchstringBranch to deploy (default main).
nodeVersionstringNode.js major version: 24, 22 (default) or 20.
customDomainstringYour own domain; defaults to <slug>.apps.newhost.co.za.
deployNowbooleanStart the first deployment immediately (default true).
installCommandstringDefault npm ci.
buildCommandstringe.g. npm run build.
startFilestringEntry file, e.g. server.js.

Request

curl -X POST "https://api.newhost.co.za/v1/apps" \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"name":"Shop front","framework":"NEXTJS","repoUrl":"https://github.com/acme/shop.git","branch":"main"}'

Response

{
  "data": {
    "id": "clx8app0001",
    "name": "Shop front",
    "slug": "shop-front",
    "framework": "NEXTJS",
    "nodeVersion": "22",
    "repoUrl": "https://github.com/acme/shop.git",
    "branch": "main",
    "installCommand": "npm ci",
    "buildCommand": "npm run build",
    "startFile": "server.js",
    "primaryDomain": "shop-front.apps.newhost.co.za",
    "status": "RUNNING",
    "autoDeploy": true,
    "createdAt": "2026-09-01T08:00:00.000Z",
    "updatedAt": "2026-09-20T10:15:00.000Z"
  }
}

Retrieve an application

GET/v1/apps/{id}

Requires a secret key with the read scope.

Parameters

NameInTypeDescription
idrequiredpathstringThe app ID.

Request

curl "https://api.newhost.co.za/v1/apps/ID" \
  -H "Authorization: Bearer sk_live_..."

Response

{
  "data": {
    "id": "clx8app0001",
    "name": "Shop front",
    "slug": "shop-front",
    "framework": "NEXTJS",
    "nodeVersion": "22",
    "repoUrl": "https://github.com/acme/shop.git",
    "branch": "main",
    "installCommand": "npm ci",
    "buildCommand": "npm run build",
    "startFile": "server.js",
    "primaryDomain": "shop-front.apps.newhost.co.za",
    "status": "RUNNING",
    "autoDeploy": true,
    "createdAt": "2026-09-01T08:00:00.000Z",
    "updatedAt": "2026-09-20T10:15:00.000Z"
  }
}

Update an application

PATCH/v1/apps/{id}

Requires a secret key with the write scope.

Parameters

NameInTypeDescription
idrequiredpathstringThe app ID.

Body

FieldTypeDescription
branchstringBranch to deploy.
nodeVersionstringNode.js major version.
installCommandstringInstall command.
buildCommandstring | nullBuild command.
startFilestringEntry file.
autoDeploybooleanDeploy on every push to the branch.

Request

curl -X PATCH "https://api.newhost.co.za/v1/apps/ID" \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"branch":"release","autoDeploy":false}'

Response

{
  "data": {
    "id": "clx8app0001",
    "name": "Shop front",
    "slug": "shop-front",
    "framework": "NEXTJS",
    "nodeVersion": "22",
    "repoUrl": "https://github.com/acme/shop.git",
    "branch": "release",
    "installCommand": "npm ci",
    "buildCommand": "npm run build",
    "startFile": "server.js",
    "primaryDomain": "shop-front.apps.newhost.co.za",
    "status": "RUNNING",
    "autoDeploy": false,
    "createdAt": "2026-09-01T08:00:00.000Z",
    "updatedAt": "2026-09-20T10:15:00.000Z"
  }
}

Delete an application

DELETE/v1/apps/{id}

Removes the site and its files from the server. This cannot be undone.

Requires a secret key with the write scope.

Parameters

NameInTypeDescription
idrequiredpathstringThe app ID.

Request

curl -X DELETE "https://api.newhost.co.za/v1/apps/ID" \
  -H "Authorization: Bearer sk_live_..."

Response

{
  "data": {
    "id": "clx8app0001",
    "deleted": true
  }
}

Trigger a deployment

POST/v1/apps/{id}/deployments

Pulls the configured branch, installs, builds and restarts the app. Poll the deployment or subscribe to deployment.* webhooks.

Requires a secret key with the deploy scope. Returns 202 on success.

Parameters

NameInTypeDescription
idrequiredpathstringThe app ID.

Request

curl -X POST "https://api.newhost.co.za/v1/apps/ID/deployments" \
  -H "Authorization: Bearer sk_live_..."

Response

{
  "data": {
    "id": "clx8dep0001",
    "applicationId": "clx8app0001",
    "status": "QUEUED",
    "trigger": "API",
    "commitSha": "9f2c1ab",
    "startedAt": "2026-09-20T10:15:00.000Z",
    "finishedAt": null
  }
}

List deployments

GET/v1/apps/{id}/deployments

Requires a secret key with the read scope.

Parameters

NameInTypeDescription
idrequiredpathstringThe app ID.
limitqueryintegerItems per page, 1-100 (default 50).
offsetqueryintegerItems to skip (default 0).

Request

curl "https://api.newhost.co.za/v1/apps/ID/deployments" \
  -H "Authorization: Bearer sk_live_..."

Response

{
  "data": [
    {
      "id": "clx8dep0001",
      "applicationId": "clx8app0001",
      "status": "SUCCEEDED",
      "trigger": "API",
      "commitSha": "9f2c1ab",
      "startedAt": "2026-09-20T10:15:00.000Z",
      "finishedAt": "2026-09-20T10:17:42.000Z"
    }
  ],
  "has_more": false
}

Retrieve a deployment

GET/v1/deployments/{id}

Includes the build log.

Requires a secret key with the read scope.

Parameters

NameInTypeDescription
idrequiredpathstringThe deployment ID.

Request

curl "https://api.newhost.co.za/v1/deployments/ID" \
  -H "Authorization: Bearer sk_live_..."

Response

{
  "data": {
    "id": "clx8dep0001",
    "applicationId": "clx8app0001",
    "status": "SUCCEEDED",
    "trigger": "API",
    "commitSha": "9f2c1ab",
    "startedAt": "2026-09-20T10:15:00.000Z",
    "finishedAt": "2026-09-20T10:17:42.000Z",
    "log": "[10:15:02] git fetch origin main\n[10:17:40] started"
  }
}

Replace environment variables

PUT/v1/apps/{id}/env

Replaces the full set. Values are encrypted and never returned; send an empty value to keep a stored secret. Redeploy to apply.

Requires a secret key with the write scope.

Parameters

NameInTypeDescription
idrequiredpathstringThe app ID.

Body

FieldTypeDescription
varsrequiredarrayList of { key, value } pairs.

Request

curl -X PUT "https://api.newhost.co.za/v1/apps/ID/env" \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"vars":[{"key":"DATABASE_URL","value":"postgres://..."},{"key":"NEXT_PUBLIC_SITE","value":"https://shop.acme.co.za"}]}'

Response

{
  "data": {
    "keys": [
      "DATABASE_URL",
      "NEXT_PUBLIC_SITE"
    ]
  }
}

Next: Databases →