REST API Guide
Features

REST API Guide

Authenticate, explore endpoints, and automate Drevnix management with the REST API.

Using an AI assistant? Give it this file.

/llms.md is a single Markdown file covering installation, configuration, quickstart, clients, upstreams, permissions, TLS, and production deployment. Copy it and paste it into your AI chat, or tell the AI to fetch https://drevnix.tech/llms.md.

REST API Guide

The REST API runs on port :8002 and provides full programmatic control over upstreams, clients, and permissions. Use it for automation, GitOps pipelines, provisioning scripts, or custom tooling.

REST API access is controlled by your license.

Authentication

HTTP Basic Auth using portal admin credentials. The authenticating user must have the api:access permission (all super-admin accounts have this by default):

curl http://drevnix.company.com:8002/v1/clients \
  -u admin:yourpassword

Interactive documentation

Swagger UI is available at:

http://drevnix.company.com:8002/docs/

Explore and test every endpoint directly in the browser. The OpenAPI specification is at /swagger.json.

Endpoints

Upstreams

POST   /v1/upstreams        Create upstream
GET    /v1/upstreams        List upstreams (limit, offset)
GET    /v1/upstreams/:id    Get upstream by ID
PUT    /v1/upstreams/:id    Update upstream credentials
DELETE /v1/upstreams/:id    Delete upstream

Clients

POST   /v1/clients          Create client (id, password, expiration_time?)
GET    /v1/clients          List clients (limit, offset)
GET    /v1/clients/:id      Get client by ID
PUT    /v1/clients/:id      Update client (expiration_time)
DELETE /v1/clients/:id      Delete client

Permissions

POST   /v1/permissions      Create permission (client_id, repository)
GET    /v1/permissions      List permissions (client_id?, limit, offset)
GET    /v1/permissions/:id  Get permission by ID
DELETE /v1/permissions/:id  Delete permission

System

GET    /health              Health check — returns 200 OK
GET    /swagger.json        OpenAPI specification

Pagination

List endpoints support limit and offset query parameters:

curl "http://drevnix.company.com:8002/v1/clients?limit=50&offset=0" \
  -u admin:password

Automation example: provision a new developer

#!/bin/bash
CLIENT_ID="dev-$(echo $GITHUB_USERNAME | tr '[:upper:]' '[:lower:]')"
PASSWORD=$(openssl rand -base64 24)

# Create client
curl -s -X POST http://drevnix.company.com:8002/v1/clients \
  -u admin:$DREVNIX_ADMIN_PASSWORD \
  -H "Content-Type: application/json" \
  -d "{\"id\": \"$CLIENT_ID\", \"password\": \"$PASSWORD\"}"

# Grant access to company org
curl -s -X POST http://drevnix.company.com:8002/v1/permissions \
  -u admin:$DREVNIX_ADMIN_PASSWORD \
  -H "Content-Type: application/json" \
  -d "{\"client_id\": \"$CLIENT_ID\", \"repository\": \"ghcr/myorg/*\"}"

echo "Client ID:  $CLIENT_ID"
echo "Password:   $PASSWORD"

Health check

curl http://drevnix.company.com:8002/health
# HTTP/1.1 200 OK

Wire this into your load balancer or container restart policy.