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
POST /api/v1/auth/loginRequest body:
{
"email": "admin@example.com",
"password": "your-password"
}Response:
{
"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"
}
}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
POST /api/v1/auth/refreshcurl -X POST "http://localhost:8080/api/v1/auth/refresh" \
-H "Content-Type: application/json" \
-d '{"refreshToken": "dGhpcyBpcyBhIHJlZnJlc2ggdG9rZW4..."}'Logout
POST /api/v1/auth/logoutcurl -X POST "http://localhost:8080/api/v1/auth/logout" \
-H "Authorization: Bearer $JWT_TOKEN"Current User
GET /api/v1/auth/mecurl "http://localhost:8080/api/v1/auth/me" \
-H "Authorization: Bearer $JWT_TOKEN"Select Project
POST /api/v1/auth/select-projectPassword Recovery
POST /api/v1/auth/forgot-password
POST /api/v1/auth/reset-passwordAccept Invitation
POST /api/v1/auth/accept-inviteFlags
Create Flag
POST /api/v1/flags| Field | Type | Required | Description |
|---|---|---|---|
key | string | Yes | Unique flag key |
name | string | Yes | Flag name |
description | string | No | Description |
flagType | string | Yes | RELEASE or KILLSWITCH |
tags | object[] | No | {tagId, value} objects |
projectId | long | Yes | Project ID |
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
GET /api/v1/flags| Parameter | Type | Default | Description |
|---|---|---|---|
includeArchived | boolean | false | Include archived flags |
page | int | 0 | Page number |
size | int | 20 | Page size |
curl "http://localhost:8080/api/v1/flags?includeArchived=true" \
-H "Authorization: Bearer $JWT_TOKEN"Get Flag by ID
GET /api/v1/flags/{id}curl "http://localhost:8080/api/v1/flags/42" \
-H "Authorization: Bearer $JWT_TOKEN"Flags by Environment
GET /api/v1/flags/by-environmentEnriched Flags (Dashboard)
GET /api/v1/flags/enrichedReturns flags with associated segments, tags, contexts, and environments.
Update Flag
PUT /api/v1/flags/{id}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
PUT /api/v1/flags/{flagId}/strategiesConfigure strategy for an environment:
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
POST /api/v1/flags/{id}/archivecurl -X POST "http://localhost:8080/api/v1/flags/42/archive" \
-H "Authorization: Bearer $JWT_TOKEN"Unarchive Flag
POST /api/v1/flags/{id}/unarchivecurl -X POST "http://localhost:8080/api/v1/flags/42/unarchive" \
-H "Authorization: Bearer $JWT_TOKEN"Segments
Create Segment
POST /api/v1/segmentscurl -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
GET /api/v1/segmentscurl "http://localhost:8080/api/v1/segments" \
-H "Authorization: Bearer $JWT_TOKEN"Get Segment by ID
GET /api/v1/segments/{id}Update Segment
PUT /api/v1/segments/{id}Delete Segment
DELETE /api/v1/segments/{id}Environments
Create Environment
POST /api/v1/environmentscurl -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
GET /api/v1/environmentsGet Environment by ID
GET /api/v1/environments/{id}Update Environment
PUT /api/v1/environments/{id}Delete Environment
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
POST /api/v1/api-keyscurl -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:
{
"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
GET /api/v1/api-keysUpdate API Key
PUT /api/v1/api-keys/{id}Delete API Key
DELETE /api/v1/api-keys/{id}Audit
Get Audit Records
GET /api/v1/audit| Parameter | Type | Default | Description |
|---|---|---|---|
page | int | 0 | Page number |
size | int | 20 | Page size |
dateFrom | datetime | — | Start of period (ISO 8601) |
dateTo | datetime | — | End of period (ISO 8601) |
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
GET /api/client/featuresUsed by SDKs on initialization. Returns an array of flags for the environment bound to a SERVER API key.
curl "http://localhost:8080/api/client/features" \
-H "Authorization: Bearer <api-key>"Response — a JSON array:
[
{
"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)
POST /api/client/evaluateEvaluates flags server-side for the given context (mode: 'client').
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
POST /api/client/metricsSends accumulated SDK usage metrics.
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
POST /api/v1/integrationscurl -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
GET /api/v1/integrationsUpdate Integration
PUT /api/v1/integrations/{id}Delete Integration
DELETE /api/v1/integrations/{id}Check Webhook Quota
GET /api/v1/integrations/webhook-limitUsers
Invite User
POST /api/v1/users/invitecurl -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"
}'| Role | Description |
|---|---|
ADMIN | Full access to all resources |
DEVELOPER | Flag, segment, and strategy management |
VIEWER | Read-only access |
List All Users
GET /api/v1/usersGet User
GET /api/v1/users/{id}Update User
PUT /api/v1/users/{id}Delete User
DELETE /api/v1/users/{id}Tags
Create Tag
POST /api/v1/tagscurl -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
GET /api/v1/tagsGet Tag by ID
GET /api/v1/tags/{id}Update Tag
PUT /api/v1/tags/{id}Delete Tag
DELETE /api/v1/tags/{id}Contexts
Create Context Definition
POST /api/v1/contextsList All Contexts
GET /api/v1/contextsGet Context by ID
GET /api/v1/contexts/{definitionId}Update Context
PUT /api/v1/contexts/{definitionId}Delete Context
DELETE /api/v1/contexts/{definitionId}Context Values
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
GET /api/v1/flags/{flagId}/metrics| Parameter | Type | Description |
|---|---|---|
environmentId | long | Environment ID |
instanceId | string | SDK instance ID |
appName | string | Application name |
Project Metrics
GET /api/v1/metrics| Parameter | Type | Description |
|---|---|---|
environmentId | long | Environment ID |
Project Settings
Get Settings
GET /api/v1/settingsUpdate Settings
PUT /api/v1/settingsProjects
List All Projects
GET /api/v1/projectsGet Project by ID
GET /api/v1/projects/{id}Create Project
POST /api/v1/projectsUpdate Project
PUT /api/v1/projects/{id}Delete Project
DELETE /api/v1/projects/{id}SDK Client Instances
GET /api/v1/projects/{id}/client-instances| Parameter | Type | Description |
|---|---|---|
environmentId | long | Environment ID |
API Error Codes
| HTTP Code | Error Code | Description |
|---|---|---|
400 | BAD_REQUEST | Invalid request parameters |
400 | VALIDATION_ERROR | Request body validation error |
401 | UNAUTHORIZED | Missing or invalid token/key |
401 | INVALID_CREDENTIALS | Wrong email or password |
401 | TOKEN_REUSE | Reused refresh token detected |
402 | QUOTA_EXCEEDED | Resource quota exceeded |
403 | FORBIDDEN | Insufficient permissions |
404 | NOT_FOUND | Resource not found |
409 | CONFLICT | Resource already exists |
429 | RATE_LIMIT_EXCEEDED | Request rate limit exceeded |
500 | INTERNAL_ERROR | Internal server error |
Swagger UI and OpenAPI
| Resource | URL |
|---|---|
| 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
#!/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"Related Pages
- API Overview — authentication, format, limits
- Integrations — webhook integrations, CI/CD
- SDK Overview — how SDK uses the API
- Swagger UI — interactive documentation