Create auth user
Create a new basic authentication user for a site to protect specific paths or entire directories.
POST/api/servers/{server}/sites/{id}/auth-users
Create an auth user
Creates a new basic authentication user that can be used to protect your site or specific paths within your site.
Required attributes
- Name
name- Type
- string
- Description
The username for authentication. Minimum: 2 characters, Maximum: 255 characters.
- Name
password- Type
- string
- Description
The password for authentication. Minimum: 2 characters, Maximum: 255 characters.
Optional attributes
- Name
path- Type
- string
- Description
The specific path to protect (e.g.,
/wp-admin). If not provided, the entire site will be protected.
Request
POST
/api/servers/{server}/sites/{id}/auth-userscurl -X POST "https://ploi.io/api/servers/{server}/sites/{id}/auth-users" \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"name": "admin",
"password": "secure-password",
"path": "/wp-admin"
}'
Response
{
"data": {
"id": 1,
"name": "admin",
"path": "/wp-admin",
"created_at": "2024-01-15 10:30:00"
}
}