Skip to content

REST API Reference

Complete reference for the можно REST API v1. Each endpoint includes method, path, parameters, and curl examples.

Tip: Interactive documentation is available via Swagger UI at /swagger-ui.html. OpenAPI 3.1 spec — /v3/api-docs.

Authentication

Login

http
POST /api/v1/auth/login

Request body:

json
{
  "email": "admin@example.com",
  "password": "your-password"
}

Response:

json
{
  "token": "eyJhbGciOiJIUzI1NiIs...",
  "refreshToken": "dGhpcyBpcyBhIHJlZnJlc2ggdG9rZW4...",
  "user": {
    "id": 1,
    "email": "admin@example.com",
    "name": "Admin",
    "role": "ADMIN",
    "status": "ACTIVE",
    "locale": "en",
    "createdAt": "2026-01-01T00:00:00Z",
    "lastActiveAt": "2026-06-21T10:00:00Z"
  }
}
bash
curl -X POST "http://localhost:8080/api/v1/auth/login" \
  -H "Content-Type: application/json" \
  -d '{"email": "admin@example.com", "password": "your-password"}'

Refresh Token

http
POST /api/v1/auth/refresh
bash
curl -X POST "http://localhost:8080/api/v1/auth/refresh" \
  -H "Content-Type: application/json" \
  -d '{"refreshToken": "dGhpcyBpcyBhIHJlZnJlc2ggdG9rZW4..."}'

Logout

http
POST /api/v1/auth/logout
bash
curl -X POST "http://localhost:8080/api/v1/auth/logout" \
  -H "Authorization: Bearer $JWT_TOKEN"

Current User

http
GET /api/v1/auth/me
bash
curl "http://localhost:8080/api/v1/auth/me" \
  -H "Authorization: Bearer $JWT_TOKEN"

Select Project

http
POST /api/v1/auth/select-project

Password Recovery

http
POST /api/v1/auth/forgot-password
POST /api/v1/auth/reset-password

Accept Invitation

http
POST /api/v1/auth/accept-invite

Flags

Create Flag

http
POST /api/v1/flags
FieldTypeRequiredDescription
keystringYesUnique flag key
namestringYesFlag name
descriptionstringNoDescription
flagTypestringYesRELEASE or KILLSWITCH
tagsobject[]No{tagId, value} objects
projectIdlongYesProject ID
bash
curl -X POST "http://localhost:8080/api/v1/flags" \
  -H "Authorization: Bearer $JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "key": "new-checkout",
    "name": "New Checkout",
    "description": "Checkout flow redesign",
    "flagType": "RELEASE",
    "projectId": 1,
    "tags": [{"tagId": 1, "value": "checkout"}, {"tagId": 2, "value": "ui-redesign"}]
  }'

List All Flags

http
GET /api/v1/flags
ParameterTypeDefaultDescription
includeArchivedbooleanfalseInclude archived flags
pageint0Page number
sizeint20Page size
bash
curl "http://localhost:8080/api/v1/flags?includeArchived=true" \
  -H "Authorization: Bearer $JWT_TOKEN"

Get Flag by ID

http
GET /api/v1/flags/{id}
bash
curl "http://localhost:8080/api/v1/flags/42" \
  -H "Authorization: Bearer $JWT_TOKEN"

Flags by Environment

http
GET /api/v1/flags/by-environment

Enriched Flags (Dashboard)

http
GET /api/v1/flags/enriched

Returns flags with associated segments, tags, contexts, and environments.

Update Flag

http
PUT /api/v1/flags/{id}
bash
curl -X PUT "http://localhost:8080/api/v1/flags/42" \
  -H "Authorization: Bearer $JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "New Checkout v2",
    "description": "Updated description",
    "tags": ["checkout", "ui-redesign", "v2"]
  }'

Update Flag Strategies

http
PUT /api/v1/flags/{flagId}/strategies

Configure strategy for an environment:

bash
curl -X PUT "http://localhost:8080/api/v1/flags/42/strategies" \
  -H "Authorization: Bearer $JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "environmentId": 3,
    "enabled": true,
    "percentage": 25
  }'

Archive Flag

http
POST /api/v1/flags/{id}/archive
bash
curl -X POST "http://localhost:8080/api/v1/flags/42/archive" \
  -H "Authorization: Bearer $JWT_TOKEN"

Unarchive Flag

http
POST /api/v1/flags/{id}/unarchive
bash
curl -X POST "http://localhost:8080/api/v1/flags/42/unarchive" \
  -H "Authorization: Bearer $JWT_TOKEN"

Segments

Create Segment

http
POST /api/v1/segments
bash
curl -X POST "http://localhost:8080/api/v1/segments" \
  -H "Authorization: Bearer $JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Beta Testers",
    "description": "Users with beta- prefix",
    "projectId": 1
  }'

List All Segments

http
GET /api/v1/segments
bash
curl "http://localhost:8080/api/v1/segments" \
  -H "Authorization: Bearer $JWT_TOKEN"

Get Segment by ID

http
GET /api/v1/segments/{id}

Update Segment

http
PUT /api/v1/segments/{id}

Delete Segment

http
DELETE /api/v1/segments/{id}

Environments

Create Environment

http
POST /api/v1/environments
bash
curl -X POST "http://localhost:8080/api/v1/environments" \
  -H "Authorization: Bearer $JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Staging",
    "projectId": 1
  }'

List All Environments

http
GET /api/v1/environments

Get Environment by ID

http
GET /api/v1/environments/{id}

Update Environment

http
PUT /api/v1/environments/{id}

Delete Environment

http
DELETE /api/v1/environments/{id}

Warning: You cannot delete an environment with active API keys. Revoke all keys for the environment first.

API Keys

Create API Key

http
POST /api/v1/api-keys
bash
curl -X POST "http://localhost:8080/api/v1/api-keys" \
  -H "Authorization: Bearer $JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Production SDK Key",
    "keyType": "SERVER",
    "environmentId": 3,
    "projectId": 1
  }'

Response:

json
{
  "id": 12,
  "name": "Production SDK Key",
  "apiKey": "dGhpcyBpcyBhIDY0LWNoYXJhY3RlciBiYXNlNjR1cmwgZW5jb2RlZCBrZXk",
  "keyType": "SERVER",
  "environmentId": 3,
  "createdAt": "2026-06-21T13:41:05Z"
}

Warning: The key value (apiKey) is shown only once on creation. Save it immediately.

List All API Keys

http
GET /api/v1/api-keys

Update API Key

http
PUT /api/v1/api-keys/{id}

Delete API Key

http
DELETE /api/v1/api-keys/{id}

Audit

Get Audit Records

http
GET /api/v1/audit
ParameterTypeDefaultDescription
pageint0Page number
sizeint20Page size
dateFromdatetimeStart of period (ISO 8601)
dateTodatetimeEnd of period (ISO 8601)
bash
curl "http://localhost:8080/api/v1/audit?dateFrom=2026-06-14T00:00:00Z&dateTo=2026-06-21T23:59:59Z" \
  -H "Authorization: Bearer $JWT_TOKEN"

SDK

Get Feature Flags

http
GET /api/client/features

Used by SDKs on initialization. Returns an array of flags for the environment bound to a SERVER API key.

bash
curl "http://localhost:8080/api/client/features" \
  -H "Authorization: Bearer <api-key>"

Response — a JSON array:

json
[
  {
    "name": "New Checkout",
    "key": "new-checkout",
    "enabled": true,
    "activation": {
      "rollOut": 50,
      "constraints": [
        { "field": "country", "operator": "in", "values": ["US", "CA"], "contextType": "string" }
      ],
      "segments": [
        { "name": "Premium Users", "constraints": [...] }
      ]
    }
  }
]

Evaluate Flags (Client-side)

http
POST /api/client/evaluate

Evaluates flags server-side for the given context (mode: 'client').

bash
curl -X POST "http://localhost:8080/api/client/evaluate" \
  -H "Authorization: Bearer <api-key>" \
  -H "Content-Type: application/json" \
  -d '{"context": {"userId": "user-123", "country": "US"}, "toggles": ["new-checkout"]}'

Submit Metrics

http
POST /api/client/metrics

Sends accumulated SDK usage metrics.

bash
curl -X POST "http://localhost:8080/api/client/metrics" \
  -H "Authorization: Bearer <api-key>" \
  -H "Content-Type: application/json" \
  -d '{"evaluations": {"new-checkout": {"t": 150, "f": 50}}}'

Integrations

Create Integration

http
POST /api/v1/integrations
bash
curl -X POST "http://localhost:8080/api/v1/integrations" \
  -H "Authorization: Bearer $JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "My Webhook",
    "enabled": true,
    "type": "custom_webhook",
    "configJson": "{\"url\":\"https://your-server.example.com/hooks/mozhno\"}",
    "eventSubscriptionsJson": "[\"flag.updated\",\"flag.archived\",\"flag.deleted\"]",
    "projectId": 1
  }'

List All Integrations

http
GET /api/v1/integrations

Update Integration

http
PUT /api/v1/integrations/{id}

Delete Integration

http
DELETE /api/v1/integrations/{id}

Check Webhook Quota

http
GET /api/v1/integrations/webhook-limit

Users

Invite User

http
POST /api/v1/users/invite
bash
curl -X POST "http://localhost:8080/api/v1/users/invite" \
  -H "Authorization: Bearer $JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "developer@example.com",
    "role": "DEVELOPER"
  }'
RoleDescription
ADMINFull access to all resources
DEVELOPERFlag, segment, and strategy management
VIEWERRead-only access

List All Users

http
GET /api/v1/users

Get User

http
GET /api/v1/users/{id}

Update User

http
PUT /api/v1/users/{id}

Delete User

http
DELETE /api/v1/users/{id}

Tags

Create Tag

http
POST /api/v1/tags
bash
curl -X POST "http://localhost:8080/api/v1/tags" \
  -H "Authorization: Bearer $JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "checkout",
    "color": "#3b82f6",
    "projectId": 1
  }'

List All Tags

http
GET /api/v1/tags

Get Tag by ID

http
GET /api/v1/tags/{id}

Update Tag

http
PUT /api/v1/tags/{id}

Delete Tag

http
DELETE /api/v1/tags/{id}

Contexts

Create Context Definition

http
POST /api/v1/contexts

List All Contexts

http
GET /api/v1/contexts

Get Context by ID

http
GET /api/v1/contexts/{definitionId}

Update Context

http
PUT /api/v1/contexts/{definitionId}

Delete Context

http
DELETE /api/v1/contexts/{definitionId}

Context Values

http
GET    /api/v1/contexts/{definitionId}/values
POST   /api/v1/contexts/{definitionId}/values
PUT    /api/v1/contexts/{definitionId}/values
GET    /api/v1/contexts/values/{valueId}
PUT    /api/v1/contexts/values/{valueId}
DELETE /api/v1/contexts/values/{valueId}

Metrics

Flag Metrics

http
GET /api/v1/flags/{flagId}/metrics
ParameterTypeDescription
environmentIdlongEnvironment ID
instanceIdstringSDK instance ID
appNamestringApplication name

Project Metrics

http
GET /api/v1/metrics
ParameterTypeDescription
environmentIdlongEnvironment ID

Project Settings

Get Settings

http
GET /api/v1/settings

Update Settings

http
PUT /api/v1/settings

Projects

List All Projects

http
GET /api/v1/projects

Get Project by ID

http
GET /api/v1/projects/{id}

Create Project

http
POST /api/v1/projects

Update Project

http
PUT /api/v1/projects/{id}

Delete Project

http
DELETE /api/v1/projects/{id}

SDK Client Instances

http
GET /api/v1/projects/{id}/client-instances
ParameterTypeDescription
environmentIdlongEnvironment ID

API Error Codes

HTTP CodeError CodeDescription
400BAD_REQUESTInvalid request parameters
400VALIDATION_ERRORRequest body validation error
401UNAUTHORIZEDMissing or invalid token/key
401INVALID_CREDENTIALSWrong email or password
401TOKEN_REUSEReused refresh token detected
402QUOTA_EXCEEDEDResource quota exceeded
403FORBIDDENInsufficient permissions
404NOT_FOUNDResource not found
409CONFLICTResource already exists
429RATE_LIMIT_EXCEEDEDRequest rate limit exceeded
500INTERNAL_ERRORInternal server error

Swagger UI and OpenAPI

ResourceURL
Swagger UI/swagger-ui.html
OpenAPI 3.1 JSON/v3/api-docs
OpenAPI 3.1 YAML/v3/api-docs.yaml

Complete Flag Lifecycle via API

bash
#!/bin/bash
BASE="http://localhost:8080/api/v1"
TOKEN="eyJhbGciOiJIUzI1NiIs..."

# 1. Create flag
curl -s -X POST "$BASE/flags" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"key": "my-feature", "name": "My Feature", "flagType": "RELEASE", "projectId": 1}'

# 2. Configure strategy: 1% rollout
curl -s -X PUT "$BASE/flags/42/strategies" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"environmentId": 3, "enabled": true, "percentage": 1}'

# 3. Increase to 50%
curl -s -X PUT "$BASE/flags/42/strategies" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"environmentId": 3, "enabled": true, "percentage": 50}'

# 4. Enable for all (100%)
curl -s -X PUT "$BASE/flags/42/strategies" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"environmentId": 3, "enabled": true, "percentage": 100}'

# 5. Archive
curl -s -X POST "$BASE/flags/42/archive" \
  -H "Authorization: Bearer $TOKEN"

# 6. Check audit
curl -s "$BASE/audit?dateFrom=2026-01-01T00:00:00Z" \
  -H "Authorization: Bearer $TOKEN"

Released under the AGPL v3.0 License.