authelia-api/README.md
cclohmar 873ea789f1 chore: move postman guide into postman folder as README.md
- docs/postman-guide.md → docs/postman/README.md (auto-loads on folder view)
- Updated main README.md links
2026-07-15 18:10:02 +00:00

4.9 KiB

Authelia API

A Go-based REST API and management layer that sits alongside an Authelia instance. Provides a "Source of Truth" in SQLite, handles bulk user onboarding via JSON, manages access control policies dynamically, and automates synchronization of the Authelia users_database.yml file.

Features

  • Sovereign Bootstrap: Automatically imports existing Authelia users on first run
  • Bulk User Management: Create multiple users via JSON API with automatic password generation
  • Policy Management: Full CRUD for access control policies with dry-run verification
  • Real-time Sync: SQLite changes automatically sync to Authelia's YAML configuration
  • SMTP Onboarding: Send welcome emails using Authelia's SMTP configuration
  • Secure API: Bearer token authentication with bcrypt hashing
  • Drop-in Deployment: Runs alongside existing Authelia installation
  • OpenAPI 3.0 Spec: Complete API specification at openapi.yml

Installation

A combined container with both Authelia and Authelia-API is available on Docker Hub as git24hcom/authelia-api:

# Create config directory with your Authelia configuration
mkdir -p config data certs
# Copy and edit the example config:
#   docker/configuration.yml.example → config/configuration.yml
#   Set secrets, domains, and other settings.

# Pull and start
docker compose up -d
Port Service
9091 Authelia web portal
8080 Authelia-API (user management API)

First-time authentication: The container creates an admin user automatically on startup by reading the session.secret from your Authelia config. Whatever value you set for session.secret in configuration.yml becomes your initial bearer token — there is nothing to fetch. For example:

curl -H "Authorization: Bearer your-session-secret-value" http://localhost:8080/api/health

Authelia configuration reference: The example file at docker/configuration.yml.example covers the essentials, but Authelia has many more options. See the official Authelia configuration docs for details on secrets, domains, authentication backends, and access control rules.

Bare Metal (Quick Installation)

Runs the install script directly on the host alongside an existing Authelia installation:

curl -fsSL https://git.lohmar.co.uk/cclohmar/authelia-api/raw/branch/main/install-authelia-api.sh | sudo bash

Manual Installation

  1. Clone the repository:

    git clone https://git.lohmar.co.uk/cclohmar/authelia-api.git
    cd authelia-api
    
  2. Run the installer:

    sudo ./install-authelia-api.sh
    

Development Installation

For building from source, see the src/README.md file.

Note for local development: When installing from a cloned repository, set the environment variable to use the local binary:

AUTHELIA_API_DEVELOPMENT_MODE=true sudo ./install-authelia-api.sh

Get your bearer token:

  • Docker: The token is whatever you set as session.secret in your configuration.yml.
  • Bare metal: Read it from your existing Authelia configuration:
    grep -A2 "session:" /opt/authelia/configuration.yml | grep "secret:" | awk '{print $2}'
    

Then test the API:

curl -H "Authorization: Bearer YOUR_TOKEN" http://localhost:8080/api/health

API Testing with Postman

Postman collection, environment, and a full usage guide are provided under docs/postman/:

A bulk user creation example is at docs/examples/bulk-request.json.

Files in This Repository

  • Dockerfile - 3-stage build: Authelia download → Go build → runtime image
  • docker-compose.yml - Quick Docker deployment with volumes
  • docker/ - Container entrypoint and configuration templates
  • src/ - Go source code (cmd/server, internal packages, migrations)
  • docs/ - Documentation, OpenAPI spec, Postman files, and usage examples
    • docs/openapi.yml - OpenAPI 3.0.3 specification for all endpoints
    • docs/postman/README.md - Postman setup and usage guide
    • docs/postman/ - Postman collection and environment files
    • docs/examples/ - Example request payloads
  • install-authelia-api.sh - Bare-metal installation script

Mirror

This project is developed on git.lohmar.co.uk and mirrored to Codeberg.

License

MIT License