Skip to main content

Overview

The Feature Flags API allows administrators to check and toggle feature flags that control various system behaviors and validations. Feature flags enable dynamic configuration without code deployments.
All feature flag endpoints require administrator authentication and permissions. Modifying feature flags can significantly impact system behavior.

Authentication

All endpoints require:
  • Valid authentication token
  • Administrator role/permissions
  • Bearer token in Authorization header
Authorization: Bearer YOUR_ACCESS_TOKEN

Feature Structure

Features contain the following fields:
FieldTypeDescription
feature_idintegerUnique identifier for the feature
namestringFeature flag name (immutable)
scopestringFeature scope (global scope is __laravel_null)
valuestringCurrent feature value/state
created_atdatetimeWhen the feature was created
updated_atdatetimeWhen the feature was last modified

Available Features

The following feature flags are available in the system:
Feature NameDescription
allow_discord_notificationsEnable/disable Discord notification integration
audio_bitrate_restrictionSet audio bitrate validation requirements
enabled_only_on_localhostRestrict certain features to localhost only
ignore_all_file_validationsBypass all file validation checks
required_encoder_versionSpecify required encoder version for uploads
video_bitrate_restrictionSet video bitrate validation requirements
video_codec_streamSpecify allowed video codec
video_color_primaries_streamSpecify required color primaries
video_color_space_streamSpecify required color space
video_color_transfer_streamSpecify required color transfer characteristics
video_pixel_format_streamSpecify required pixel format

Endpoints

List Features

Get a list of all global feature flags.
GET /api/admin/feature
This endpoint only returns features with global scope (__laravel_null).
Query Parameters:
  • Standard pagination and filtering parameters
  • Supports field selection and includes
Example Response:
{
  "features": [
    {
      "feature_id": 1,
      "name": "allow_discord_notifications",
      "scope": "__laravel_null",
      "value": "true",
      "created_at": "2026-01-01T00:00:00.000000Z",
      "updated_at": "2026-02-15T10:30:00.000000Z"
    },
    {
      "feature_id": 2,
      "name": "ignore_all_file_validations",
      "scope": "__laravel_null",
      "value": "false",
      "created_at": "2026-01-01T00:00:00.000000Z",
      "updated_at": "2026-01-01T00:00:00.000000Z"
    },
    {
      "feature_id": 3,
      "name": "video_codec_stream",
      "scope": "__laravel_null",
      "value": "h264",
      "created_at": "2026-01-01T00:00:00.000000Z",
      "updated_at": "2026-01-20T14:22:00.000000Z"
    }
  ]
}

Get Feature

Retrieve a specific feature flag by ID.
GET /api/admin/feature/{id}
Path Parameters:
  • id - The feature ID
Example Response:
{
  "feature": {
    "feature_id": 1,
    "name": "allow_discord_notifications",
    "scope": "__laravel_null",
    "value": "true",
    "created_at": "2026-01-01T00:00:00.000000Z",
    "updated_at": "2026-02-15T10:30:00.000000Z"
  }
}

Update Feature

Update a feature flag’s value.
PUT /api/admin/feature/{id}
Only the value field can be updated. The name and scope fields are immutable.
Path Parameters:
  • id - The feature ID
Request Body:
{
  "value": "false"
}
Example Response:
{
  "feature": {
    "feature_id": 1,
    "name": "allow_discord_notifications",
    "scope": "__laravel_null",
    "value": "false",
    "created_at": "2026-01-01T00:00:00.000000Z",
    "updated_at": "2026-03-03T12:00:00.000000Z"
  }
}

Usage Examples

Toggle a Boolean Feature

# Enable Discord notifications
curl -X PUT https://api.animethemes.moe/api/admin/feature/1 \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "value": "true"
  }'

Update Video Codec Requirement

# Set required video codec to h265
curl -X PUT https://api.animethemes.moe/api/admin/feature/3 \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "value": "h265"
  }'

Check Current Features

# List all features
curl -X GET https://api.animethemes.moe/api/admin/feature \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Feature Value Types

Feature values are stored as strings but represent different types:
Store as "true" or "false" strings.Examples:
  • allow_discord_notifications
  • ignore_all_file_validations
  • enabled_only_on_localhost
Store specific values like codec names or format specifications.Examples:
  • video_codec_stream: "h264", "h265", etc.
  • video_pixel_format_stream: "yuv420p", etc.
  • video_color_space_stream: "bt709", etc.
Store numeric values as strings.Examples:
  • audio_bitrate_restriction: "320000"
  • video_bitrate_restriction: "5000000"
  • required_encoder_version: "1.2.3"

Common Use Cases

Media Upload Validation

Several features control video and audio file validation:
# Disable all file validations (for testing)
curl -X PUT https://api.animethemes.moe/api/admin/feature/{id} \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"value": "true"}'

# Set specific codec requirements
curl -X PUT https://api.animethemes.moe/api/admin/feature/{codec_feature_id} \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"value": "h264"}'

Integration Toggles

Control external service integrations:
# Enable Discord notifications
curl -X PUT https://api.animethemes.moe/api/admin/feature/{discord_feature_id} \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"value": "true"}'

Best Practices

When changing feature flags, test in a non-production environment first, especially for validation-related features.
Keep a log of feature flag changes and the reasons for modifications, as they can significantly impact system behavior.
For critical features, consider using scoped features (if available) to test changes with a subset of users before global deployment.
After changing feature flags, monitor system metrics and error rates to ensure the change has the desired effect.

Limitations

  • Feature flags cannot be created or deleted via the API
  • Only the value field can be modified
  • The API only exposes globally scoped features
  • Feature name and scope are immutable

Announcements

Manage site announcements

Feature Flags Guide

Learn about feature flags

Build docs developers (and LLMs) love