For the complete documentation index, see llms.txt. This page is also available as Markdown.

Replace Node.js environment variables

Replaces the website's Node.js environment variables with the ones provided.

Replace Node.js environment variables

put

Replaces the website's Node.js environment variables with the ones provided. This is a full replace: any variable not in the request is deleted, and sending an empty env_vars array deletes every variable. Saving writes the values and restarts the running Node.js process.

A restart is enough for apps that read environment variables at process start, such as Express or NestJS. It is not enough for frameworks that bake variables into the build. Next.js standalone is one of those: build-time values (including NEXT_PUBLIC_*) need a fresh build. After this call, use the Start Node.js build endpoint so those apps pick up the new values.

The List Node.js environment variables endpoint returns masked values (********), so never copy values from it into this request. Always send the full desired set with real values taken from the project .env file or the user prompt.

Authorizations
AuthorizationstringRequired

API Token authentication

Path parameters
usernamestringRequiredExample: u123456789
domainstringRequired

Domain name

Example: mydomain.tld
Body
Responses
200

Success empty response

application/json
messagestringOptionalExample: Request accepted
put/api/hosting/v1/accounts/{username}/websites/{domain}/nodejs/builds/settings/env
PUT /api/hosting/v1/accounts/{username}/websites/{domain}/nodejs/builds/settings/env HTTP/1.1
Host: developers.hostinger.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 66

{
  "env_vars": [
    {
      "key": "API_URL",
      "value": "https://api.example.com"
    }
  ]
}
{
  "message": "Request accepted"
}

Last updated

Was this helpful?