Start typing to search.

API Reference

Initial user setup

View Markdown

Creates the first superadmin user. Only works when no users exist.

POST /api/auth/setup

Creates the first superadmin user. Only works when no users exist.

Operation ID: setupAuth

Authentication

No authentication is required.

Request body

The request body is required.

application/json

  • Type: object
  • Properties:
    • username (string, required)
    • password (string, required)

Success responses

200

User created. When TOTP is required, returns TOTP enrollment data (totp_secret, totp_uri). When TOTP is disabled (auth.totp_required: false), returns { success: true } and the caller proceeds to log in with the password only.

Content type: application/json

  • Type: object
  • Properties:
    • totp_secret (string)
    • totp_uri (string)
    • success (boolean)

Error responses

400

Validation error

Content type: application/json

  • Reference: Error
    • Type: object
    • Properties:
      • error (string)
        • Example: NOT_FOUND
      • message (string)
        • Example: Resource not found

Example:

{
  "error": "VALIDATION_ERROR",
  "message": "Invalid input"
}

Examples

cURL

curl --request POST \
  --url 'https://your-envoy.example.com/api/auth/setup' \
  --header 'Content-Type: application/json' \
  --data '{
  "username": "string",
  "password": "string"
}'

JavaScript (fetch)

const response = await fetch('https://your-envoy.example.com/api/auth/setup', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "username": "string",
    "password": "string"
  }),
});
 
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = response.status === 204 ? null : await response.json();
console.log(data);