Client area

PUT · Security

Password-protect a directory

Password-protect a directory

PUT /api/v1/hosting/protected-directories
W Write

Description

Adds an HTTP basic-auth prompt on path (e.g. /public_html/private, relative to the domain directory and must already exist) of the resolved domain, with the given username / password and an optional realm prompt. This is web (browser) auth on a folder, not an FTP account — for FTP use manage_ftp_accounts.

Body

Send as application/json.

Name Type Description
input required string A domain, email address, website URL, or Inleed service id — for example example.se, [email protected] or 42976. Resolved to the owning account automatically, and the resolved target is echoed back in the response.
path required string The directory to protect, as an absolute web path like /private or /admin. No ...
username required string The basic-auth username visitors must enter (lowercase letters, digits, ._-, 1–32 chars).
password required string The basic-auth password (min 8 chars). Shown to the customer on the chat action card behind a Reveal button — do not repeat it in prose; never returned in the API response.
realm string Optional prompt text the browser shows, e.g. Staging.

Responses

A 200 response returns the shape shown in the rail. Every non-2xx response is an RFC 7807 problem with a stable code.

Commonly returned errors

The codes this operation reaches on its own path: the auth stack, its own validation and ownership checks, and the transport. Not a closed set — a shared code from the full registry can still surface. Each links to the code’s own page, the same URL its type dereferences to.

401 No token was presented, or the token is revoked, expired or unknown.
403 The token lacks a required scope, or this account does not own the resource.
404 No such resource for this account.
422 Validation error
429 The rate limit for this token is exhausted. See `Retry-After`.
500 Something went wrong on our side. The failure is logged against `requestId`.
Esc
navigate open Esc close