openapi: 3.1.0
info:
  title: XC_VM Reseller API
  version: 2.7.3
  summary: Reseller API of the Xtream Codes compatible HTTP surface, as implemented by XC_VM.
  description: |
    A source-level reference for the **Xtream Codes (XC) API**: the de facto standard HTTP interface
    between IPTV panels and player apps. The reference implementation is
    [XC_VM](https://github.com/Vateron-Media/XC_VM) 2.7.3, an open-source continuation of Xtream UI / XC.
    Each operation cites the XC_VM source file and line it was traced from (`src/...:line`).

    ## Authentication models

    The panel has several independent auth schemes. Each endpoint states which one it uses.

    | Who | How |
    |---|---|
    | Line (subscriber) | `username` + `password` query parameters, or `token` (32-char line access token). Also in path form: `/player_api/{u}/{p}`, `/live/{u}/{p}/...` |
    | Activation code | The code typed as `username` (or `token`) is activated on first use and becomes a line |
    | MAG / Stalker box | MAC address cookie + bearer token from `handshake` (`/c/portal.php`, `/stalker_portal/...`) |
    | Enigma2 box | MAC/device registration (`enigma2.php`) |
    | Admin / reseller REST | `api_key` query parameter (named `xct_` token or legacy per-user key) on `/{access_code}/?action=...`; the access code's IP whitelist is enforced by nginx |
    | Load-balancer nodes | Shared cluster secret (`/cluster/v1`); signed `node.rpc` (legacy `api.php` on nodes older than 2.7.0) |

    ## Notation

    OpenAPI cannot express query-string multiplexing, so action-based endpoints are written as separate
    literal paths such as `/player_api.php?action=get_live_streams`. The request is still a single
    `GET /player_api.php` with `action` as an ordinary query parameter.

    The admin and reseller REST APIs share one URL shape, `/{access_code}/?action=...`. Each access code has a type
    (3 = Admin API, 4 = Reseller API) and nginx routes it to that API, so `/{access_code}/...` and `/{reseller_access_code}/...` are the
    same URL and differ only in which kind of code is used.
  contact:
    name: XC_VM project
    url: https://github.com/Vateron-Media/XC_VM
  license:
    name: AGPL-3.0 (XC_VM source); this document describes its public interface
    identifier: AGPL-3.0-only
servers:
  - url: '{protocol}://{host}:{port}'
    description: Any XC compatible panel or load-balancer node
    variables:
      protocol:
        default: http
        enum:
          - http
          - https
      host:
        default: tv.example.com
      port:
        default: '80'
        description: HTTP broadcast port (often 80, 8080, 8000, 25461); HTTPS often 443 or 25463.
externalDocs:
  description: XC_VM source
  url: https://github.com/Vateron-Media/XC_VM
security:
  - Reseller_ApiKey: []
components:
  securitySchemes:
    Reseller_ApiKey:
      type: apiKey
      in: query
      name: api_key
      description: A named API token (`xct_...`, stored as a SHA-256 hash in `api_tokens`) or, while the `api_legacy_keys` setting is not '0', the user's legacy `users.api_key`. The key's user must have `status=1` and be in a group with `is_reseller=1`. Tokens may also carry an IP allow-list and an expiry (src/Core/Auth/ApiTokens.php:47-93). Missing or rejected keys give `{"status":"STATUS_FAILURE","error":"Invalid API key."}`.
  parameters:
    Reseller_AccessCode:
      name: reseller_access_code
      in: path
      required: true
      schema:
        type: string
        example: resapi
      description: An access code of type 4 (Reseller API) (Access Codes page). nginx routes `/<code>/...` to src/Public/index.php with XC_SCOPE=includes/api/reseller (src/Core/Auth/AuthRepository.php:119-120, src/bin/nginx/conf/codes/template). Anything after the code in the path is ignored; only the parameters matter. The code's whitelist, when set, becomes nginx `allow`/`deny all` rules.
    Reseller_Start:
      name: start
      in: query
      schema:
        type: integer
        default: 0
        minimum: 0
      description: Row offset (intval).
    Reseller_Limit:
      name: limit
      in: query
      schema:
        type: integer
        default: 50
      description: Page size (intval; 0 or absent = 50). Passed to the table handler as `length`. The reseller table handler caps it at 1000.
    Reseller_ShowColumns:
      name: show_columns
      in: query
      schema:
        type: string
        example: id,username,exp_date
      description: Comma-separated whitelist of row keys to keep (applied to `data`). Takes precedence over hide_columns.
    Reseller_HideColumns:
      name: hide_columns
      in: query
      schema:
        type: string
        example: password
      description: Comma-separated row keys to drop (ignored when show_columns is set).
    Reseller_SearchValue:
      name: search[value]
      in: query
      schema:
        type: string
      description: DataTables global search; LIKE %value% across the columns listed in the operation.
    Reseller_OrderColumn:
      name: order[0][column]
      in: query
      schema:
        type: integer
        default: 0
      description: DataTables sort column index (see the per-operation index map; an index mapped to none, including the default 0 on most tables, means no ORDER BY).
    Reseller_OrderDir:
      name: order[0][dir]
      in: query
      schema:
        type: string
        enum:
          - asc
          - desc
        default: asc
      description: Sort direction; anything but `desc` is ascending.
    Reseller_Id:
      name: id
      in: query
      required: true
      schema:
        type: integer
        example: 12
      description: Record id.
  responses:
    Reseller_Maintenance:
      description: 'Maintenance mode is on: the reseller API answers HTTP 503 before checking the key (src/Public/Controllers/Api/ResellerRestApiController.php:32-37).'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Reseller_Error'
          example:
            status: STATUS_FAILURE
            error: The panel is under maintenance. Please try again later.
  examples:
    Reseller_InvalidKey:
      summary: Missing or rejected api_key
      value:
        status: STATUS_FAILURE
        error: Invalid API key.
    Reseller_NoPermissions:
      summary: Token scope refused, or the service returned no result
      value:
        status: STATUS_NO_PERMISSIONS
    Reseller_Failure:
      summary: Record not found / operation failed
      value:
        status: STATUS_FAILURE
  schemas:
    Reseller_Status:
      type: string
      description: Status name. Numeric service codes (src/Core/Config/ConstantsInitializer.php:200-252) are converted to their constant names by parseError(); an empty service result becomes STATUS_NO_PERMISSIONS.
      enum:
        - STATUS_FAILURE
        - STATUS_SUCCESS
        - STATUS_SUCCESS_MULTI
        - STATUS_CODE_LENGTH
        - STATUS_NO_SOURCES
        - STATUS_DISABLED
        - STATUS_NOT_ADMIN
        - STATUS_INVALID_EMAIL
        - STATUS_INVALID_PASSWORD
        - STATUS_INVALID_IP
        - STATUS_INVALID_PLAYLIST
        - STATUS_INVALID_NAME
        - STATUS_INVALID_CAPTCHA
        - STATUS_INVALID_CODE
        - STATUS_INVALID_DATE
        - STATUS_INVALID_FILE
        - STATUS_INVALID_GROUP
        - STATUS_INVALID_DATA
        - STATUS_INVALID_DIR
        - STATUS_INVALID_MAC
        - STATUS_EXISTS_CODE
        - STATUS_EXISTS_NAME
        - STATUS_EXISTS_USERNAME
        - STATUS_EXISTS_MAC
        - STATUS_EXISTS_SOURCE
        - STATUS_EXISTS_IP
        - STATUS_EXISTS_DIR
        - STATUS_SUCCESS_REPLACE
        - STATUS_FLUSH
        - STATUS_TOO_MANY_RESULTS
        - STATUS_SPACE_ISSUE
        - STATUS_INVALID_USER
        - STATUS_CERTBOT
        - STATUS_CERTBOT_INVALID
        - STATUS_INVALID_INPUT
        - STATUS_NOT_RESELLER
        - STATUS_NO_TRIALS
        - STATUS_INSUFFICIENT_CREDITS
        - STATUS_INVALID_PACKAGE
        - STATUS_INVALID_TYPE
        - STATUS_INVALID_USERNAME
        - STATUS_INVALID_SUBRESELLER
        - STATUS_NO_DESCRIPTION
        - STATUS_NO_KEY
        - STATUS_EXISTS_HMAC
        - STATUS_CERTBOT_RUNNING
        - STATUS_RESERVED_CODE
        - STATUS_NO_TITLE
        - STATUS_NO_SOURCE
        - STATUS_PORT_IN_USE
        - STATUS_2FA_REQUIRED
        - STATUS_2FA_INVALID
        - STATUS_2FA_LOCKED
        - STATUS_NO_PERMISSIONS
    Reseller_Envelope:
      type: object
      required:
        - status
      description: Standard reply envelope. Always HTTP 200 (except the reseller maintenance 503).
      properties:
        status:
          $ref: '#/components/schemas/Reseller_Status'
        data:
          description: Payload; shape depends on the action. On create/edit, the full stored record. On a validation error, often the (filtered) input echoed back.
        error:
          type: string
          description: Human-readable error (only some errors carry one).
      additionalProperties: true
    Reseller_Error:
      type: object
      required:
        - status
      properties:
        status:
          $ref: '#/components/schemas/Reseller_Status'
        error:
          type: string
    Reseller_TableResponse:
      type: object
      description: API-mode reseller table reply. Currently always `{"status":"STATUS_SUCCESS","data":[]}` (see operation descriptions).
      properties:
        status:
          type: string
          enum:
            - STATUS_SUCCESS
        data:
          type: array
          items:
            type: object
            additionalProperties: true
        recordsTotal:
          oneOf:
            - type: integer
            - type: string
              pattern: ^[0-9]+$
          description: Total rows after filters (numeric string for raw-row handlers, integer for typed log handlers).
        recordsFiltered:
          oneOf:
            - type: integer
            - type: string
    Reseller_ActiveCodeRow:
      type: object
      description: Row of ActiveCodeService::listCodes() (src/Domain/Line/ActiveCodeService.php:1314-1341). Typed values.
      properties:
        id:
          type: integer
        activation_code:
          type: string
        batch_name:
          type: string
          description: '''None'' when empty'
        status:
          type: integer
          enum:
            - 0
            - 1
            - 2
          description: 0 disabled, 1 stock (not redeemed), 2 redeemed
        status_key:
          type: string
          enum:
            - disabled
            - stock
            - expired
            - active
        status_label:
          type: string
          enum:
            - Disabled
            - Ready (Stock)
            - Expired
            - Active
        package_id:
          type: integer
        package_name:
          type: string
        subscriber_id:
          type:
            - integer
            - 'null'
        line_username:
          type:
            - string
            - 'null'
        line_password:
          type:
            - string
            - 'null'
        exp_date:
          type:
            - integer
            - 'null'
        exp_date_formatted:
          type:
            - string
            - 'null'
        remaining_days:
          type: integer
        mac:
          type:
            - string
            - 'null'
        device_id:
          type:
            - string
            - 'null'
        max_connections:
          type: integer
        is_trial:
          type: integer
        is_adult:
          type: integer
        purchase_cost:
          type: number
        created_by:
          type: integer
        creator_username:
          type: string
        created_at:
          type: integer
        created_at_formatted:
          type: string
        activated_at:
          type:
            - integer
            - 'null'
        activated_at_formatted:
          type:
            - string
            - 'null'
    Reseller_ActiveCodeGenerate:
      type: object
      required:
        - package_id
      description: Inputs of ActiveCodeService::generateCodes() (src/Domain/Line/ActiveCodeService.php:69-371). Each code creates a disabled line with no expiry until the code is redeemed.
      properties:
        package_id:
          type: integer
          description: Package id (required; error 'Invalid package selected.'). Must be an is_line package that lists your group; official unless is_trial.
        num_codes:
          type: integer
          minimum: 1
          maximum: 500
          default: 1
          description: Number of codes (not `qty`).
        code_length:
          type: integer
          minimum: 6
          maximum: 24
          default: 10
        code_format:
          type: string
          enum:
            - alphanumeric
            - numeric
          default: alphanumeric
          description: Alphanumeric alphabet is 23456789ABCDEFGHJKLMNPQRSTUVWXYZ.
        is_trial:
          type: boolean
          description: Trial codes (cost = package trial_credits).
        batch_name:
          type: string
          description: Default `BATCH-YYYYMMDD-XXXXX`.
        bouquets_selected[]:
          type: array
          items:
            type: integer
          description: 'Default: the package''s bouquets. Intersected with the package bouquets, and only honoured with allow_change_bouquets.'
        dns_base:
          type: string
          description: Must be one of your comma-separated `reseller_dns` values, otherwise ignored.
        is_adult:
          type: boolean
        category_template_id:
          type: integer
        streaming_username:
          type: string
          description: Only when num_codes=1 (alias `username`); min 3 chars, [A-Za-z0-9._-]. Default `ac_` + 9 hex.
        streaming_password:
          type: string
          description: Only when num_codes=1 (alias `password`); no `/`. Default 10 hex chars.
    Reseller_ActiveCodeEdit:
      type: object
      additionalProperties: true
      description: Active code edit (ActiveCodeService::updateCode, src/Domain/Line/ActiveCodeService.php:884). package_id must be a package of your group; max_connections and exp_date are ignored for resellers.
      properties:
        activation_code:
          type: string
          description: New code string (must be unique).
        package_id:
          type: integer
        status:
          type: integer
          description: 0 disabled, 1 stock, 2 redeemed.
          enum:
            - 0
            - 1
            - 2
        mac:
          type: string
        device_id:
          type: string
        password:
          type: string
          description: Streaming password of the backing line.
        batch_name:
          type: string
    Reseller_LineInput:
      type: object
      additionalProperties: false
      description: 'Line fields for reseller create_line/edit_line (ResellerAPI::processLine, src/Domain/User/ResellerAPI.php:1035). Only the whitelisted keys below are read (ResellerAPI::processData, src/Domain/User/ResellerAPI.php:52); restriction fields (allowed_ips, allowed_ua, bypass_ua, is_isplock, isp_clear) are dropped unless your group has allow_restrictions. Credits: creating or extending charges the package price (trial_credits, or official_credits / your override) and fails with STATUS_INSUFFICIENT_CREDITS (37); trials need remaining trial allowance (STATUS_NO_TRIALS, 36).'
      properties:
        package:
          type: integer
          description: 'Package id (create: required, else STATUS_INVALID_PACKAGE 38). Must be an is_line/is_mag/is_e2 package that lists your group and is official (or trial when `trial` is sent). On edit, sending a package extends/renews (official_duration added to a non-expired compatible line).'
        trial:
          type:
            - integer
            - string
          description: Checkbox. Use the trial price/duration.
        bouquets_selected:
          type: string
          description: JSON string, e.g. `[1,2,3]`. Only honoured with allow_change_bouquets; intersected with the package bouquets.
          example: '[1,2,3]'
        bouquet_order:
          type: string
          description: Custom order (JSON).
        member_id:
          type: integer
          description: 'Owner: you or one of your sub-resellers (else STATUS_INVALID_SUBRESELLER 41).'
        pair_id:
          type: integer
        telegram:
          type: string
        reseller_notes:
          type: string
          description: Set to NULL on edit when omitted.
        allowed_ips[]:
          type: array
          items:
            type: string
        is_isplock:
          type:
            - integer
            - string
          description: Checkbox.
        isp_clear:
          type: string
        category_template_id:
          type: integer
        username:
          type: string
          description: Only honoured with allow_change_username (else random); min length per group; no `/` (STATUS_INVALID_USERNAME 40); duplicate STATUS_EXISTS_USERNAME (22).
        password:
          type: string
          description: Only with allow_change_password; min length per group; no `/` (STATUS_INVALID_PASSWORD 8). Stored plain.
        contact:
          type: string
          description: Set to NULL on edit when omitted.
        allowed_ua[]:
          type: array
          items:
            type: string
        bypass_ua:
          type:
            - integer
            - string
          description: Checkbox.
    Reseller_MagInput:
      type: object
      additionalProperties: false
      description: 'MAG device (ResellerAPI::processMAG, src/Domain/User/ResellerAPI.php:219). Only the whitelisted keys below are read (ResellerAPI::processData, src/Domain/User/ResellerAPI.php:52); restriction fields (allowed_ips, allowed_ua, bypass_ua, is_isplock, isp_clear) are dropped unless your group has allow_restrictions. Credits: creating or extending charges the package price (trial_credits, or official_credits / your override) and fails with STATUS_INSUFFICIENT_CREDITS (37); trials need remaining trial allowance (STATUS_NO_TRIALS, 36).'
      properties:
        package:
          type: integer
          description: 'Package id (create: required, else STATUS_INVALID_PACKAGE 38). Must be an is_line/is_mag/is_e2 package that lists your group and is official (or trial when `trial` is sent). On edit, sending a package extends/renews (official_duration added to a non-expired compatible line).'
        trial:
          type:
            - integer
            - string
          description: Checkbox. Use the trial price/duration.
        bouquets_selected:
          type: string
          description: JSON string, e.g. `[1,2,3]`. Only honoured with allow_change_bouquets; intersected with the package bouquets.
          example: '[1,2,3]'
        bouquet_order:
          type: string
          description: Custom order (JSON).
        member_id:
          type: integer
          description: 'Owner: you or one of your sub-resellers (else STATUS_INVALID_SUBRESELLER 41).'
        pair_id:
          type: integer
        telegram:
          type: string
        reseller_notes:
          type: string
          description: Set to NULL on edit when omitted.
        allowed_ips[]:
          type: array
          items:
            type: string
        is_isplock:
          type:
            - integer
            - string
          description: Checkbox.
        isp_clear:
          type: string
        category_template_id:
          type: integer
        mac:
          type: string
          description: '**Required.** Empty = STATUS_INVALID_INPUT (34); invalid = STATUS_INVALID_MAC (19); used by another device = STATUS_EXISTS_MAC (23).'
          example: 00:1A:79:12:34:56
        parent_password:
          type: string
        sn:
          type: string
        stb_type:
          type: string
        image_version:
          type: string
        hw_version:
          type: string
        device_id:
          type: string
        device_id2:
          type: string
        ver:
          type: string
    Reseller_EnigmaInput:
      type: object
      additionalProperties: false
      description: 'Enigma2 device (ResellerAPI::processEnigma, src/Domain/User/ResellerAPI.php:522). Only the whitelisted keys below are read (ResellerAPI::processData, src/Domain/User/ResellerAPI.php:52); restriction fields (allowed_ips, allowed_ua, bypass_ua, is_isplock, isp_clear) are dropped unless your group has allow_restrictions. Credits: creating or extending charges the package price (trial_credits, or official_credits / your override) and fails with STATUS_INSUFFICIENT_CREDITS (37); trials need remaining trial allowance (STATUS_NO_TRIALS, 36).'
      properties:
        package:
          type: integer
          description: 'Package id (create: required, else STATUS_INVALID_PACKAGE 38). Must be an is_line/is_mag/is_e2 package that lists your group and is official (or trial when `trial` is sent). On edit, sending a package extends/renews (official_duration added to a non-expired compatible line).'
        trial:
          type:
            - integer
            - string
          description: Checkbox. Use the trial price/duration.
        bouquets_selected:
          type: string
          description: JSON string, e.g. `[1,2,3]`. Only honoured with allow_change_bouquets; intersected with the package bouquets.
          example: '[1,2,3]'
        bouquet_order:
          type: string
          description: Custom order (JSON).
        member_id:
          type: integer
          description: 'Owner: you or one of your sub-resellers (else STATUS_INVALID_SUBRESELLER 41).'
        pair_id:
          type: integer
        telegram:
          type: string
        reseller_notes:
          type: string
          description: Set to NULL on edit when omitted.
        allowed_ips[]:
          type: array
          items:
            type: string
        is_isplock:
          type:
            - integer
            - string
          description: Checkbox.
        isp_clear:
          type: string
        category_template_id:
          type: integer
        mac:
          type: string
          description: '**Required.** Empty = STATUS_INVALID_INPUT (34); invalid = STATUS_INVALID_MAC (19); used by another device = STATUS_EXISTS_MAC (23).'
          example: 00:1A:79:12:34:56
        modem_mac:
          type: string
        local_ip:
          type: string
        enigma_version:
          type: string
        cpu:
          type: string
        lversion:
          type: string
        token:
          type: string
    Reseller_UserInput:
      type: object
      additionalProperties: false
      description: Sub-reseller (ResellerAPI::processUser, src/Domain/User/ResellerAPI.php:810). Requires create_sub_resellers. Creating costs the group's create_sub_resellers_price (STATUS_INSUFFICIENT_CREDITS 37).
      properties:
        username:
          type: string
          description: Duplicate = STATUS_EXISTS_USERNAME (22).
        password:
          type: string
          description: Hashed on save.
        email:
          type: string
        reseller_dns:
          type: string
        notes:
          type: string
        owner_id:
          type: integer
          description: You or one of your sub-resellers (else STATUS_INVALID_SUBRESELLER 41).
        member_group_id:
          type: integer
          description: Must be one of your group's `subresellers` and not reserved (else STATUS_INVALID_GROUP 16).
    Admin_LineRow:
      type: object
      description: '`lines` row (UserRepository::getLineById). `exp_date` is a unix timestamp string or null (never expires); `bouquet`, `allowed_outputs`, `allowed_ips`, `allowed_ua` are JSON strings. Raw DB row cleaned by get_row(): non-zero values arrive as strings (numbers included), falsy values (0, "", null) keep their type, `<`/`>` become `&lt;`/`&gt;`, text is trimmed. JSON columns are JSON-encoded strings.'
      additionalProperties: true
      properties:
        id:
          type:
            - string
            - integer
            - 'null'
        member_id:
          type:
            - string
            - integer
            - 'null'
        username:
          type:
            - string
            - integer
            - 'null'
        password:
          type:
            - string
            - integer
            - 'null'
        last_ip:
          type:
            - string
            - integer
            - 'null'
        exp_date:
          type:
            - string
            - integer
            - 'null'
        admin_enabled:
          type:
            - string
            - integer
            - 'null'
        enabled:
          type:
            - string
            - integer
            - 'null'
        admin_notes:
          type:
            - string
            - integer
            - 'null'
        reseller_notes:
          type:
            - string
            - integer
            - 'null'
        bouquet:
          type:
            - string
            - integer
            - 'null'
        bouquet_order_custom:
          type:
            - string
            - integer
            - 'null'
        allowed_outputs:
          type:
            - string
            - integer
            - 'null'
        max_connections:
          type:
            - string
            - integer
            - 'null'
        is_restreamer:
          type:
            - string
            - integer
            - 'null'
        is_trial:
          type:
            - string
            - integer
            - 'null'
        is_mag:
          type:
            - string
            - integer
            - 'null'
        is_e2:
          type:
            - string
            - integer
            - 'null'
        is_stalker:
          type:
            - string
            - integer
            - 'null'
        is_isplock:
          type:
            - string
            - integer
            - 'null'
        allowed_ips:
          type:
            - string
            - integer
            - 'null'
        allowed_ua:
          type:
            - string
            - integer
            - 'null'
        created_at:
          type:
            - string
            - integer
            - 'null'
        pair_id:
          type:
            - string
            - integer
            - 'null'
        force_server_id:
          type:
            - string
            - integer
            - 'null'
        as_number:
          type:
            - string
            - integer
            - 'null'
        isp_desc:
          type:
            - string
            - integer
            - 'null'
        forced_country:
          type:
            - string
            - integer
            - 'null'
        bypass_ua:
          type:
            - string
            - integer
            - 'null'
        play_token:
          type:
            - string
            - integer
            - 'null'
        last_expiration_video:
          type:
            - string
            - integer
            - 'null'
        package_id:
          type:
            - string
            - integer
            - 'null'
        access_token:
          type:
            - string
            - integer
            - 'null'
        contact:
          type:
            - string
            - integer
            - 'null'
        telegram:
          type:
            - string
            - integer
            - 'null'
        last_activity:
          type:
            - string
            - integer
            - 'null'
        last_activity_array:
          type:
            - string
            - integer
            - 'null'
        updated:
          type:
            - string
            - integer
            - 'null'
        is_activecode:
          type:
            - string
            - integer
            - 'null'
        custom_data:
          type:
            - string
            - integer
            - 'null'
    Admin_UserRow:
      type: object
      description: '`users` row (UserRepository::getRegisteredUserById) without `password`; `api_key` only on your own row. `credits` is normalised to a number. Raw DB row cleaned by get_row(): non-zero values arrive as strings (numbers included), falsy values (0, "", null) keep their type, `<`/`>` become `&lt;`/`&gt;`, text is trimmed. JSON columns are JSON-encoded strings.'
      additionalProperties: true
      properties:
        id:
          type:
            - string
            - integer
            - 'null'
        username:
          type:
            - string
            - integer
            - 'null'
        email:
          type:
            - string
            - integer
            - 'null'
        ip:
          type:
            - string
            - integer
            - 'null'
        date_registered:
          type:
            - string
            - integer
            - 'null'
        last_login:
          type:
            - string
            - integer
            - 'null'
        member_group_id:
          type:
            - string
            - integer
            - 'null'
        credits:
          type: number
        notes:
          type:
            - string
            - integer
            - 'null'
        status:
          type:
            - string
            - integer
            - 'null'
        reseller_dns:
          type:
            - string
            - integer
            - 'null'
        owner_id:
          type:
            - string
            - integer
            - 'null'
        override_packages:
          type:
            - string
            - integer
            - 'null'
        hue:
          type:
            - string
            - integer
            - 'null'
        theme:
          type:
            - string
            - integer
            - 'null'
        timezone:
          type:
            - string
            - integer
            - 'null'
        api_key:
          type:
            - string
            - integer
            - 'null'
        lang:
          type:
            - string
            - integer
            - 'null'
        allowed_bouquets:
          type:
            - string
            - integer
            - 'null'
        ui_prefs:
          type:
            - string
            - integer
            - 'null'
    Admin_MagRow:
      type: object
      description: '`mag_devices` row (about 80 STB columns) plus `user` (backing line row) and `paired` (paired line row or null) (MagService::getById). Raw DB row cleaned by get_row(): non-zero values arrive as strings (numbers included), falsy values (0, "", null) keep their type, `<`/`>` become `&lt;`/`&gt;`, text is trimmed. JSON columns are JSON-encoded strings.'
      additionalProperties: true
      properties:
        mag_id:
          type:
            - string
            - integer
            - 'null'
        user_id:
          type:
            - string
            - integer
            - 'null'
        mac:
          type:
            - string
            - integer
            - 'null'
        ip:
          type:
            - string
            - integer
            - 'null'
        ver:
          type:
            - string
            - integer
            - 'null'
        stb_type:
          type:
            - string
            - integer
            - 'null'
        sn:
          type:
            - string
            - integer
            - 'null'
        image_version:
          type:
            - string
            - integer
            - 'null'
        hw_version:
          type:
            - string
            - integer
            - 'null'
        device_id:
          type:
            - string
            - integer
            - 'null'
        device_id2:
          type:
            - string
            - integer
            - 'null'
        lock_device:
          type:
            - string
            - integer
            - 'null'
        theme_type:
          type:
            - string
            - integer
            - 'null'
        mac_filter:
          type:
            - string
            - integer
            - 'null'
        parent_password:
          type:
            - string
            - integer
            - 'null'
        fav_channels:
          type:
            - string
            - integer
            - 'null'
        user:
          type:
            - object
            - 'null'
        paired:
          type:
            - object
            - 'null'
    Admin_EnigmaRow:
      type: object
      description: '`enigma2_devices` row plus `user` and `paired` (EnigmaService::getById). Raw DB row cleaned by get_row(): non-zero values arrive as strings (numbers included), falsy values (0, "", null) keep their type, `<`/`>` become `&lt;`/`&gt;`, text is trimmed. JSON columns are JSON-encoded strings.'
      additionalProperties: true
      properties:
        device_id:
          type:
            - string
            - integer
            - 'null'
        mac:
          type:
            - string
            - integer
            - 'null'
        user_id:
          type:
            - string
            - integer
            - 'null'
        modem_mac:
          type:
            - string
            - integer
            - 'null'
        local_ip:
          type:
            - string
            - integer
            - 'null'
        public_ip:
          type:
            - string
            - integer
            - 'null'
        key_auth:
          type:
            - string
            - integer
            - 'null'
        enigma_version:
          type:
            - string
            - integer
            - 'null'
        cpu:
          type:
            - string
            - integer
            - 'null'
        version:
          type:
            - string
            - integer
            - 'null'
        lversion:
          type:
            - string
            - integer
            - 'null'
        token:
          type:
            - string
            - integer
            - 'null'
        last_updated:
          type:
            - string
            - integer
            - 'null'
        watchdog_timeout:
          type:
            - string
            - integer
            - 'null'
        lock_device:
          type:
            - string
            - integer
            - 'null'
        telnet_enable:
          type:
            - string
            - integer
            - 'null'
        ftp_enable:
          type:
            - string
            - integer
            - 'null'
        ssh_enable:
          type:
            - string
            - integer
            - 'null'
        dns:
          type:
            - string
            - integer
            - 'null'
        original_mac:
          type:
            - string
            - integer
            - 'null'
        rc:
          type:
            - string
            - integer
            - 'null'
        mac_filter:
          type:
            - string
            - integer
            - 'null'
        user:
          type:
            - object
            - 'null'
        paired:
          type:
            - object
            - 'null'
    Admin_PackageRow:
      type: object
      description: '`users_packages` row. Credits columns are normalised to numbers. Raw DB row cleaned by get_row(): non-zero values arrive as strings (numbers included), falsy values (0, "", null) keep their type, `<`/`>` become `&lt;`/`&gt;`, text is trimmed. JSON columns are JSON-encoded strings.'
      additionalProperties: true
      properties:
        id:
          type:
            - string
            - integer
            - 'null'
        package_name:
          type:
            - string
            - integer
            - 'null'
        is_addon:
          type:
            - string
            - integer
            - 'null'
        is_trial:
          type:
            - string
            - integer
            - 'null'
        is_official:
          type:
            - string
            - integer
            - 'null'
        trial_credits:
          type: number
        official_credits:
          type: number
        trial_duration:
          type:
            - string
            - integer
            - 'null'
        trial_duration_in:
          type:
            - string
            - integer
            - 'null'
        official_duration:
          type:
            - string
            - integer
            - 'null'
        official_duration_in:
          type:
            - string
            - integer
            - 'null'
        groups:
          type:
            - string
            - integer
            - 'null'
        bouquets:
          type:
            - string
            - integer
            - 'null'
        addon_packages:
          type:
            - string
            - integer
            - 'null'
        is_line:
          type:
            - string
            - integer
            - 'null'
        is_mag:
          type:
            - string
            - integer
            - 'null'
        is_e2:
          type:
            - string
            - integer
            - 'null'
        is_restreamer:
          type:
            - string
            - integer
            - 'null'
        is_isplock:
          type:
            - string
            - integer
            - 'null'
        output_formats:
          type:
            - string
            - integer
            - 'null'
        max_connections:
          type:
            - string
            - integer
            - 'null'
        force_server_id:
          type:
            - string
            - integer
            - 'null'
        forced_country:
          type:
            - string
            - integer
            - 'null'
        lock_device:
          type:
            - string
            - integer
            - 'null'
        check_compatible:
          type:
            - string
            - integer
            - 'null'
tags:
  - name: Reseller API
    description: |-
      **Routing.** Create an access code of type 4 (Reseller API) on the Access Codes page. nginx (src/bin/nginx/conf/codes/template) routes every request under `/<code>/` to src/Public/index.php with XC_SCOPE=includes/api/reseller; index.php resolves the code (src/Public/index.php:117-135, src/Core/Auth/AuthRepository.php:115-135) and runs the controller. The rest of the path is ignored. Parameters may be sent as query string or form-encoded POST (merged; POST wins; src/Core/Init/LegacyInitializer.php:57-58). Every operation in this tag is `/{code}/?action=<name>`; the HTTP method shown is a suggestion, both work.

      **Authentication.** `api_key` is either a named API token (`xct_` + 40 hex, created per user in the panel; stored as a SHA-256 hash in `api_tokens` with scope full/read/lines, optional allow_sql, IP allow-list and expiry; last_used is updated) or, while setting `api_legacy_keys` is not '0', the user's legacy `users.api_key` (32 hex). The key's user must have status=1 and belong to a group with is_reseller=1 (src/Core/Auth/ApiTokens.php:47-93). Token scopes: `full` = everything the group may do; `read` = every get_* action plus user_info, packages, the log tables, check_active_code and export_active_code_batch; `lines` = user_info, packages, get_packages, get_package, get_bouquets, get_bouquet, any *active_code* action, and any action named `<verb>_line(s)|mag(s)|enigma(s)`. A scope refusal is `{"status":"STATUS_NO_PERMISSIONS"}`. Legacy keys are not scope-limited. The access code's own whitelist (if set) is enforced by nginx (allow/deny), before PHP (src/Core/Auth/AuthRepository.php:157-166).

      **Envelope.** Every reply is JSON with HTTP 200 (exceptions: a PHP TypeError gives HTTP 500 with an empty body; noted per operation; and maintenance mode, which answers HTTP 503 `{"status":"STATUS_FAILURE","error":"<maintenance message>"}` before the key is checked). `status` is a constant name; services return numeric codes that parseError() maps to names: 0 STATUS_FAILURE, 1 STATUS_SUCCESS, 2 STATUS_SUCCESS_MULTI, 3 STATUS_CODE_LENGTH, 4 STATUS_NO_SOURCES, 5 STATUS_DISABLED, 6 STATUS_NOT_ADMIN, 7 STATUS_INVALID_EMAIL, 8 STATUS_INVALID_PASSWORD, 9 STATUS_INVALID_IP, 10 STATUS_INVALID_PLAYLIST, 11 STATUS_INVALID_NAME, 12 STATUS_INVALID_CAPTCHA, 13 STATUS_INVALID_CODE, 14 STATUS_INVALID_DATE, 15 STATUS_INVALID_FILE, 16 STATUS_INVALID_GROUP, 17 STATUS_INVALID_DATA, 18 STATUS_INVALID_DIR, 19 STATUS_INVALID_MAC, 20 STATUS_EXISTS_CODE, 21 STATUS_EXISTS_NAME, 22 STATUS_EXISTS_USERNAME, 23 STATUS_EXISTS_MAC, 24 STATUS_EXISTS_SOURCE, 25 STATUS_EXISTS_IP, 26 STATUS_EXISTS_DIR, 27 STATUS_SUCCESS_REPLACE, 28 STATUS_FLUSH, 29 STATUS_TOO_MANY_RESULTS, 30 STATUS_SPACE_ISSUE, 31 STATUS_INVALID_USER, 32 STATUS_CERTBOT, 33 STATUS_CERTBOT_INVALID, 34 STATUS_INVALID_INPUT, 35 STATUS_NOT_RESELLER, 36 STATUS_NO_TRIALS, 37 STATUS_INSUFFICIENT_CREDITS, 38 STATUS_INVALID_PACKAGE, 39 STATUS_INVALID_TYPE, 40 STATUS_INVALID_USERNAME, 41 STATUS_INVALID_SUBRESELLER, 42 STATUS_NO_DESCRIPTION, 43 STATUS_NO_KEY, 44 STATUS_EXISTS_HMAC, 45 STATUS_CERTBOT_RUNNING, 46 STATUS_RESERVED_CODE, 47 STATUS_NO_TITLE, 48 STATUS_NO_SOURCE, 49 STATUS_PORT_IN_USE, 50 STATUS_2FA_REQUIRED, 51 STATUS_2FA_INVALID, 52 STATUS_2FA_LOCKED. A service returning nothing (false/empty) becomes STATUS_NO_PERMISSIONS. Missing/rejected key: `{"status":"STATUS_FAILURE","error":"Invalid API key."}`; unknown action: `{"status":"STATUS_FAILURE","error":"Invalid action."}`.

      **Paging and columns.** `start` (intval, default 0) and `limit` (intval, 0/absent = 50) apply to table and active-code lists. `show_columns` / `hide_columns` (comma-separated) filter the keys of `data` (single records) or of every row (lists). Table actions accept DataTables parameters (`search[value]`, `order[0][column]`, `order[0][dir]`) and answer `{status, data, recordsTotal, recordsFiltered}` without `draw`.

      **Values.** Records are raw DB rows: non-zero numbers arrive as strings, zeros/empty/null keep their PHP type; JSON columns are JSON-encoded strings; timestamps are unix seconds.

      **Reseller specifics** (src/Public/Controllers/Api/ResellerRestApiController.php). There is no per-action permission map: only the token scope is checked up front; group permissions (create_line, create_mag, create_enigma, create_sub_resellers, delete_users, allow_restrictions, allow_change_*) and ownership (you plus your sub-resellers, the `reports` list) are enforced inside each action. Creating and renewing charges credits. **Known bug:** every table action (get_lines, get_mags, get_enigmas, get_users, activity_logs, live_connections, user_logs) currently returns `{"status":"STATUS_SUCCESS","data":[]}`.
paths:
  /{reseller_access_code}/?action=packages:
    get:
      operationId: Reseller_packages
      tags:
        - Reseller API
      summary: Packages you can sell
      description: |-
        Packages of your member group that are official or trial, with `official_credits` replaced by your per-package override when set (credits as numbers). **Quirk:** show_columns/hide_columns are applied to the list, so they match list indices, not column names.

        **Token scope:** token scopes `full`, `read`, `lines` (src/Core/Auth/ApiTokens.php:106-128); legacy keys are not scope-limited.

        **Source:** `src/Public/Controllers/Api/ResellerRestApiController.php:62`, `src/Public/Controllers/Api/ResellerAPIWrapper.php:117`
      parameters:
        - $ref: '#/components/parameters/Reseller_AccessCode'
        - name: action
          in: query
          required: true
          schema:
            type: string
            enum:
              - packages
          description: Action name. May also be sent in a form-encoded POST body (POST overrides GET).
        - $ref: '#/components/parameters/Reseller_ShowColumns'
        - $ref: '#/components/parameters/Reseller_HideColumns'
      responses:
        '200':
          description: JSON reply. Errors are also returned with HTTP 200; check `status`.
          content:
            application/json:
              schema:
                anyOf:
                  - type: object
                    required:
                      - status
                    properties:
                      status:
                        $ref: '#/components/schemas/Reseller_Status'
                      data:
                        type: array
                        items:
                          $ref: '#/components/schemas/Admin_PackageRow'
                  - $ref: '#/components/schemas/Reseller_Error'
              examples:
                success:
                  summary: Success
                  value:
                    status: STATUS_SUCCESS
                    data:
                      - id: '3'
                        package_name: 1 Month
                        is_addon: 0
                        is_trial: '1'
                        is_official: '1'
                        trial_credits: 0
                        official_credits: 10
                        trial_duration: '24'
                        trial_duration_in: hours
                        official_duration: '1'
                        official_duration_in: months
                        groups: '[2]'
                        bouquets: '[1,2,5]'
                        addon_packages: '[]'
                        is_line: '1'
                        is_mag: '1'
                        is_e2: '1'
                        is_restreamer: 0
                        is_isplock: 0
                        output_formats: '[1,2]'
                        max_connections: '1'
                        force_server_id: 0
                        forced_country: ''
                        lock_device: 0
                        check_compatible: '1'
                invalid_key:
                  $ref: '#/components/examples/Reseller_InvalidKey'
                no_permissions:
                  $ref: '#/components/examples/Reseller_NoPermissions'
        '503':
          $ref: '#/components/responses/Reseller_Maintenance'
  /{reseller_access_code}/?action=user_info:
    get:
      operationId: Reseller_user_info
      tags:
        - Reseller API
      summary: Who am I
      description: |-
        Your `users` row (no `password`), with `reports` (your id plus every sub-reseller id), and your resolved reseller permissions (group flags such as create_line, create_mag, create_enigma, create_sub_resellers, delete_users, allow_restrictions, all_reports...). show_columns/hide_columns filter `data` only.

        **Token scope:** token scopes `full`, `read`, `lines` (src/Core/Auth/ApiTokens.php:106-128); legacy keys are not scope-limited.

        **Source:** `src/Public/Controllers/Api/ResellerRestApiController.php:65`, `src/Public/Controllers/Api/ResellerAPIWrapper.php:111`, `src/Public/Controllers/Api/ResellerAPIWrapper.php:89`
      parameters:
        - $ref: '#/components/parameters/Reseller_AccessCode'
        - name: action
          in: query
          required: true
          schema:
            type: string
            enum:
              - user_info
          description: Action name. May also be sent in a form-encoded POST body (POST overrides GET).
        - $ref: '#/components/parameters/Reseller_ShowColumns'
        - $ref: '#/components/parameters/Reseller_HideColumns'
      responses:
        '200':
          description: JSON reply. Errors are also returned with HTTP 200; check `status`.
          content:
            application/json:
              schema:
                anyOf:
                  - type: object
                    required:
                      - status
                    properties:
                      status:
                        $ref: '#/components/schemas/Reseller_Status'
                      data:
                        $ref: '#/components/schemas/Admin_UserRow'
                      permissions:
                        type: object
                        additionalProperties: true
                  - $ref: '#/components/schemas/Reseller_Error'
              examples:
                success:
                  summary: Success
                  value:
                    status: STATUS_SUCCESS
                    data:
                      id: '5'
                      username: reseller1
                      email: r1@example.com
                      ip: 203.0.113.10
                      date_registered: '1750000000'
                      last_login: '1760690000'
                      member_group_id: '2'
                      credits: 150
                      notes: ''
                      status: '1'
                      reseller_dns: tv.example.com
                      owner_id: '1'
                      override_packages: '[]'
                      hue: ''
                      theme: 0
                      timezone: ''
                      lang: en
                      allowed_bouquets: null
                      ui_prefs: null
                      api_key: 9f2c4e6a8b0d1f3e5a7c9b1d3f5e7a90
                      reports:
                        - 5
                        - 9
                        - 12
                    permissions:
                      group_id: '2'
                      create_line: true
                      create_mag: true
                      create_enigma: true
                      create_sub_resellers: '1'
                      delete_users: '1'
                      allow_restrictions: '1'
                      all_reports:
                        - 9
                        - 12
                invalid_key:
                  $ref: '#/components/examples/Reseller_InvalidKey'
                no_permissions:
                  $ref: '#/components/examples/Reseller_NoPermissions'
        '503':
          $ref: '#/components/responses/Reseller_Maintenance'
  /{reseller_access_code}/?action=get_line:
    get:
      operationId: Reseller_get_line
      tags:
        - Reseller API
      summary: Get a line
      description: |-
        Only lines owned by you or your sub-resellers (Authorization::check('line')); others give STATUS_FAILURE.. show_columns/hide_columns filter `data`.

        **Token scope:** token scopes `full`, `read`, `lines` (src/Core/Auth/ApiTokens.php:106-128); legacy keys are not scope-limited.

        **Source:** `src/Public/Controllers/Api/ResellerRestApiController.php:89`, `src/Public/Controllers/Api/ResellerAPIWrapper.php:140`
      parameters:
        - $ref: '#/components/parameters/Reseller_AccessCode'
        - name: action
          in: query
          required: true
          schema:
            type: string
            enum:
              - get_line
          description: Action name. May also be sent in a form-encoded POST body (POST overrides GET).
        - $ref: '#/components/parameters/Reseller_Id'
        - $ref: '#/components/parameters/Reseller_ShowColumns'
        - $ref: '#/components/parameters/Reseller_HideColumns'
      responses:
        '200':
          description: JSON reply. Errors are also returned with HTTP 200; check `status`.
          content:
            application/json:
              schema:
                anyOf:
                  - type: object
                    required:
                      - status
                    properties:
                      status:
                        $ref: '#/components/schemas/Reseller_Status'
                      data:
                        $ref: '#/components/schemas/Admin_LineRow'
                  - $ref: '#/components/schemas/Reseller_Error'
              examples:
                success:
                  summary: Success
                  value:
                    status: STATUS_SUCCESS
                    data:
                      id: '12'
                      member_id: '1'
                      username: john01
                      password: Xk29dLp0
                      last_ip: 198.51.100.23
                      exp_date: '1798761600'
                      admin_enabled: '1'
                      enabled: '1'
                      admin_notes: ''
                      reseller_notes: ''
                      bouquet: '[1,2,5]'
                      bouquet_order_custom: 0
                      allowed_outputs: '[1,2]'
                      max_connections: '1'
                      is_restreamer: 0
                      is_trial: 0
                      is_mag: 0
                      is_e2: 0
                      is_stalker: 0
                      is_isplock: 0
                      allowed_ips: '[]'
                      allowed_ua: '[]'
                      created_at: '1760600000'
                      pair_id: null
                      force_server_id: 0
                      as_number: null
                      isp_desc: ''
                      forced_country: ''
                      bypass_ua: 0
                      play_token: ''
                      last_expiration_video: null
                      package_id: '3'
                      access_token: null
                      contact: ''
                      telegram: ''
                      last_activity: '3456'
                      last_activity_array: '{"stream_id":"25","date_end":null}'
                      updated: '2026-10-16 12:00:00'
                      is_activecode: 0
                      custom_data: null
                not_found:
                  $ref: '#/components/examples/Reseller_Failure'
                invalid_key:
                  $ref: '#/components/examples/Reseller_InvalidKey'
                no_permissions:
                  $ref: '#/components/examples/Reseller_NoPermissions'
        '503':
          $ref: '#/components/responses/Reseller_Maintenance'
  /{reseller_access_code}/?action=create_line:
    post:
      operationId: Reseller_create_line
      tags:
        - Reseller API
      summary: Create a line
      description: |-
        Creates a line owned by `member_id` (default you), charging the package price. Needs group permission `create_line`. On success `data` is the stored record. Logged in users_logs.

        **Token scope:** token scopes `full`, `lines` (src/Core/Auth/ApiTokens.php:106-128); legacy keys are not scope-limited.

        **Source:** `src/Public/Controllers/Api/ResellerRestApiController.php:92`, `src/Public/Controllers/Api/ResellerAPIWrapper.php:147`, `src/Domain/User/ResellerAPI.php:1035`
      parameters:
        - $ref: '#/components/parameters/Reseller_AccessCode'
        - name: action
          in: query
          required: true
          schema:
            type: string
            enum:
              - create_line
          description: Action name. May also be sent in a form-encoded POST body (POST overrides GET).
      requestBody:
        required: true
        description: Form-encoded; the same fields are also accepted in the query string. PHP array syntax (`name[]=a&name[]=b`) is used for list fields unless a field says it is a JSON string.
        content:
          application/x-www-form-urlencoded:
            schema:
              allOf:
                - $ref: '#/components/schemas/Reseller_LineInput'
                - type: object
                  required:
                    - package
      responses:
        '200':
          description: JSON reply. Errors are also returned with HTTP 200; check `status`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Reseller_Envelope'
              examples:
                success:
                  summary: Success
                  value:
                    status: STATUS_SUCCESS
                    data:
                      id: '12'
                      member_id: '1'
                      username: john01
                      password: Xk29dLp0
                      last_ip: 198.51.100.23
                      exp_date: '1798761600'
                      admin_enabled: '1'
                      enabled: '1'
                      admin_notes: ''
                      reseller_notes: ''
                      bouquet: '[1,2,5]'
                      bouquet_order_custom: 0
                      allowed_outputs: '[1,2]'
                      max_connections: '1'
                      is_restreamer: 0
                      is_trial: 0
                      is_mag: 0
                      is_e2: 0
                      is_stalker: 0
                      is_isplock: 0
                      allowed_ips: '[]'
                      allowed_ua: '[]'
                      created_at: '1760600000'
                      pair_id: null
                      force_server_id: 0
                      as_number: null
                      isp_desc: ''
                      forced_country: ''
                      bypass_ua: 0
                      play_token: ''
                      last_expiration_video: null
                      package_id: '3'
                      access_token: null
                      contact: ''
                      telegram: ''
                      last_activity: '3456'
                      last_activity_array: '{"stream_id":"25","date_end":null}'
                      updated: '2026-10-16 12:00:00'
                      is_activecode: 0
                      custom_data: null
                credits:
                  summary: Not enough credits
                  value:
                    status: STATUS_INSUFFICIENT_CREDITS
                    data:
                      package: 3
                package:
                  summary: Package missing or not allowed
                  value:
                    status: STATUS_INVALID_PACKAGE
                    data: {}
                trials:
                  summary: Trial allowance used up
                  value:
                    status: STATUS_NO_TRIALS
                    data:
                      package: 3
                      trial: 1
                no_permission:
                  summary: Group lacks create_line (service returns false)
                  value:
                    status: STATUS_NO_PERMISSIONS
                exists:
                  summary: Username taken
                  value:
                    status: STATUS_EXISTS_USERNAME
                    data: {}
                invalid_key:
                  $ref: '#/components/examples/Reseller_InvalidKey'
                no_permissions:
                  $ref: '#/components/examples/Reseller_NoPermissions'
        '503':
          $ref: '#/components/responses/Reseller_Maintenance'
  /{reseller_access_code}/?action=edit_line:
    post:
      operationId: Reseller_edit_line
      tags:
        - Reseller API
      summary: Edit / extend a line
      description: |-
        Updates line `id`. Sending `package` renews it (charged). Unknown id = FAILURE; not yours = STATUS_NO_PERMISSIONS. Sending `isp_clear` (any value) clears the ISP lock.

        **Token scope:** token scopes `full`, `lines` (src/Core/Auth/ApiTokens.php:106-128); legacy keys are not scope-limited.

        **Source:** `src/Public/Controllers/Api/ResellerRestApiController.php:95`, `src/Public/Controllers/Api/ResellerAPIWrapper.php:158`, `src/Domain/User/ResellerAPI.php:1035`
      parameters:
        - $ref: '#/components/parameters/Reseller_AccessCode'
        - name: action
          in: query
          required: true
          schema:
            type: string
            enum:
              - edit_line
          description: Action name. May also be sent in a form-encoded POST body (POST overrides GET).
        - $ref: '#/components/parameters/Reseller_Id'
      requestBody:
        required: false
        description: Form-encoded; the same fields are also accepted in the query string. PHP array syntax (`name[]=a&name[]=b`) is used for list fields unless a field says it is a JSON string.
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/Reseller_LineInput'
      responses:
        '200':
          description: JSON reply. Errors are also returned with HTTP 200; check `status`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Reseller_Envelope'
              examples:
                success:
                  summary: Success
                  value:
                    status: STATUS_SUCCESS
                    data:
                      id: '12'
                      member_id: '1'
                      username: john01
                      password: Xk29dLp0
                      last_ip: 198.51.100.23
                      exp_date: '1798761600'
                      admin_enabled: '1'
                      enabled: '1'
                      admin_notes: ''
                      reseller_notes: ''
                      bouquet: '[1,2,5]'
                      bouquet_order_custom: 0
                      allowed_outputs: '[1,2]'
                      max_connections: '1'
                      is_restreamer: 0
                      is_trial: 0
                      is_mag: 0
                      is_e2: 0
                      is_stalker: 0
                      is_isplock: 0
                      allowed_ips: '[]'
                      allowed_ua: '[]'
                      created_at: '1760600000'
                      pair_id: null
                      force_server_id: 0
                      as_number: null
                      isp_desc: ''
                      forced_country: ''
                      bypass_ua: 0
                      play_token: ''
                      last_expiration_video: null
                      package_id: '3'
                      access_token: null
                      contact: ''
                      telegram: ''
                      last_activity: '3456'
                      last_activity_array: '{"stream_id":"25","date_end":null}'
                      updated: '2026-10-16 12:00:00'
                      is_activecode: 0
                      custom_data: null
                not_found:
                  $ref: '#/components/examples/Reseller_Failure'
                credits:
                  summary: Not enough credits
                  value:
                    status: STATUS_INSUFFICIENT_CREDITS
                    data:
                      package: 3
                package:
                  summary: Package missing or not allowed
                  value:
                    status: STATUS_INVALID_PACKAGE
                    data: {}
                trials:
                  summary: Trial allowance used up
                  value:
                    status: STATUS_NO_TRIALS
                    data:
                      package: 3
                      trial: 1
                no_permission:
                  summary: Group lacks create_line (service returns false)
                  value:
                    status: STATUS_NO_PERMISSIONS
                exists:
                  summary: Username taken
                  value:
                    status: STATUS_EXISTS_USERNAME
                    data: {}
                invalid_key:
                  $ref: '#/components/examples/Reseller_InvalidKey'
                no_permissions:
                  $ref: '#/components/examples/Reseller_NoPermissions'
        '503':
          $ref: '#/components/responses/Reseller_Maintenance'
  /{reseller_access_code}/?action=delete_line:
    post:
      operationId: Reseller_delete_line
      tags:
        - Reseller API
      summary: Delete a line
      description: |-
        Deletes the line. No refund. Needs group permission `create_line` (else STATUS_NO_PERMISSIONS). Only lines owned by you or your sub-resellers (Authorization::check('line')); others give STATUS_FAILURE.

        **Token scope:** token scopes `full`, `lines` (src/Core/Auth/ApiTokens.php:106-128); legacy keys are not scope-limited.

        **Source:** `src/Public/Controllers/Api/ResellerRestApiController.php:100`, `src/Public/Controllers/Api/ResellerAPIWrapper.php:173`
      parameters:
        - $ref: '#/components/parameters/Reseller_AccessCode'
        - name: action
          in: query
          required: true
          schema:
            type: string
            enum:
              - delete_line
          description: Action name. May also be sent in a form-encoded POST body (POST overrides GET).
        - $ref: '#/components/parameters/Reseller_Id'
      responses:
        '200':
          description: JSON reply. Errors are also returned with HTTP 200; check `status`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Reseller_Envelope'
              examples:
                success:
                  summary: Success
                  value:
                    status: STATUS_SUCCESS
                not_found:
                  $ref: '#/components/examples/Reseller_Failure'
                invalid_key:
                  $ref: '#/components/examples/Reseller_InvalidKey'
                no_permissions:
                  $ref: '#/components/examples/Reseller_NoPermissions'
        '503':
          $ref: '#/components/responses/Reseller_Maintenance'
  /{reseller_access_code}/?action=disable_line:
    post:
      operationId: Reseller_disable_line
      tags:
        - Reseller API
      summary: Disable a line
      description: |-
        Sets `enabled=0` on the line and sends the line signal. Needs group permission `create_line` (else STATUS_NO_PERMISSIONS). Only lines owned by you or your sub-resellers (Authorization::check('line')); others give STATUS_FAILURE.

        **Token scope:** token scopes `full`, `lines` (src/Core/Auth/ApiTokens.php:106-128); legacy keys are not scope-limited.

        **Source:** `src/Public/Controllers/Api/ResellerRestApiController.php:103`, `src/Public/Controllers/Api/ResellerAPIWrapper.php:186`
      parameters:
        - $ref: '#/components/parameters/Reseller_AccessCode'
        - name: action
          in: query
          required: true
          schema:
            type: string
            enum:
              - disable_line
          description: Action name. May also be sent in a form-encoded POST body (POST overrides GET).
        - $ref: '#/components/parameters/Reseller_Id'
      responses:
        '200':
          description: JSON reply. Errors are also returned with HTTP 200; check `status`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Reseller_Envelope'
              examples:
                success:
                  summary: Success
                  value:
                    status: STATUS_SUCCESS
                not_found:
                  $ref: '#/components/examples/Reseller_Failure'
                invalid_key:
                  $ref: '#/components/examples/Reseller_InvalidKey'
                no_permissions:
                  $ref: '#/components/examples/Reseller_NoPermissions'
        '503':
          $ref: '#/components/responses/Reseller_Maintenance'
  /{reseller_access_code}/?action=enable_line:
    post:
      operationId: Reseller_enable_line
      tags:
        - Reseller API
      summary: Enable a line
      description: |-
        Sets `enabled=1` and sends the line signal. FAILURE while the line still awaits activation-code redemption. Needs group permission `create_line` (else STATUS_NO_PERMISSIONS). Only lines owned by you or your sub-resellers (Authorization::check('line')); others give STATUS_FAILURE.

        **Token scope:** token scopes `full`, `lines` (src/Core/Auth/ApiTokens.php:106-128); legacy keys are not scope-limited.

        **Source:** `src/Public/Controllers/Api/ResellerRestApiController.php:106`, `src/Public/Controllers/Api/ResellerAPIWrapper.php:199`
      parameters:
        - $ref: '#/components/parameters/Reseller_AccessCode'
        - name: action
          in: query
          required: true
          schema:
            type: string
            enum:
              - enable_line
          description: Action name. May also be sent in a form-encoded POST body (POST overrides GET).
        - $ref: '#/components/parameters/Reseller_Id'
      responses:
        '200':
          description: JSON reply. Errors are also returned with HTTP 200; check `status`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Reseller_Envelope'
              examples:
                success:
                  summary: Success
                  value:
                    status: STATUS_SUCCESS
                not_found:
                  $ref: '#/components/examples/Reseller_Failure'
                invalid_key:
                  $ref: '#/components/examples/Reseller_InvalidKey'
                no_permissions:
                  $ref: '#/components/examples/Reseller_NoPermissions'
        '503':
          $ref: '#/components/responses/Reseller_Maintenance'
  /{reseller_access_code}/?action=get_mag:
    get:
      operationId: Reseller_get_mag
      tags:
        - Reseller API
      summary: Get a MAG device
      description: |-
        Only lines owned by you or your sub-resellers (Authorization::check('line')); others give STATUS_FAILURE. (`id` = device id). show_columns/hide_columns filter `data`.

        **Token scope:** token scopes `full`, `read`, `lines` (src/Core/Auth/ApiTokens.php:106-128); legacy keys are not scope-limited.

        **Source:** `src/Public/Controllers/Api/ResellerRestApiController.php:109`, `src/Public/Controllers/Api/ResellerAPIWrapper.php:214`
      parameters:
        - $ref: '#/components/parameters/Reseller_AccessCode'
        - name: action
          in: query
          required: true
          schema:
            type: string
            enum:
              - get_mag
          description: Action name. May also be sent in a form-encoded POST body (POST overrides GET).
        - $ref: '#/components/parameters/Reseller_Id'
        - $ref: '#/components/parameters/Reseller_ShowColumns'
        - $ref: '#/components/parameters/Reseller_HideColumns'
      responses:
        '200':
          description: JSON reply. Errors are also returned with HTTP 200; check `status`.
          content:
            application/json:
              schema:
                anyOf:
                  - type: object
                    required:
                      - status
                    properties:
                      status:
                        $ref: '#/components/schemas/Reseller_Status'
                      data:
                        $ref: '#/components/schemas/Admin_MagRow'
                  - $ref: '#/components/schemas/Reseller_Error'
              examples:
                success:
                  summary: Success
                  value:
                    status: STATUS_SUCCESS
                    data:
                      mag_id: '7'
                      user_id: '40'
                      mac: MDA6MUE6Nzk6MTI6MzQ6NTY=
                      ip: 198.51.100.40
                      ver: 'ImageDescription: 0.2.18-r23-250'
                      stb_type: MAG250
                      sn: ''
                      image_version: '218'
                      hw_version: 1.7-BD-00
                      device_id: ''
                      device_id2: ''
                      lock_device: 0
                      theme_type: 0
                      mac_filter: ''
                      parent_password: '0000'
                      fav_channels: '{"live":[],"movie":[],"radio_streams":[]}'
                      user:
                        id: '40'
                        member_id: '1'
                        username: mag_8f3a1c2e
                        password: b7c1e9a04d2f
                        last_ip: 198.51.100.23
                        exp_date: '1798761600'
                        admin_enabled: '1'
                        enabled: '1'
                        admin_notes: ''
                        reseller_notes: ''
                        bouquet: '[1,2,5]'
                        bouquet_order_custom: 0
                        allowed_outputs: '[1,2]'
                        max_connections: '1'
                        is_restreamer: 0
                        is_trial: 0
                        is_mag: '1'
                        is_e2: 0
                        is_stalker: 0
                        is_isplock: 0
                        allowed_ips: '[]'
                        allowed_ua: '[]'
                        created_at: '1760600000'
                        pair_id: null
                        force_server_id: 0
                        as_number: null
                        isp_desc: ''
                        forced_country: ''
                        bypass_ua: 0
                        play_token: ''
                        last_expiration_video: null
                        package_id: '3'
                        access_token: null
                        contact: ''
                        telegram: ''
                        last_activity: '3456'
                        last_activity_array: '{"stream_id":"25","date_end":null}'
                        updated: '2026-10-16 12:00:00'
                        is_activecode: 0
                        custom_data: null
                      paired: null
                not_found:
                  $ref: '#/components/examples/Reseller_Failure'
                invalid_key:
                  $ref: '#/components/examples/Reseller_InvalidKey'
                no_permissions:
                  $ref: '#/components/examples/Reseller_NoPermissions'
        '503':
          $ref: '#/components/responses/Reseller_Maintenance'
  /{reseller_access_code}/?action=create_mag:
    post:
      operationId: Reseller_create_mag
      tags:
        - Reseller API
      summary: Create a MAG device
      description: |-
        Creates a MAG device owned by `member_id` (default you), charging the package price. Needs group permission `create_mag`. On success `data` is the stored record. Logged in users_logs.

        **Token scope:** token scopes `full`, `lines` (src/Core/Auth/ApiTokens.php:106-128); legacy keys are not scope-limited.

        **Source:** `src/Public/Controllers/Api/ResellerRestApiController.php:112`, `src/Public/Controllers/Api/ResellerAPIWrapper.php:223`, `src/Domain/User/ResellerAPI.php:219`
      parameters:
        - $ref: '#/components/parameters/Reseller_AccessCode'
        - name: action
          in: query
          required: true
          schema:
            type: string
            enum:
              - create_mag
          description: Action name. May also be sent in a form-encoded POST body (POST overrides GET).
      requestBody:
        required: true
        description: Form-encoded; the same fields are also accepted in the query string. PHP array syntax (`name[]=a&name[]=b`) is used for list fields unless a field says it is a JSON string.
        content:
          application/x-www-form-urlencoded:
            schema:
              allOf:
                - $ref: '#/components/schemas/Reseller_MagInput'
                - type: object
                  required:
                    - package
                    - mac
      responses:
        '200':
          description: JSON reply. Errors are also returned with HTTP 200; check `status`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Reseller_Envelope'
              examples:
                success:
                  summary: Success
                  value:
                    status: STATUS_SUCCESS
                    data:
                      mag_id: '7'
                      user_id: '40'
                      mac: MDA6MUE6Nzk6MTI6MzQ6NTY=
                      ip: 198.51.100.40
                      ver: 'ImageDescription: 0.2.18-r23-250'
                      stb_type: MAG250
                      sn: ''
                      image_version: '218'
                      hw_version: 1.7-BD-00
                      device_id: ''
                      device_id2: ''
                      lock_device: 0
                      theme_type: 0
                      mac_filter: ''
                      parent_password: '0000'
                      fav_channels: '{"live":[],"movie":[],"radio_streams":[]}'
                      user:
                        id: '40'
                        member_id: '1'
                        username: mag_8f3a1c2e
                        password: b7c1e9a04d2f
                        last_ip: 198.51.100.23
                        exp_date: '1798761600'
                        admin_enabled: '1'
                        enabled: '1'
                        admin_notes: ''
                        reseller_notes: ''
                        bouquet: '[1,2,5]'
                        bouquet_order_custom: 0
                        allowed_outputs: '[1,2]'
                        max_connections: '1'
                        is_restreamer: 0
                        is_trial: 0
                        is_mag: '1'
                        is_e2: 0
                        is_stalker: 0
                        is_isplock: 0
                        allowed_ips: '[]'
                        allowed_ua: '[]'
                        created_at: '1760600000'
                        pair_id: null
                        force_server_id: 0
                        as_number: null
                        isp_desc: ''
                        forced_country: ''
                        bypass_ua: 0
                        play_token: ''
                        last_expiration_video: null
                        package_id: '3'
                        access_token: null
                        contact: ''
                        telegram: ''
                        last_activity: '3456'
                        last_activity_array: '{"stream_id":"25","date_end":null}'
                        updated: '2026-10-16 12:00:00'
                        is_activecode: 0
                        custom_data: null
                      paired: null
                credits:
                  summary: Not enough credits
                  value:
                    status: STATUS_INSUFFICIENT_CREDITS
                    data:
                      package: 3
                package:
                  summary: Package missing or not allowed
                  value:
                    status: STATUS_INVALID_PACKAGE
                    data: {}
                trials:
                  summary: Trial allowance used up
                  value:
                    status: STATUS_NO_TRIALS
                    data:
                      package: 3
                      trial: 1
                no_permission:
                  summary: Group lacks create_mag (service returns false)
                  value:
                    status: STATUS_NO_PERMISSIONS
                invalid_mac:
                  summary: Bad MAC
                  value:
                    status: STATUS_INVALID_MAC
                    data: {}
                exists_mac:
                  summary: MAC in use
                  value:
                    status: STATUS_EXISTS_MAC
                    data: {}
                invalid_key:
                  $ref: '#/components/examples/Reseller_InvalidKey'
                no_permissions:
                  $ref: '#/components/examples/Reseller_NoPermissions'
        '503':
          $ref: '#/components/responses/Reseller_Maintenance'
  /{reseller_access_code}/?action=edit_mag:
    post:
      operationId: Reseller_edit_mag
      tags:
        - Reseller API
      summary: Edit / extend a MAG device
      description: |-
        Updates MAG device `id`. Sending `package` renews it (charged). Unknown id = FAILURE; not yours = STATUS_NO_PERMISSIONS.

        **Token scope:** token scopes `full`, `lines` (src/Core/Auth/ApiTokens.php:106-128); legacy keys are not scope-limited.

        **Source:** `src/Public/Controllers/Api/ResellerRestApiController.php:115`, `src/Public/Controllers/Api/ResellerAPIWrapper.php:234`, `src/Domain/User/ResellerAPI.php:219`
      parameters:
        - $ref: '#/components/parameters/Reseller_AccessCode'
        - name: action
          in: query
          required: true
          schema:
            type: string
            enum:
              - edit_mag
          description: Action name. May also be sent in a form-encoded POST body (POST overrides GET).
        - $ref: '#/components/parameters/Reseller_Id'
      requestBody:
        required: false
        description: Form-encoded; the same fields are also accepted in the query string. PHP array syntax (`name[]=a&name[]=b`) is used for list fields unless a field says it is a JSON string.
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/Reseller_MagInput'
      responses:
        '200':
          description: JSON reply. Errors are also returned with HTTP 200; check `status`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Reseller_Envelope'
              examples:
                success:
                  summary: Success
                  value:
                    status: STATUS_SUCCESS
                    data:
                      mag_id: '7'
                      user_id: '40'
                      mac: MDA6MUE6Nzk6MTI6MzQ6NTY=
                      ip: 198.51.100.40
                      ver: 'ImageDescription: 0.2.18-r23-250'
                      stb_type: MAG250
                      sn: ''
                      image_version: '218'
                      hw_version: 1.7-BD-00
                      device_id: ''
                      device_id2: ''
                      lock_device: 0
                      theme_type: 0
                      mac_filter: ''
                      parent_password: '0000'
                      fav_channels: '{"live":[],"movie":[],"radio_streams":[]}'
                      user:
                        id: '40'
                        member_id: '1'
                        username: mag_8f3a1c2e
                        password: b7c1e9a04d2f
                        last_ip: 198.51.100.23
                        exp_date: '1798761600'
                        admin_enabled: '1'
                        enabled: '1'
                        admin_notes: ''
                        reseller_notes: ''
                        bouquet: '[1,2,5]'
                        bouquet_order_custom: 0
                        allowed_outputs: '[1,2]'
                        max_connections: '1'
                        is_restreamer: 0
                        is_trial: 0
                        is_mag: '1'
                        is_e2: 0
                        is_stalker: 0
                        is_isplock: 0
                        allowed_ips: '[]'
                        allowed_ua: '[]'
                        created_at: '1760600000'
                        pair_id: null
                        force_server_id: 0
                        as_number: null
                        isp_desc: ''
                        forced_country: ''
                        bypass_ua: 0
                        play_token: ''
                        last_expiration_video: null
                        package_id: '3'
                        access_token: null
                        contact: ''
                        telegram: ''
                        last_activity: '3456'
                        last_activity_array: '{"stream_id":"25","date_end":null}'
                        updated: '2026-10-16 12:00:00'
                        is_activecode: 0
                        custom_data: null
                      paired: null
                not_found:
                  $ref: '#/components/examples/Reseller_Failure'
                credits:
                  summary: Not enough credits
                  value:
                    status: STATUS_INSUFFICIENT_CREDITS
                    data:
                      package: 3
                package:
                  summary: Package missing or not allowed
                  value:
                    status: STATUS_INVALID_PACKAGE
                    data: {}
                trials:
                  summary: Trial allowance used up
                  value:
                    status: STATUS_NO_TRIALS
                    data:
                      package: 3
                      trial: 1
                no_permission:
                  summary: Group lacks create_mag (service returns false)
                  value:
                    status: STATUS_NO_PERMISSIONS
                invalid_mac:
                  summary: Bad MAC
                  value:
                    status: STATUS_INVALID_MAC
                    data: {}
                exists_mac:
                  summary: MAC in use
                  value:
                    status: STATUS_EXISTS_MAC
                    data: {}
                invalid_key:
                  $ref: '#/components/examples/Reseller_InvalidKey'
                no_permissions:
                  $ref: '#/components/examples/Reseller_NoPermissions'
        '503':
          $ref: '#/components/responses/Reseller_Maintenance'
  /{reseller_access_code}/?action=delete_mag:
    post:
      operationId: Reseller_delete_mag
      tags:
        - Reseller API
      summary: Delete a MAG device
      description: |-
        Deletes the MAG device and its backing line. No refund. Needs group permission `create_mag` (else STATUS_NO_PERMISSIONS). Only lines owned by you or your sub-resellers (Authorization::check('line')); others give STATUS_FAILURE.

        **Token scope:** token scopes `full`, `lines` (src/Core/Auth/ApiTokens.php:106-128); legacy keys are not scope-limited.

        **Source:** `src/Public/Controllers/Api/ResellerRestApiController.php:120`, `src/Public/Controllers/Api/ResellerAPIWrapper.php:249`
      parameters:
        - $ref: '#/components/parameters/Reseller_AccessCode'
        - name: action
          in: query
          required: true
          schema:
            type: string
            enum:
              - delete_mag
          description: Action name. May also be sent in a form-encoded POST body (POST overrides GET).
        - $ref: '#/components/parameters/Reseller_Id'
      responses:
        '200':
          description: JSON reply. Errors are also returned with HTTP 200; check `status`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Reseller_Envelope'
              examples:
                success:
                  summary: Success
                  value:
                    status: STATUS_SUCCESS
                not_found:
                  $ref: '#/components/examples/Reseller_Failure'
                invalid_key:
                  $ref: '#/components/examples/Reseller_InvalidKey'
                no_permissions:
                  $ref: '#/components/examples/Reseller_NoPermissions'
        '503':
          $ref: '#/components/responses/Reseller_Maintenance'
  /{reseller_access_code}/?action=disable_mag:
    post:
      operationId: Reseller_disable_mag
      tags:
        - Reseller API
      summary: Disable a MAG device
      description: |-
        Sets `enabled=0` on the line and sends the line signal. Needs group permission `create_mag` (else STATUS_NO_PERMISSIONS). Only lines owned by you or your sub-resellers (Authorization::check('line')); others give STATUS_FAILURE.

        **Token scope:** token scopes `full`, `lines` (src/Core/Auth/ApiTokens.php:106-128); legacy keys are not scope-limited.

        **Source:** `src/Public/Controllers/Api/ResellerRestApiController.php:123`, `src/Public/Controllers/Api/ResellerAPIWrapper.php:262`
      parameters:
        - $ref: '#/components/parameters/Reseller_AccessCode'
        - name: action
          in: query
          required: true
          schema:
            type: string
            enum:
              - disable_mag
          description: Action name. May also be sent in a form-encoded POST body (POST overrides GET).
        - $ref: '#/components/parameters/Reseller_Id'
      responses:
        '200':
          description: JSON reply. Errors are also returned with HTTP 200; check `status`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Reseller_Envelope'
              examples:
                success:
                  summary: Success
                  value:
                    status: STATUS_SUCCESS
                not_found:
                  $ref: '#/components/examples/Reseller_Failure'
                invalid_key:
                  $ref: '#/components/examples/Reseller_InvalidKey'
                no_permissions:
                  $ref: '#/components/examples/Reseller_NoPermissions'
        '503':
          $ref: '#/components/responses/Reseller_Maintenance'
  /{reseller_access_code}/?action=enable_mag:
    post:
      operationId: Reseller_enable_mag
      tags:
        - Reseller API
      summary: Enable a MAG device
      description: |-
        Sets `enabled=1` and sends the line signal. FAILURE while the line still awaits activation-code redemption. Needs group permission `create_mag` (else STATUS_NO_PERMISSIONS). Only lines owned by you or your sub-resellers (Authorization::check('line')); others give STATUS_FAILURE.

        **Token scope:** token scopes `full`, `lines` (src/Core/Auth/ApiTokens.php:106-128); legacy keys are not scope-limited.

        **Source:** `src/Public/Controllers/Api/ResellerRestApiController.php:126`, `src/Public/Controllers/Api/ResellerAPIWrapper.php:275`
      parameters:
        - $ref: '#/components/parameters/Reseller_AccessCode'
        - name: action
          in: query
          required: true
          schema:
            type: string
            enum:
              - enable_mag
          description: Action name. May also be sent in a form-encoded POST body (POST overrides GET).
        - $ref: '#/components/parameters/Reseller_Id'
      responses:
        '200':
          description: JSON reply. Errors are also returned with HTTP 200; check `status`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Reseller_Envelope'
              examples:
                success:
                  summary: Success
                  value:
                    status: STATUS_SUCCESS
                not_found:
                  $ref: '#/components/examples/Reseller_Failure'
                invalid_key:
                  $ref: '#/components/examples/Reseller_InvalidKey'
                no_permissions:
                  $ref: '#/components/examples/Reseller_NoPermissions'
        '503':
          $ref: '#/components/responses/Reseller_Maintenance'
  /{reseller_access_code}/?action=convert_mag:
    post:
      operationId: Reseller_convert_mag
      tags:
        - Reseller API
      summary: Convert a MAG device to a plain line
      description: |-
        Deletes the device but keeps its line. Unlike the admin API, `data` is the line row itself (not nested). Needs group permission `create_mag` (else STATUS_NO_PERMISSIONS). Only lines owned by you or your sub-resellers (Authorization::check('line')); others give STATUS_FAILURE.

        **Token scope:** token scopes `full`, `lines` (src/Core/Auth/ApiTokens.php:106-128); legacy keys are not scope-limited.

        **Source:** `src/Public/Controllers/Api/ResellerRestApiController.php:129`, `src/Public/Controllers/Api/ResellerAPIWrapper.php:289`
      parameters:
        - $ref: '#/components/parameters/Reseller_AccessCode'
        - name: action
          in: query
          required: true
          schema:
            type: string
            enum:
              - convert_mag
          description: Action name. May also be sent in a form-encoded POST body (POST overrides GET).
        - $ref: '#/components/parameters/Reseller_Id'
      responses:
        '200':
          description: JSON reply. Errors are also returned with HTTP 200; check `status`.
          content:
            application/json:
              schema:
                anyOf:
                  - type: object
                    required:
                      - status
                    properties:
                      status:
                        $ref: '#/components/schemas/Reseller_Status'
                      data:
                        $ref: '#/components/schemas/Admin_LineRow'
                  - $ref: '#/components/schemas/Reseller_Error'
              examples:
                success:
                  summary: Success
                  value:
                    status: STATUS_SUCCESS
                    data:
                      id: '40'
                      member_id: '1'
                      username: mag_8f3a1c2e
                      password: b7c1e9a04d2f
                      last_ip: 198.51.100.23
                      exp_date: '1798761600'
                      admin_enabled: '1'
                      enabled: '1'
                      admin_notes: ''
                      reseller_notes: ''
                      bouquet: '[1,2,5]'
                      bouquet_order_custom: 0
                      allowed_outputs: '[1,2]'
                      max_connections: '1'
                      is_restreamer: 0
                      is_trial: 0
                      is_mag: 0
                      is_e2: 0
                      is_stalker: 0
                      is_isplock: 0
                      allowed_ips: '[]'
                      allowed_ua: '[]'
                      created_at: '1760600000'
                      pair_id: null
                      force_server_id: 0
                      as_number: null
                      isp_desc: ''
                      forced_country: ''
                      bypass_ua: 0
                      play_token: ''
                      last_expiration_video: null
                      package_id: '3'
                      access_token: null
                      contact: ''
                      telegram: ''
                      last_activity: '3456'
                      last_activity_array: '{"stream_id":"25","date_end":null}'
                      updated: '2026-10-16 12:00:00'
                      is_activecode: 0
                      custom_data: null
                not_found:
                  $ref: '#/components/examples/Reseller_Failure'
                invalid_key:
                  $ref: '#/components/examples/Reseller_InvalidKey'
                no_permissions:
                  $ref: '#/components/examples/Reseller_NoPermissions'
        '503':
          $ref: '#/components/responses/Reseller_Maintenance'
  /{reseller_access_code}/?action=get_enigma:
    get:
      operationId: Reseller_get_enigma
      tags:
        - Reseller API
      summary: Get a Enigma2 device
      description: |-
        Only lines owned by you or your sub-resellers (Authorization::check('line')); others give STATUS_FAILURE. (`id` = device id). show_columns/hide_columns filter `data`.

        **Token scope:** token scopes `full`, `read`, `lines` (src/Core/Auth/ApiTokens.php:106-128); legacy keys are not scope-limited.

        **Source:** `src/Public/Controllers/Api/ResellerRestApiController.php:132`, `src/Public/Controllers/Api/ResellerAPIWrapper.php:302`
      parameters:
        - $ref: '#/components/parameters/Reseller_AccessCode'
        - name: action
          in: query
          required: true
          schema:
            type: string
            enum:
              - get_enigma
          description: Action name. May also be sent in a form-encoded POST body (POST overrides GET).
        - $ref: '#/components/parameters/Reseller_Id'
        - $ref: '#/components/parameters/Reseller_ShowColumns'
        - $ref: '#/components/parameters/Reseller_HideColumns'
      responses:
        '200':
          description: JSON reply. Errors are also returned with HTTP 200; check `status`.
          content:
            application/json:
              schema:
                anyOf:
                  - type: object
                    required:
                      - status
                    properties:
                      status:
                        $ref: '#/components/schemas/Reseller_Status'
                      data:
                        $ref: '#/components/schemas/Admin_EnigmaRow'
                  - $ref: '#/components/schemas/Reseller_Error'
              examples:
                success:
                  summary: Success
                  value:
                    status: STATUS_SUCCESS
                    data:
                      device_id: '3'
                      mac: 00:1D:EC:0A:1B:2C
                      user_id: '41'
                      modem_mac: ''
                      local_ip: 192.168.1.20
                      public_ip: 198.51.100.41
                      key_auth: ''
                      enigma_version: OpenATV 7.4
                      cpu: BCM7252S
                      version: ''
                      lversion: ''
                      token: ''
                      last_updated: '1760690000'
                      watchdog_timeout: '10'
                      lock_device: 0
                      telnet_enable: 0
                      ftp_enable: 0
                      ssh_enable: 0
                      dns: ''
                      original_mac: ''
                      rc: 0
                      mac_filter: ''
                      user:
                        id: '41'
                        member_id: '1'
                        username: e2_51c0aa9f
                        password: 0d9e1c7b6a52
                        last_ip: 198.51.100.23
                        exp_date: '1798761600'
                        admin_enabled: '1'
                        enabled: '1'
                        admin_notes: ''
                        reseller_notes: ''
                        bouquet: '[1,2,5]'
                        bouquet_order_custom: 0
                        allowed_outputs: '[1,2]'
                        max_connections: '1'
                        is_restreamer: 0
                        is_trial: 0
                        is_mag: 0
                        is_e2: '1'
                        is_stalker: 0
                        is_isplock: 0
                        allowed_ips: '[]'
                        allowed_ua: '[]'
                        created_at: '1760600000'
                        pair_id: null
                        force_server_id: 0
                        as_number: null
                        isp_desc: ''
                        forced_country: ''
                        bypass_ua: 0
                        play_token: ''
                        last_expiration_video: null
                        package_id: '3'
                        access_token: null
                        contact: ''
                        telegram: ''
                        last_activity: '3456'
                        last_activity_array: '{"stream_id":"25","date_end":null}'
                        updated: '2026-10-16 12:00:00'
                        is_activecode: 0
                        custom_data: null
                      paired: null
                not_found:
                  $ref: '#/components/examples/Reseller_Failure'
                invalid_key:
                  $ref: '#/components/examples/Reseller_InvalidKey'
                no_permissions:
                  $ref: '#/components/examples/Reseller_NoPermissions'
        '503':
          $ref: '#/components/responses/Reseller_Maintenance'
  /{reseller_access_code}/?action=create_enigma:
    post:
      operationId: Reseller_create_enigma
      tags:
        - Reseller API
      summary: Create a Enigma2 device
      description: |-
        Creates a Enigma2 device owned by `member_id` (default you), charging the package price. Needs group permission `create_enigma`. On success `data` is the stored record. Logged in users_logs.

        **Token scope:** token scopes `full`, `lines` (src/Core/Auth/ApiTokens.php:106-128); legacy keys are not scope-limited.

        **Source:** `src/Public/Controllers/Api/ResellerRestApiController.php:135`, `src/Public/Controllers/Api/ResellerAPIWrapper.php:311`, `src/Domain/User/ResellerAPI.php:522`
      parameters:
        - $ref: '#/components/parameters/Reseller_AccessCode'
        - name: action
          in: query
          required: true
          schema:
            type: string
            enum:
              - create_enigma
          description: Action name. May also be sent in a form-encoded POST body (POST overrides GET).
      requestBody:
        required: true
        description: Form-encoded; the same fields are also accepted in the query string. PHP array syntax (`name[]=a&name[]=b`) is used for list fields unless a field says it is a JSON string.
        content:
          application/x-www-form-urlencoded:
            schema:
              allOf:
                - $ref: '#/components/schemas/Reseller_EnigmaInput'
                - type: object
                  required:
                    - package
                    - mac
      responses:
        '200':
          description: JSON reply. Errors are also returned with HTTP 200; check `status`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Reseller_Envelope'
              examples:
                success:
                  summary: Success
                  value:
                    status: STATUS_SUCCESS
                    data:
                      device_id: '3'
                      mac: 00:1D:EC:0A:1B:2C
                      user_id: '41'
                      modem_mac: ''
                      local_ip: 192.168.1.20
                      public_ip: 198.51.100.41
                      key_auth: ''
                      enigma_version: OpenATV 7.4
                      cpu: BCM7252S
                      version: ''
                      lversion: ''
                      token: ''
                      last_updated: '1760690000'
                      watchdog_timeout: '10'
                      lock_device: 0
                      telnet_enable: 0
                      ftp_enable: 0
                      ssh_enable: 0
                      dns: ''
                      original_mac: ''
                      rc: 0
                      mac_filter: ''
                      user:
                        id: '41'
                        member_id: '1'
                        username: e2_51c0aa9f
                        password: 0d9e1c7b6a52
                        last_ip: 198.51.100.23
                        exp_date: '1798761600'
                        admin_enabled: '1'
                        enabled: '1'
                        admin_notes: ''
                        reseller_notes: ''
                        bouquet: '[1,2,5]'
                        bouquet_order_custom: 0
                        allowed_outputs: '[1,2]'
                        max_connections: '1'
                        is_restreamer: 0
                        is_trial: 0
                        is_mag: 0
                        is_e2: '1'
                        is_stalker: 0
                        is_isplock: 0
                        allowed_ips: '[]'
                        allowed_ua: '[]'
                        created_at: '1760600000'
                        pair_id: null
                        force_server_id: 0
                        as_number: null
                        isp_desc: ''
                        forced_country: ''
                        bypass_ua: 0
                        play_token: ''
                        last_expiration_video: null
                        package_id: '3'
                        access_token: null
                        contact: ''
                        telegram: ''
                        last_activity: '3456'
                        last_activity_array: '{"stream_id":"25","date_end":null}'
                        updated: '2026-10-16 12:00:00'
                        is_activecode: 0
                        custom_data: null
                      paired: null
                credits:
                  summary: Not enough credits
                  value:
                    status: STATUS_INSUFFICIENT_CREDITS
                    data:
                      package: 3
                package:
                  summary: Package missing or not allowed
                  value:
                    status: STATUS_INVALID_PACKAGE
                    data: {}
                trials:
                  summary: Trial allowance used up
                  value:
                    status: STATUS_NO_TRIALS
                    data:
                      package: 3
                      trial: 1
                no_permission:
                  summary: Group lacks create_enigma (service returns false)
                  value:
                    status: STATUS_NO_PERMISSIONS
                invalid_mac:
                  summary: Bad MAC
                  value:
                    status: STATUS_INVALID_MAC
                    data: {}
                exists_mac:
                  summary: MAC in use
                  value:
                    status: STATUS_EXISTS_MAC
                    data: {}
                invalid_key:
                  $ref: '#/components/examples/Reseller_InvalidKey'
                no_permissions:
                  $ref: '#/components/examples/Reseller_NoPermissions'
        '503':
          $ref: '#/components/responses/Reseller_Maintenance'
  /{reseller_access_code}/?action=edit_enigma:
    post:
      operationId: Reseller_edit_enigma
      tags:
        - Reseller API
      summary: Edit / extend a Enigma2 device
      description: |-
        Updates Enigma2 device `id`. Sending `package` renews it (charged). Unknown id = FAILURE; not yours = STATUS_NO_PERMISSIONS.

        **Token scope:** token scopes `full`, `lines` (src/Core/Auth/ApiTokens.php:106-128); legacy keys are not scope-limited.

        **Source:** `src/Public/Controllers/Api/ResellerRestApiController.php:138`, `src/Public/Controllers/Api/ResellerAPIWrapper.php:322`, `src/Domain/User/ResellerAPI.php:522`
      parameters:
        - $ref: '#/components/parameters/Reseller_AccessCode'
        - name: action
          in: query
          required: true
          schema:
            type: string
            enum:
              - edit_enigma
          description: Action name. May also be sent in a form-encoded POST body (POST overrides GET).
        - $ref: '#/components/parameters/Reseller_Id'
      requestBody:
        required: false
        description: Form-encoded; the same fields are also accepted in the query string. PHP array syntax (`name[]=a&name[]=b`) is used for list fields unless a field says it is a JSON string.
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/Reseller_EnigmaInput'
      responses:
        '200':
          description: JSON reply. Errors are also returned with HTTP 200; check `status`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Reseller_Envelope'
              examples:
                success:
                  summary: Success
                  value:
                    status: STATUS_SUCCESS
                    data:
                      device_id: '3'
                      mac: 00:1D:EC:0A:1B:2C
                      user_id: '41'
                      modem_mac: ''
                      local_ip: 192.168.1.20
                      public_ip: 198.51.100.41
                      key_auth: ''
                      enigma_version: OpenATV 7.4
                      cpu: BCM7252S
                      version: ''
                      lversion: ''
                      token: ''
                      last_updated: '1760690000'
                      watchdog_timeout: '10'
                      lock_device: 0
                      telnet_enable: 0
                      ftp_enable: 0
                      ssh_enable: 0
                      dns: ''
                      original_mac: ''
                      rc: 0
                      mac_filter: ''
                      user:
                        id: '41'
                        member_id: '1'
                        username: e2_51c0aa9f
                        password: 0d9e1c7b6a52
                        last_ip: 198.51.100.23
                        exp_date: '1798761600'
                        admin_enabled: '1'
                        enabled: '1'
                        admin_notes: ''
                        reseller_notes: ''
                        bouquet: '[1,2,5]'
                        bouquet_order_custom: 0
                        allowed_outputs: '[1,2]'
                        max_connections: '1'
                        is_restreamer: 0
                        is_trial: 0
                        is_mag: 0
                        is_e2: '1'
                        is_stalker: 0
                        is_isplock: 0
                        allowed_ips: '[]'
                        allowed_ua: '[]'
                        created_at: '1760600000'
                        pair_id: null
                        force_server_id: 0
                        as_number: null
                        isp_desc: ''
                        forced_country: ''
                        bypass_ua: 0
                        play_token: ''
                        last_expiration_video: null
                        package_id: '3'
                        access_token: null
                        contact: ''
                        telegram: ''
                        last_activity: '3456'
                        last_activity_array: '{"stream_id":"25","date_end":null}'
                        updated: '2026-10-16 12:00:00'
                        is_activecode: 0
                        custom_data: null
                      paired: null
                not_found:
                  $ref: '#/components/examples/Reseller_Failure'
                credits:
                  summary: Not enough credits
                  value:
                    status: STATUS_INSUFFICIENT_CREDITS
                    data:
                      package: 3
                package:
                  summary: Package missing or not allowed
                  value:
                    status: STATUS_INVALID_PACKAGE
                    data: {}
                trials:
                  summary: Trial allowance used up
                  value:
                    status: STATUS_NO_TRIALS
                    data:
                      package: 3
                      trial: 1
                no_permission:
                  summary: Group lacks create_enigma (service returns false)
                  value:
                    status: STATUS_NO_PERMISSIONS
                invalid_mac:
                  summary: Bad MAC
                  value:
                    status: STATUS_INVALID_MAC
                    data: {}
                exists_mac:
                  summary: MAC in use
                  value:
                    status: STATUS_EXISTS_MAC
                    data: {}
                invalid_key:
                  $ref: '#/components/examples/Reseller_InvalidKey'
                no_permissions:
                  $ref: '#/components/examples/Reseller_NoPermissions'
        '503':
          $ref: '#/components/responses/Reseller_Maintenance'
  /{reseller_access_code}/?action=delete_enigma:
    post:
      operationId: Reseller_delete_enigma
      tags:
        - Reseller API
      summary: Delete a Enigma2 device
      description: |-
        Deletes the Enigma2 device and its backing line. No refund. Needs group permission `create_enigma` (else STATUS_NO_PERMISSIONS). Only lines owned by you or your sub-resellers (Authorization::check('line')); others give STATUS_FAILURE.

        **Token scope:** token scopes `full`, `lines` (src/Core/Auth/ApiTokens.php:106-128); legacy keys are not scope-limited.

        **Source:** `src/Public/Controllers/Api/ResellerRestApiController.php:143`, `src/Public/Controllers/Api/ResellerAPIWrapper.php:337`
      parameters:
        - $ref: '#/components/parameters/Reseller_AccessCode'
        - name: action
          in: query
          required: true
          schema:
            type: string
            enum:
              - delete_enigma
          description: Action name. May also be sent in a form-encoded POST body (POST overrides GET).
        - $ref: '#/components/parameters/Reseller_Id'
      responses:
        '200':
          description: JSON reply. Errors are also returned with HTTP 200; check `status`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Reseller_Envelope'
              examples:
                success:
                  summary: Success
                  value:
                    status: STATUS_SUCCESS
                not_found:
                  $ref: '#/components/examples/Reseller_Failure'
                invalid_key:
                  $ref: '#/components/examples/Reseller_InvalidKey'
                no_permissions:
                  $ref: '#/components/examples/Reseller_NoPermissions'
        '503':
          $ref: '#/components/responses/Reseller_Maintenance'
  /{reseller_access_code}/?action=disable_enigma:
    post:
      operationId: Reseller_disable_enigma
      tags:
        - Reseller API
      summary: Disable a Enigma2 device
      description: |-
        Sets `enabled=0` on the line and sends the line signal. Needs group permission `create_enigma` (else STATUS_NO_PERMISSIONS). Only lines owned by you or your sub-resellers (Authorization::check('line')); others give STATUS_FAILURE.

        **Token scope:** token scopes `full`, `lines` (src/Core/Auth/ApiTokens.php:106-128); legacy keys are not scope-limited.

        **Source:** `src/Public/Controllers/Api/ResellerRestApiController.php:146`, `src/Public/Controllers/Api/ResellerAPIWrapper.php:350`
      parameters:
        - $ref: '#/components/parameters/Reseller_AccessCode'
        - name: action
          in: query
          required: true
          schema:
            type: string
            enum:
              - disable_enigma
          description: Action name. May also be sent in a form-encoded POST body (POST overrides GET).
        - $ref: '#/components/parameters/Reseller_Id'
      responses:
        '200':
          description: JSON reply. Errors are also returned with HTTP 200; check `status`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Reseller_Envelope'
              examples:
                success:
                  summary: Success
                  value:
                    status: STATUS_SUCCESS
                not_found:
                  $ref: '#/components/examples/Reseller_Failure'
                invalid_key:
                  $ref: '#/components/examples/Reseller_InvalidKey'
                no_permissions:
                  $ref: '#/components/examples/Reseller_NoPermissions'
        '503':
          $ref: '#/components/responses/Reseller_Maintenance'
  /{reseller_access_code}/?action=enable_enigma:
    post:
      operationId: Reseller_enable_enigma
      tags:
        - Reseller API
      summary: Enable a Enigma2 device
      description: |-
        Sets `enabled=1` and sends the line signal. FAILURE while the line still awaits activation-code redemption. Needs group permission `create_enigma` (else STATUS_NO_PERMISSIONS). Only lines owned by you or your sub-resellers (Authorization::check('line')); others give STATUS_FAILURE.

        **Token scope:** token scopes `full`, `lines` (src/Core/Auth/ApiTokens.php:106-128); legacy keys are not scope-limited.

        **Source:** `src/Public/Controllers/Api/ResellerRestApiController.php:149`, `src/Public/Controllers/Api/ResellerAPIWrapper.php:363`
      parameters:
        - $ref: '#/components/parameters/Reseller_AccessCode'
        - name: action
          in: query
          required: true
          schema:
            type: string
            enum:
              - enable_enigma
          description: Action name. May also be sent in a form-encoded POST body (POST overrides GET).
        - $ref: '#/components/parameters/Reseller_Id'
      responses:
        '200':
          description: JSON reply. Errors are also returned with HTTP 200; check `status`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Reseller_Envelope'
              examples:
                success:
                  summary: Success
                  value:
                    status: STATUS_SUCCESS
                not_found:
                  $ref: '#/components/examples/Reseller_Failure'
                invalid_key:
                  $ref: '#/components/examples/Reseller_InvalidKey'
                no_permissions:
                  $ref: '#/components/examples/Reseller_NoPermissions'
        '503':
          $ref: '#/components/responses/Reseller_Maintenance'
  /{reseller_access_code}/?action=convert_enigma:
    post:
      operationId: Reseller_convert_enigma
      tags:
        - Reseller API
      summary: Convert a Enigma2 device to a plain line
      description: |-
        Deletes the device but keeps its line. Unlike the admin API, `data` is the line row itself (not nested). Needs group permission `create_enigma` (else STATUS_NO_PERMISSIONS). Only lines owned by you or your sub-resellers (Authorization::check('line')); others give STATUS_FAILURE.

        **Token scope:** token scopes `full`, `lines` (src/Core/Auth/ApiTokens.php:106-128); legacy keys are not scope-limited.

        **Source:** `src/Public/Controllers/Api/ResellerRestApiController.php:152`, `src/Public/Controllers/Api/ResellerAPIWrapper.php:377`
      parameters:
        - $ref: '#/components/parameters/Reseller_AccessCode'
        - name: action
          in: query
          required: true
          schema:
            type: string
            enum:
              - convert_enigma
          description: Action name. May also be sent in a form-encoded POST body (POST overrides GET).
        - $ref: '#/components/parameters/Reseller_Id'
      responses:
        '200':
          description: JSON reply. Errors are also returned with HTTP 200; check `status`.
          content:
            application/json:
              schema:
                anyOf:
                  - type: object
                    required:
                      - status
                    properties:
                      status:
                        $ref: '#/components/schemas/Reseller_Status'
                      data:
                        $ref: '#/components/schemas/Admin_LineRow'
                  - $ref: '#/components/schemas/Reseller_Error'
              examples:
                success:
                  summary: Success
                  value:
                    status: STATUS_SUCCESS
                    data:
                      id: '41'
                      member_id: '1'
                      username: e2_51c0aa9f
                      password: 0d9e1c7b6a52
                      last_ip: 198.51.100.23
                      exp_date: '1798761600'
                      admin_enabled: '1'
                      enabled: '1'
                      admin_notes: ''
                      reseller_notes: ''
                      bouquet: '[1,2,5]'
                      bouquet_order_custom: 0
                      allowed_outputs: '[1,2]'
                      max_connections: '1'
                      is_restreamer: 0
                      is_trial: 0
                      is_mag: 0
                      is_e2: 0
                      is_stalker: 0
                      is_isplock: 0
                      allowed_ips: '[]'
                      allowed_ua: '[]'
                      created_at: '1760600000'
                      pair_id: null
                      force_server_id: 0
                      as_number: null
                      isp_desc: ''
                      forced_country: ''
                      bypass_ua: 0
                      play_token: ''
                      last_expiration_video: null
                      package_id: '3'
                      access_token: null
                      contact: ''
                      telegram: ''
                      last_activity: '3456'
                      last_activity_array: '{"stream_id":"25","date_end":null}'
                      updated: '2026-10-16 12:00:00'
                      is_activecode: 0
                      custom_data: null
                not_found:
                  $ref: '#/components/examples/Reseller_Failure'
                invalid_key:
                  $ref: '#/components/examples/Reseller_InvalidKey'
                no_permissions:
                  $ref: '#/components/examples/Reseller_NoPermissions'
        '503':
          $ref: '#/components/responses/Reseller_Maintenance'
  /{reseller_access_code}/?action=get_user:
    get:
      operationId: Reseller_get_user
      tags:
        - Reseller API
      summary: Get a sub-reseller
      description: |-
        Only you and your sub-resellers are visible (Authorization::check('user')). `password` and `api_key` are always removed.

        **Token scope:** token scopes `full`, `read` (src/Core/Auth/ApiTokens.php:106-128); legacy keys are not scope-limited.

        **Source:** `src/Public/Controllers/Api/ResellerRestApiController.php:155`, `src/Public/Controllers/Api/ResellerAPIWrapper.php:390`
      parameters:
        - $ref: '#/components/parameters/Reseller_AccessCode'
        - name: action
          in: query
          required: true
          schema:
            type: string
            enum:
              - get_user
          description: Action name. May also be sent in a form-encoded POST body (POST overrides GET).
        - $ref: '#/components/parameters/Reseller_Id'
        - $ref: '#/components/parameters/Reseller_ShowColumns'
        - $ref: '#/components/parameters/Reseller_HideColumns'
      responses:
        '200':
          description: JSON reply. Errors are also returned with HTTP 200; check `status`.
          content:
            application/json:
              schema:
                anyOf:
                  - type: object
                    required:
                      - status
                    properties:
                      status:
                        $ref: '#/components/schemas/Reseller_Status'
                      data:
                        $ref: '#/components/schemas/Admin_UserRow'
                  - $ref: '#/components/schemas/Reseller_Error'
              examples:
                success:
                  summary: Success
                  value:
                    status: STATUS_SUCCESS
                    data:
                      id: '9'
                      username: subres1
                      email: r1@example.com
                      ip: 203.0.113.10
                      date_registered: '1750000000'
                      last_login: '1760690000'
                      member_group_id: '3'
                      credits: 0
                      notes: ''
                      status: '1'
                      reseller_dns: tv.example.com
                      owner_id: '5'
                      override_packages: '[]'
                      hue: ''
                      theme: 0
                      timezone: ''
                      lang: en
                      allowed_bouquets: null
                      ui_prefs: null
                not_found:
                  $ref: '#/components/examples/Reseller_Failure'
                invalid_key:
                  $ref: '#/components/examples/Reseller_InvalidKey'
                no_permissions:
                  $ref: '#/components/examples/Reseller_NoPermissions'
        '503':
          $ref: '#/components/responses/Reseller_Maintenance'
  /{reseller_access_code}/?action=create_user:
    post:
      operationId: Reseller_create_user
      tags:
        - Reseller API
      summary: Create a sub-reseller
      description: |-
        Creates a sub-reseller in one of your group's allowed sub-groups, charging create_sub_resellers_price. Needs create_sub_resellers (else STATUS_NO_PERMISSIONS).

        **Token scope:** token scopes `full` (src/Core/Auth/ApiTokens.php:106-128); legacy keys are not scope-limited.

        **Source:** `src/Public/Controllers/Api/ResellerRestApiController.php:158`, `src/Public/Controllers/Api/ResellerAPIWrapper.php:400`, `src/Domain/User/ResellerAPI.php:810`
      parameters:
        - $ref: '#/components/parameters/Reseller_AccessCode'
        - name: action
          in: query
          required: true
          schema:
            type: string
            enum:
              - create_user
          description: Action name. May also be sent in a form-encoded POST body (POST overrides GET).
      requestBody:
        required: true
        description: Form-encoded; the same fields are also accepted in the query string. PHP array syntax (`name[]=a&name[]=b`) is used for list fields unless a field says it is a JSON string.
        content:
          application/x-www-form-urlencoded:
            schema:
              allOf:
                - $ref: '#/components/schemas/Reseller_UserInput'
                - type: object
                  required:
                    - username
                    - password
                    - member_group_id
      responses:
        '200':
          description: JSON reply. Errors are also returned with HTTP 200; check `status`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Reseller_Envelope'
              examples:
                success:
                  summary: Success
                  value:
                    status: STATUS_SUCCESS
                    data:
                      id: '9'
                      username: subres1
                      email: r1@example.com
                      ip: 203.0.113.10
                      date_registered: '1750000000'
                      last_login: '1760690000'
                      member_group_id: '3'
                      credits: 0
                      notes: ''
                      status: '1'
                      reseller_dns: tv.example.com
                      owner_id: '5'
                      override_packages: '[]'
                      hue: ''
                      theme: 0
                      timezone: ''
                      lang: en
                      allowed_bouquets: null
                      ui_prefs: null
                exists:
                  summary: Username taken
                  value:
                    status: STATUS_EXISTS_USERNAME
                    data: {}
                group:
                  summary: Group not allowed
                  value:
                    status: STATUS_INVALID_GROUP
                    data: {}
                credits:
                  summary: Not enough credits
                  value:
                    status: STATUS_INSUFFICIENT_CREDITS
                    data: {}
                invalid_key:
                  $ref: '#/components/examples/Reseller_InvalidKey'
                no_permissions:
                  $ref: '#/components/examples/Reseller_NoPermissions'
        '503':
          $ref: '#/components/responses/Reseller_Maintenance'
  /{reseller_access_code}/?action=edit_user:
    post:
      operationId: Reseller_edit_user
      tags:
        - Reseller API
      summary: Edit a sub-reseller
      description: |-
        Updates sub-reseller `id`. Only you and your sub-resellers are visible (Authorization::check('user')). Unknown/foreign id = FAILURE.

        **Token scope:** token scopes `full` (src/Core/Auth/ApiTokens.php:106-128); legacy keys are not scope-limited.

        **Source:** `src/Public/Controllers/Api/ResellerRestApiController.php:161`, `src/Public/Controllers/Api/ResellerAPIWrapper.php:411`, `src/Domain/User/ResellerAPI.php:810`
      parameters:
        - $ref: '#/components/parameters/Reseller_AccessCode'
        - name: action
          in: query
          required: true
          schema:
            type: string
            enum:
              - edit_user
          description: Action name. May also be sent in a form-encoded POST body (POST overrides GET).
        - $ref: '#/components/parameters/Reseller_Id'
      requestBody:
        required: false
        description: Form-encoded; the same fields are also accepted in the query string. PHP array syntax (`name[]=a&name[]=b`) is used for list fields unless a field says it is a JSON string.
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/Reseller_UserInput'
      responses:
        '200':
          description: JSON reply. Errors are also returned with HTTP 200; check `status`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Reseller_Envelope'
              examples:
                success:
                  summary: Success
                  value:
                    status: STATUS_SUCCESS
                    data:
                      id: '9'
                      username: subres1
                      email: r1@example.com
                      ip: 203.0.113.10
                      date_registered: '1750000000'
                      last_login: '1760690000'
                      member_group_id: '3'
                      credits: 0
                      notes: ''
                      status: '1'
                      reseller_dns: tv.example.com
                      owner_id: '5'
                      override_packages: '[]'
                      hue: ''
                      theme: 0
                      timezone: ''
                      lang: en
                      allowed_bouquets: null
                      ui_prefs: null
                not_found:
                  $ref: '#/components/examples/Reseller_Failure'
                group:
                  summary: Group not allowed
                  value:
                    status: STATUS_INVALID_GROUP
                    data: {}
                invalid_key:
                  $ref: '#/components/examples/Reseller_InvalidKey'
                no_permissions:
                  $ref: '#/components/examples/Reseller_NoPermissions'
        '503':
          $ref: '#/components/responses/Reseller_Maintenance'
  /{reseller_access_code}/?action=delete_user:
    post:
      operationId: Reseller_delete_user
      tags:
        - Reseller API
      summary: Delete a sub-reseller
      description: |-
        Needs create_sub_resellers and delete_users (else STATUS_NO_PERMISSIONS). Refuses yourself and reserved (admin) groups. In one transaction: moves the sub-reseller's credits to you, reassigns its lines and sub-resellers to you, deletes it, and logs users_credits_logs ("Deleted user: <name>") and users_logs.

        **Token scope:** token scopes `full` (src/Core/Auth/ApiTokens.php:106-128); legacy keys are not scope-limited.

        **Source:** `src/Public/Controllers/Api/ResellerRestApiController.php:166`, `src/Public/Controllers/Api/ResellerAPIWrapper.php:423`
      parameters:
        - $ref: '#/components/parameters/Reseller_AccessCode'
        - name: action
          in: query
          required: true
          schema:
            type: string
            enum:
              - delete_user
          description: Action name. May also be sent in a form-encoded POST body (POST overrides GET).
        - $ref: '#/components/parameters/Reseller_Id'
      responses:
        '200':
          description: JSON reply. Errors are also returned with HTTP 200; check `status`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Reseller_Envelope'
              examples:
                success:
                  summary: Success
                  value:
                    status: STATUS_SUCCESS
                not_found:
                  $ref: '#/components/examples/Reseller_Failure'
                invalid_key:
                  $ref: '#/components/examples/Reseller_InvalidKey'
                no_permissions:
                  $ref: '#/components/examples/Reseller_NoPermissions'
        '503':
          $ref: '#/components/responses/Reseller_Maintenance'
  /{reseller_access_code}/?action=disable_user:
    post:
      operationId: Reseller_disable_user
      tags:
        - Reseller API
      summary: Disable a sub-reseller
      description: |-
        Sets `status=0`. Needs create_sub_resellers. Refuses yourself and reserved groups (FAILURE).

        **Token scope:** token scopes `full` (src/Core/Auth/ApiTokens.php:106-128); legacy keys are not scope-limited.

        **Source:** `src/Public/Controllers/Api/ResellerRestApiController.php:169`, `src/Public/Controllers/Api/ResellerAPIWrapper.php:452`
      parameters:
        - $ref: '#/components/parameters/Reseller_AccessCode'
        - name: action
          in: query
          required: true
          schema:
            type: string
            enum:
              - disable_user
          description: Action name. May also be sent in a form-encoded POST body (POST overrides GET).
        - $ref: '#/components/parameters/Reseller_Id'
      responses:
        '200':
          description: JSON reply. Errors are also returned with HTTP 200; check `status`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Reseller_Envelope'
              examples:
                success:
                  summary: Success
                  value:
                    status: STATUS_SUCCESS
                not_found:
                  $ref: '#/components/examples/Reseller_Failure'
                invalid_key:
                  $ref: '#/components/examples/Reseller_InvalidKey'
                no_permissions:
                  $ref: '#/components/examples/Reseller_NoPermissions'
        '503':
          $ref: '#/components/responses/Reseller_Maintenance'
  /{reseller_access_code}/?action=enable_user:
    post:
      operationId: Reseller_enable_user
      tags:
        - Reseller API
      summary: Enable a sub-reseller
      description: |-
        Sets `status=1`. Needs create_sub_resellers. Refuses yourself and reserved groups (FAILURE).

        **Token scope:** token scopes `full` (src/Core/Auth/ApiTokens.php:106-128); legacy keys are not scope-limited.

        **Source:** `src/Public/Controllers/Api/ResellerRestApiController.php:172`, `src/Public/Controllers/Api/ResellerAPIWrapper.php:467`
      parameters:
        - $ref: '#/components/parameters/Reseller_AccessCode'
        - name: action
          in: query
          required: true
          schema:
            type: string
            enum:
              - enable_user
          description: Action name. May also be sent in a form-encoded POST body (POST overrides GET).
        - $ref: '#/components/parameters/Reseller_Id'
      responses:
        '200':
          description: JSON reply. Errors are also returned with HTTP 200; check `status`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Reseller_Envelope'
              examples:
                success:
                  summary: Success
                  value:
                    status: STATUS_SUCCESS
                not_found:
                  $ref: '#/components/examples/Reseller_Failure'
                invalid_key:
                  $ref: '#/components/examples/Reseller_InvalidKey'
                no_permissions:
                  $ref: '#/components/examples/Reseller_NoPermissions'
        '503':
          $ref: '#/components/responses/Reseller_Maintenance'
  /{reseller_access_code}/?action=adjust_credits:
    post:
      operationId: Reseller_adjust_credits
      tags:
        - Reseller API
      summary: Transfer credits to/from a sub-reseller
      description: |-
        Moves intval(`credits`) from you to sub-reseller `id` (negative takes credits back); each side must hold what it gives. Needs create_sub_resellers. Logs users_credits_logs with `note` (default "Reseller API Adjustment") and users_logs `adjust_credits`. FAILURE for non-numeric credits, unknown/foreign/reserved users or insufficient balance. Note: the admin API calls the note `reason`.

        **Token scope:** token scopes `full` (src/Core/Auth/ApiTokens.php:106-128); legacy keys are not scope-limited.

        **Source:** `src/Public/Controllers/Api/ResellerRestApiController.php:175`, `src/Public/Controllers/Api/ResellerAPIWrapper.php:482`
      parameters:
        - $ref: '#/components/parameters/Reseller_AccessCode'
        - name: action
          in: query
          required: true
          schema:
            type: string
            enum:
              - adjust_credits
          description: Action name. May also be sent in a form-encoded POST body (POST overrides GET).
        - $ref: '#/components/parameters/Reseller_Id'
        - name: credits
          in: query
          required: true
          schema:
            type: number
          description: Amount; decimals truncated.
        - name: note
          in: query
          required: false
          schema:
            type: string
          description: Log text.
      responses:
        '200':
          description: JSON reply. Errors are also returned with HTTP 200; check `status`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Reseller_Envelope'
              examples:
                success:
                  summary: Success
                  value:
                    status: STATUS_SUCCESS
                not_found:
                  $ref: '#/components/examples/Reseller_Failure'
                invalid_key:
                  $ref: '#/components/examples/Reseller_InvalidKey'
                no_permissions:
                  $ref: '#/components/examples/Reseller_NoPermissions'
        '503':
          $ref: '#/components/responses/Reseller_Maintenance'
  /{reseller_access_code}/?action=get_active_codes:
    get:
      operationId: Reseller_get_active_codes
      tags:
        - Reseller API
      summary: List activation codes
      description: |-
        Paged list of activation codes, newest first. Reply: `{status,total,count,start,limit,data}` where `data` is the row list filtered by show_columns/hide_columns. Only codes created by you or your sub-resellers (`reports`) are visible or changeable.

        **Token scope:** token scopes `full`, `read`, `lines` (src/Core/Auth/ApiTokens.php:106-128); legacy keys are not scope-limited.

        **Source:** `src/Public/Controllers/Api/ResellerRestApiController.php:178`, `src/Public/Controllers/Api/ResellerAPIWrapper.php:511`, `src/Domain/Line/ActiveCodeService.php:1193`
      parameters:
        - $ref: '#/components/parameters/Reseller_AccessCode'
        - name: action
          in: query
          required: true
          schema:
            type: string
            enum:
              - get_active_codes
          description: Action name. May also be sent in a form-encoded POST body (POST overrides GET).
        - $ref: '#/components/parameters/Reseller_Start'
        - $ref: '#/components/parameters/Reseller_Limit'
        - $ref: '#/components/parameters/Reseller_ShowColumns'
        - $ref: '#/components/parameters/Reseller_HideColumns'
        - name: batch_name
          in: query
          required: false
          schema:
            type: string
          description: Exact batch (alias `batch`).
        - name: package_id
          in: query
          required: false
          schema:
            type: integer
          description: Package (alias `package`).
        - name: status
          in: query
          required: false
          schema:
            type: string
          description: 0/disabled/suspended, 1/stock/ready, 2/active (not expired), 3/expired.
        - name: search
          in: query
          required: false
          schema:
            type: string
          description: LIKE match on code, batch, line username, mac, device_id.
      responses:
        '200':
          description: JSON reply. Errors are also returned with HTTP 200; check `status`.
          content:
            application/json:
              schema:
                anyOf:
                  - type: object
                    properties:
                      status:
                        $ref: '#/components/schemas/Reseller_Status'
                      total:
                        type: integer
                      count:
                        type: integer
                      start:
                        type: integer
                      limit:
                        type: integer
                      data:
                        type: array
                        items:
                          $ref: '#/components/schemas/Reseller_ActiveCodeRow'
                  - $ref: '#/components/schemas/Reseller_Error'
              examples:
                success:
                  summary: Success
                  value:
                    status: STATUS_SUCCESS
                    total: 120
                    count: 1
                    start: 0
                    limit: 50
                    data:
                      - id: 4
                        activation_code: K7M3Q9TZ2H
                        batch_name: BATCH-20261017-A1B2C
                        status: 1
                        status_key: stock
                        status_label: Ready (Stock)
                        package_id: 3
                        package_name: 1 Month
                        subscriber_id: 55
                        line_username: ac_1f9e2d3c4
                        line_password: 8c1d2e3f4a
                        exp_date: null
                        exp_date_formatted: null
                        remaining_days: 0
                        mac: null
                        device_id: null
                        max_connections: 1
                        is_trial: 0
                        is_adult: 0
                        purchase_cost: 10
                        created_by: 5
                        creator_username: reseller1
                        created_at: 1760700000
                        created_at_formatted: '2026-10-17 11:20:00'
                        activated_at: null
                        activated_at_formatted: null
                no_session:
                  summary: Reseller session not found.
                  value:
                    status: STATUS_FAILURE
                    error: Reseller session not found.
                invalid_key:
                  $ref: '#/components/examples/Reseller_InvalidKey'
                no_permissions:
                  $ref: '#/components/examples/Reseller_NoPermissions'
        '503':
          $ref: '#/components/responses/Reseller_Maintenance'
  /{reseller_access_code}/?action=get_active_code:
    get:
      operationId: Reseller_get_active_code
      tags:
        - Reseller API
      summary: Get one activation code
      description: |-
        Full code detail (package, subscriber line with credentials, device binding, playlist URLs). Only codes created by you or your sub-resellers (`reports`) are visible or changeable.

        **Token scope:** token scopes `full`, `read`, `lines` (src/Core/Auth/ApiTokens.php:106-128); legacy keys are not scope-limited.

        **Source:** `src/Public/Controllers/Api/ResellerRestApiController.php:181`, `src/Public/Controllers/Api/ResellerAPIWrapper.php:528`, `src/Domain/Line/ActiveCodeService.php:1379`
      parameters:
        - $ref: '#/components/parameters/Reseller_AccessCode'
        - name: action
          in: query
          required: true
          schema:
            type: string
            enum:
              - get_active_code
          description: Action name. May also be sent in a form-encoded POST body (POST overrides GET).
        - name: id
          in: query
          required: false
          schema:
            type: integer
          description: Code id. Either `id` or `code`.
        - name: code
          in: query
          required: false
          schema:
            type: string
          description: The activation code string (looked up when `id` is absent; ActiveCodeService::reference).
      responses:
        '200':
          description: JSON reply. Errors are also returned with HTTP 200; check `status`.
          content:
            application/json:
              schema:
                anyOf:
                  - type: object
                    required:
                      - status
                    properties:
                      status:
                        $ref: '#/components/schemas/Reseller_Status'
                      data:
                        type: object
                        additionalProperties: true
                  - $ref: '#/components/schemas/Reseller_Error'
              examples:
                success:
                  summary: Success
                  value:
                    status: STATUS_SUCCESS
                    data:
                      id: 4
                      activation_code: K7M3Q9TZ2H
                      batch_name: BATCH-20261017-A1B2C
                      status: 1
                      status_key: stock
                      status_label: Ready (Stock)
                      package:
                        id: 3
                        name: 1 Month
                        is_trial: false
                        official_duration: '1'
                        official_duration_in: months
                      subscriber_line:
                        id: 55
                        username: ac_1f9e2d3c4
                        password: 8c1d2e3f4a
                        exp_date: null
                        exp_date_formatted: null
                        enabled: false
                        admin_enabled: true
                        last_ip: null
                        last_activity: null
                      device_binding:
                        mac: null
                        device_id: null
                        is_locked: false
                      connection_limits:
                        max_connections: 1
                        active_connections: 0
                      playlists:
                        m3u_hls: http://tv.example.com/get.php?username=ac_1f9e2d3c4&password=8c1d2e3f4a&type=m3u_plus&output=hls
                        m3u_ts: http://tv.example.com/get.php?username=ac_1f9e2d3c4&password=8c1d2e3f4a&type=m3u_plus&output=ts
                      credentials:
                        server_url: http://tv.example.com
                        username: ac_1f9e2d3c4
                        password: 8c1d2e3f4a
                      created_by:
                        id: 5
                        username: reseller1
                      created_at: 1760700000
                      created_at_formatted: '2026-10-17 11:20:00'
                      activated_at: null
                      activated_at_formatted: null
                not_found:
                  summary: Active code not found or access denied.
                  value:
                    status: STATUS_FAILURE
                    error: Active code not found or access denied.
                no_session:
                  summary: Reseller session not found.
                  value:
                    status: STATUS_FAILURE
                    error: Reseller session not found.
                invalid_key:
                  $ref: '#/components/examples/Reseller_InvalidKey'
                no_permissions:
                  $ref: '#/components/examples/Reseller_NoPermissions'
        '503':
          $ref: '#/components/responses/Reseller_Maintenance'
  /{reseller_access_code}/?action=generate_active_codes:
    post:
      operationId: Reseller_generate_active_codes
      tags:
        - Reseller API
      summary: Generate a batch of activation codes
      description: |-
        Creates `num_codes` codes, each with a disabled backing line that is switched on when the code is redeemed. Charges the package price per code (trial_credits for is_trial, else official_credits or your override); the reply adds `total_cost` and `remaining_credits`. `created_by` may name one of your sub-resellers, else you. The package must be in your group's package list. Note the reply key `qty` but the input key `num_codes`.

        **Token scope:** token scopes `full`, `lines` (src/Core/Auth/ApiTokens.php:106-128); legacy keys are not scope-limited.

        **Source:** `src/Public/Controllers/Api/ResellerRestApiController.php:184`, `src/Public/Controllers/Api/ResellerAPIWrapper.php:541`, `src/Domain/Line/ActiveCodeService.php:69`
      parameters:
        - $ref: '#/components/parameters/Reseller_AccessCode'
        - name: action
          in: query
          required: true
          schema:
            type: string
            enum:
              - generate_active_codes
          description: Action name. May also be sent in a form-encoded POST body (POST overrides GET).
      requestBody:
        required: true
        description: Form-encoded; the same fields are also accepted in the query string. PHP array syntax (`name[]=a&name[]=b`) is used for list fields unless a field says it is a JSON string.
        content:
          application/x-www-form-urlencoded:
            schema:
              allOf:
                - $ref: '#/components/schemas/Reseller_ActiveCodeGenerate'
                - type: object
                  properties:
                    created_by:
                      type: integer
                      description: You or one of your sub-resellers; anything else becomes you.
      responses:
        '200':
          description: JSON reply. Errors are also returned with HTTP 200; check `status`.
          content:
            application/json:
              schema:
                anyOf:
                  - type: object
                    properties:
                      status:
                        $ref: '#/components/schemas/Reseller_Status'
                      message:
                        type: string
                      batch_name:
                        type: string
                      qty:
                        type: integer
                      total_cost:
                        type: number
                      remaining_credits:
                        type: number
                      data:
                        type: array
                        items:
                          type: object
                          properties:
                            code:
                              type: string
                            line_id:
                              type: integer
                            username:
                              type: string
                            password:
                              type: string
                            batch_name:
                              type: string
                      error:
                        type: string
                  - $ref: '#/components/schemas/Reseller_Error'
              examples:
                success:
                  summary: Success
                  value:
                    status: STATUS_SUCCESS
                    message: Successfully generated 2 active codes.
                    batch_name: BATCH-20261017-A1B2C
                    qty: 2
                    total_cost: 20
                    remaining_credits: 130
                    data:
                      - code: K7M3Q9TZ2H
                        line_id: 55
                        username: ac_1f9e2d3c4
                        password: 8c1d2e3f4a
                        batch_name: BATCH-20261017-A1B2C
                      - code: P4W8N2XR6C
                        line_id: 56
                        username: ac_7a8b9c0d1
                        password: 3e4f5a6b7c
                        batch_name: BATCH-20261017-A1B2C
                bad_package:
                  summary: The selected package is not allowed for your account group.
                  value:
                    status: STATUS_FAILURE
                    error: The selected package is not allowed for your account group.
                credits:
                  summary: 'Insufficient balance. Required: 20 credits, Available: 5 credits.'
                  value:
                    status: STATUS_FAILURE
                    error: 'Insufficient balance. Required: 20 credits, Available: 5 credits.'
                no_session:
                  summary: Reseller session not found.
                  value:
                    status: STATUS_FAILURE
                    error: Reseller session not found.
                invalid_key:
                  $ref: '#/components/examples/Reseller_InvalidKey'
                no_permissions:
                  $ref: '#/components/examples/Reseller_NoPermissions'
        '503':
          $ref: '#/components/responses/Reseller_Maintenance'
  /{reseller_access_code}/?action=create_active_code:
    post:
      operationId: Reseller_create_active_code
      tags:
        - Reseller API
      summary: Create activation codes (alias of generate_active_codes)
      description: |-
        Creates `num_codes` codes, each with a disabled backing line that is switched on when the code is redeemed. Charges the package price per code (trial_credits for is_trial, else official_credits or your override); the reply adds `total_cost` and `remaining_credits`. `created_by` may name one of your sub-resellers, else you. The package must be in your group's package list. Note the reply key `qty` but the input key `num_codes`. Same handler as generate_active_codes.

        **Token scope:** token scopes `full`, `lines` (src/Core/Auth/ApiTokens.php:106-128); legacy keys are not scope-limited.

        **Source:** `src/Public/Controllers/Api/ResellerRestApiController.php:185`, `src/Public/Controllers/Api/ResellerAPIWrapper.php:541`, `src/Domain/Line/ActiveCodeService.php:69`
      parameters:
        - $ref: '#/components/parameters/Reseller_AccessCode'
        - name: action
          in: query
          required: true
          schema:
            type: string
            enum:
              - create_active_code
          description: Action name. May also be sent in a form-encoded POST body (POST overrides GET).
      requestBody:
        required: true
        description: Form-encoded; the same fields are also accepted in the query string. PHP array syntax (`name[]=a&name[]=b`) is used for list fields unless a field says it is a JSON string.
        content:
          application/x-www-form-urlencoded:
            schema:
              allOf:
                - $ref: '#/components/schemas/Reseller_ActiveCodeGenerate'
                - type: object
                  properties:
                    created_by:
                      type: integer
                      description: You or one of your sub-resellers; anything else becomes you.
      responses:
        '200':
          description: JSON reply. Errors are also returned with HTTP 200; check `status`.
          content:
            application/json:
              schema:
                anyOf:
                  - type: object
                    properties:
                      status:
                        $ref: '#/components/schemas/Reseller_Status'
                      message:
                        type: string
                      batch_name:
                        type: string
                      qty:
                        type: integer
                      total_cost:
                        type: number
                      remaining_credits:
                        type: number
                      data:
                        type: array
                        items:
                          type: object
                          properties:
                            code:
                              type: string
                            line_id:
                              type: integer
                            username:
                              type: string
                            password:
                              type: string
                            batch_name:
                              type: string
                      error:
                        type: string
                  - $ref: '#/components/schemas/Reseller_Error'
              examples:
                success:
                  summary: Success
                  value:
                    status: STATUS_SUCCESS
                    message: Successfully generated 2 active codes.
                    batch_name: BATCH-20261017-A1B2C
                    qty: 2
                    total_cost: 20
                    remaining_credits: 130
                    data:
                      - code: K7M3Q9TZ2H
                        line_id: 55
                        username: ac_1f9e2d3c4
                        password: 8c1d2e3f4a
                        batch_name: BATCH-20261017-A1B2C
                      - code: P4W8N2XR6C
                        line_id: 56
                        username: ac_7a8b9c0d1
                        password: 3e4f5a6b7c
                        batch_name: BATCH-20261017-A1B2C
                bad_package:
                  summary: The selected package is not allowed for your account group.
                  value:
                    status: STATUS_FAILURE
                    error: The selected package is not allowed for your account group.
                credits:
                  summary: 'Insufficient balance. Required: 20 credits, Available: 5 credits.'
                  value:
                    status: STATUS_FAILURE
                    error: 'Insufficient balance. Required: 20 credits, Available: 5 credits.'
                no_session:
                  summary: Reseller session not found.
                  value:
                    status: STATUS_FAILURE
                    error: Reseller session not found.
                invalid_key:
                  $ref: '#/components/examples/Reseller_InvalidKey'
                no_permissions:
                  $ref: '#/components/examples/Reseller_NoPermissions'
        '503':
          $ref: '#/components/responses/Reseller_Maintenance'
  /{reseller_access_code}/?action=edit_active_code:
    post:
      operationId: Reseller_edit_active_code
      tags:
        - Reseller API
      summary: Edit an activation code
      description: |-
        Updates code `id`; replies with `message` and the refreshed detail in `data`. Only codes created by you or your sub-resellers (`reports`) are visible or changeable.

        **Token scope:** token scopes `full`, `lines` (src/Core/Auth/ApiTokens.php:106-128); legacy keys are not scope-limited.

        **Source:** `src/Public/Controllers/Api/ResellerRestApiController.php:188`, `src/Public/Controllers/Api/ResellerAPIWrapper.php:589`, `src/Domain/Line/ActiveCodeService.php:884`
      parameters:
        - $ref: '#/components/parameters/Reseller_AccessCode'
        - name: action
          in: query
          required: true
          schema:
            type: string
            enum:
              - edit_active_code
          description: Action name. May also be sent in a form-encoded POST body (POST overrides GET).
        - name: id
          in: query
          required: true
          schema:
            type: integer
          description: Code id.
      requestBody:
        required: false
        description: Form-encoded; the same fields are also accepted in the query string. PHP array syntax (`name[]=a&name[]=b`) is used for list fields unless a field says it is a JSON string.
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/Reseller_ActiveCodeEdit'
      responses:
        '200':
          description: JSON reply. Errors are also returned with HTTP 200; check `status`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Reseller_Envelope'
              examples:
                success:
                  summary: Success
                  value:
                    status: STATUS_SUCCESS
                    message: Active code updated successfully.
                    data:
                      id: 4
                      activation_code: K7M3Q9TZ2H
                      batch_name: BATCH-20261017-A1B2C
                      status: 1
                      status_key: stock
                      status_label: Ready (Stock)
                      package:
                        id: 3
                        name: 1 Month
                        is_trial: false
                        official_duration: '1'
                        official_duration_in: months
                      subscriber_line:
                        id: 55
                        username: ac_1f9e2d3c4
                        password: 8c1d2e3f4a
                        exp_date: null
                        exp_date_formatted: null
                        enabled: false
                        admin_enabled: true
                        last_ip: null
                        last_activity: null
                      device_binding:
                        mac: null
                        device_id: null
                        is_locked: false
                      connection_limits:
                        max_connections: 1
                        active_connections: 0
                      playlists:
                        m3u_hls: http://tv.example.com/get.php?username=ac_1f9e2d3c4&password=8c1d2e3f4a&type=m3u_plus&output=hls
                        m3u_ts: http://tv.example.com/get.php?username=ac_1f9e2d3c4&password=8c1d2e3f4a&type=m3u_plus&output=ts
                      credentials:
                        server_url: http://tv.example.com
                        username: ac_1f9e2d3c4
                        password: 8c1d2e3f4a
                      created_by:
                        id: 5
                        username: reseller1
                      created_at: 1760700000
                      created_at_formatted: '2026-10-17 11:20:00'
                      activated_at: null
                      activated_at_formatted: null
                failed:
                  summary: Failed to update active code.
                  value:
                    status: STATUS_FAILURE
                    error: Failed to update active code.
                bad_package:
                  summary: Package not permitted for your reseller group.
                  value:
                    status: STATUS_FAILURE
                    error: Package not permitted for your reseller group.
                no_session:
                  summary: Reseller session not found.
                  value:
                    status: STATUS_FAILURE
                    error: Reseller session not found.
                invalid_key:
                  $ref: '#/components/examples/Reseller_InvalidKey'
                no_permissions:
                  $ref: '#/components/examples/Reseller_NoPermissions'
        '503':
          $ref: '#/components/responses/Reseller_Maintenance'
  /{reseller_access_code}/?action=delete_active_code:
    post:
      operationId: Reseller_delete_active_code
      tags:
        - Reseller API
      summary: Delete an activation code
      description: |-
        Deletes code `id` and its backing line; an unredeemed code you created is refunded (`purchase_cost`). Reply adds `remaining_credits`.

        **Token scope:** token scopes `full`, `lines` (src/Core/Auth/ApiTokens.php:106-128); legacy keys are not scope-limited.

        **Source:** `src/Public/Controllers/Api/ResellerRestApiController.php:193`, `src/Public/Controllers/Api/ResellerAPIWrapper.php:617`, `src/Domain/Line/ActiveCodeService.php:877`
      parameters:
        - $ref: '#/components/parameters/Reseller_AccessCode'
        - name: action
          in: query
          required: true
          schema:
            type: string
            enum:
              - delete_active_code
          description: Action name. May also be sent in a form-encoded POST body (POST overrides GET).
        - name: id
          in: query
          required: true
          schema:
            type: integer
          description: Code id.
      responses:
        '200':
          description: JSON reply. Errors are also returned with HTTP 200; check `status`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Reseller_Envelope'
              examples:
                success:
                  summary: Success
                  value:
                    status: STATUS_SUCCESS
                    message: 1 code(s) deleted successfully.
                    remaining_credits: 140
                failed:
                  summary: Failed to delete active code.
                  value:
                    status: STATUS_FAILURE
                    error: Failed to delete active code.
                no_session:
                  summary: Reseller session not found.
                  value:
                    status: STATUS_FAILURE
                    error: Reseller session not found.
                invalid_key:
                  $ref: '#/components/examples/Reseller_InvalidKey'
                no_permissions:
                  $ref: '#/components/examples/Reseller_NoPermissions'
        '503':
          $ref: '#/components/responses/Reseller_Maintenance'
  /{reseller_access_code}/?action=enable_active_code:
    post:
      operationId: Reseller_enable_active_code
      tags:
        - Reseller API
      summary: Enable an activation code
      description: |-
        Enables code `id` (massAction `enable`), also switching its backing line.

        **Token scope:** token scopes `full`, `lines` (src/Core/Auth/ApiTokens.php:106-128); legacy keys are not scope-limited.

        **Source:** `src/Public/Controllers/Api/ResellerRestApiController.php:199`, `src/Public/Controllers/Api/ResellerAPIWrapper.php:644`, `src/Domain/Line/ActiveCodeService.php:727`
      parameters:
        - $ref: '#/components/parameters/Reseller_AccessCode'
        - name: action
          in: query
          required: true
          schema:
            type: string
            enum:
              - enable_active_code
          description: Action name. May also be sent in a form-encoded POST body (POST overrides GET).
        - name: id
          in: query
          required: true
          schema:
            type: integer
          description: Code id.
      responses:
        '200':
          description: JSON reply. Errors are also returned with HTTP 200; check `status`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Reseller_Envelope'
              examples:
                success:
                  summary: Success
                  value:
                    status: STATUS_SUCCESS
                    message: 1 codes successfully enabled.
                failed:
                  summary: No accessible codes found for mass action.
                  value:
                    status: STATUS_FAILURE
                    error: No accessible codes found for mass action.
                no_session:
                  summary: Reseller session not found.
                  value:
                    status: STATUS_FAILURE
                    error: Reseller session not found.
                invalid_key:
                  $ref: '#/components/examples/Reseller_InvalidKey'
                no_permissions:
                  $ref: '#/components/examples/Reseller_NoPermissions'
        '503':
          $ref: '#/components/responses/Reseller_Maintenance'
  /{reseller_access_code}/?action=disable_active_code:
    post:
      operationId: Reseller_disable_active_code
      tags:
        - Reseller API
      summary: Disable an activation code
      description: |-
        Disables code `id` (massAction `disable`), also switching its backing line.

        **Token scope:** token scopes `full`, `lines` (src/Core/Auth/ApiTokens.php:106-128); legacy keys are not scope-limited.

        **Source:** `src/Public/Controllers/Api/ResellerRestApiController.php:196`, `src/Public/Controllers/Api/ResellerAPIWrapper.php:657`, `src/Domain/Line/ActiveCodeService.php:727`
      parameters:
        - $ref: '#/components/parameters/Reseller_AccessCode'
        - name: action
          in: query
          required: true
          schema:
            type: string
            enum:
              - disable_active_code
          description: Action name. May also be sent in a form-encoded POST body (POST overrides GET).
        - name: id
          in: query
          required: true
          schema:
            type: integer
          description: Code id.
      responses:
        '200':
          description: JSON reply. Errors are also returned with HTTP 200; check `status`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Reseller_Envelope'
              examples:
                success:
                  summary: Success
                  value:
                    status: STATUS_SUCCESS
                    message: 1 codes suspended.
                failed:
                  summary: No accessible codes found for mass action.
                  value:
                    status: STATUS_FAILURE
                    error: No accessible codes found for mass action.
                no_session:
                  summary: Reseller session not found.
                  value:
                    status: STATUS_FAILURE
                    error: Reseller session not found.
                invalid_key:
                  $ref: '#/components/examples/Reseller_InvalidKey'
                no_permissions:
                  $ref: '#/components/examples/Reseller_NoPermissions'
        '503':
          $ref: '#/components/responses/Reseller_Maintenance'
  /{reseller_access_code}/?action=reset_active_code_device:
    post:
      operationId: Reseller_reset_active_code_device
      tags:
        - Reseller API
      summary: Reset device lock
      description: |-
        Clears `mac` and `device_id` on the code so it can be redeemed on another device.

        **Token scope:** token scopes `full`, `lines` (src/Core/Auth/ApiTokens.php:106-128); legacy keys are not scope-limited.

        **Source:** `src/Public/Controllers/Api/ResellerRestApiController.php:202`, `src/Public/Controllers/Api/ResellerAPIWrapper.php:670`, `src/Domain/Line/ActiveCodeService.php:1566`
      parameters:
        - $ref: '#/components/parameters/Reseller_AccessCode'
        - name: action
          in: query
          required: true
          schema:
            type: string
            enum:
              - reset_active_code_device
          description: Action name. May also be sent in a form-encoded POST body (POST overrides GET).
        - name: id
          in: query
          required: false
          schema:
            type: integer
          description: Code id. Either `id` or `code`.
        - name: code
          in: query
          required: false
          schema:
            type: string
          description: The activation code string (looked up when `id` is absent; ActiveCodeService::reference).
      responses:
        '200':
          description: JSON reply. Errors are also returned with HTTP 200; check `status`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Reseller_Envelope'
              examples:
                success:
                  summary: Success
                  value:
                    status: STATUS_SUCCESS
                    message: Hardware and MAC address lock reset successfully.
                not_found:
                  summary: Activation code not found.
                  value:
                    status: STATUS_FAILURE
                    error: Activation code not found.
                denied:
                  summary: Access denied to this activation code.
                  value:
                    status: STATUS_FAILURE
                    error: Access denied to this activation code.
                no_session:
                  summary: Reseller session not found.
                  value:
                    status: STATUS_FAILURE
                    error: Reseller session not found.
                invalid_key:
                  $ref: '#/components/examples/Reseller_InvalidKey'
                no_permissions:
                  $ref: '#/components/examples/Reseller_NoPermissions'
        '503':
          $ref: '#/components/responses/Reseller_Maintenance'
  /{reseller_access_code}/?action=mass_active_codes:
    post:
      operationId: Reseller_mass_active_codes
      tags:
        - Reseller API
      summary: Bulk action on activation codes
      description: |-
        Applies `sub_action` (alias `action_type`; the `action` parameter is taken by the dispatcher) to `ids`. Sub-actions (with or without a `mass_` prefix): enable, disable, extend (`days`, default 30; only lines that already expire) [admin only], reset_device, change_package (`package_id`) [admin only], delete (`refund_credits`/`refund`: refunds your unredeemed codes). Reply adds `remaining_credits`.

        **Token scope:** token scopes `full`, `lines` (src/Core/Auth/ApiTokens.php:106-128); legacy keys are not scope-limited.

        **Source:** `src/Public/Controllers/Api/ResellerRestApiController.php:205`, `src/Public/Controllers/Api/ResellerAPIWrapper.php:683`, `src/Domain/Line/ActiveCodeService.php:727`
      parameters:
        - $ref: '#/components/parameters/Reseller_AccessCode'
        - name: action
          in: query
          required: true
          schema:
            type: string
            enum:
              - mass_active_codes
          description: Action name. May also be sent in a form-encoded POST body (POST overrides GET).
      requestBody:
        required: true
        description: Form-encoded; the same fields are also accepted in the query string. PHP array syntax (`name[]=a&name[]=b`) is used for list fields unless a field says it is a JSON string.
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              required:
                - sub_action
                - ids
              properties:
                sub_action:
                  type: string
                  enum:
                    - enable
                    - disable
                    - extend
                    - reset_device
                    - change_package
                    - delete
                    - mass_enable
                    - mass_disable
                    - mass_extend
                    - mass_reset_device
                    - mass_change_package
                    - mass_delete
                action_type:
                  type: string
                  description: Alias of sub_action.
                ids:
                  type:
                    - string
                    - array
                  items:
                    type: integer
                  description: Comma-separated string or `ids[]` array.
                  example: 4,5,6
                days:
                  type: integer
                package_id:
                  type: integer
                refund_credits:
                  type: boolean
      responses:
        '200':
          description: JSON reply. Errors are also returned with HTTP 200; check `status`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Reseller_Envelope'
              examples:
                success:
                  summary: Success
                  value:
                    status: STATUS_SUCCESS
                    message: Extended expiration of selected active codes by 30 days.
                    remaining_credits: 140
                no_ids:
                  summary: No active code IDs provided.
                  value:
                    status: STATUS_FAILURE
                    error: No active code IDs provided.
                none_accessible:
                  summary: No accessible codes found for mass action.
                  value:
                    status: STATUS_FAILURE
                    error: No accessible codes found for mass action.
                admin_only:
                  summary: Only an administrator can extend activation codes or change their package.
                  value:
                    status: STATUS_FAILURE
                    error: Only an administrator can extend activation codes or change their package.
                no_session:
                  summary: Reseller session not found.
                  value:
                    status: STATUS_FAILURE
                    error: Reseller session not found.
                invalid_key:
                  $ref: '#/components/examples/Reseller_InvalidKey'
                no_permissions:
                  $ref: '#/components/examples/Reseller_NoPermissions'
        '503':
          $ref: '#/components/responses/Reseller_Maintenance'
  /{reseller_access_code}/?action=get_active_codes_batches:
    get:
      operationId: Reseller_get_active_codes_batches
      tags:
        - Reseller API
      summary: Batch summary
      description: |-
        One row per (batch_name, created_by, package_id, is_trial) with counts. Numbers are raw DB strings. Only codes created by you or your sub-resellers (`reports`) are visible or changeable.

        **Token scope:** token scopes `full`, `read`, `lines` (src/Core/Auth/ApiTokens.php:106-128); legacy keys are not scope-limited.

        **Source:** `src/Public/Controllers/Api/ResellerRestApiController.php:208`, `src/Public/Controllers/Api/ResellerAPIWrapper.php:717`, `src/Domain/Line/ActiveCodeService.php:1076`
      parameters:
        - $ref: '#/components/parameters/Reseller_AccessCode'
        - name: action
          in: query
          required: true
          schema:
            type: string
            enum:
              - get_active_codes_batches
          description: Action name. May also be sent in a form-encoded POST body (POST overrides GET).
        - name: batch_name
          in: query
          required: false
          schema:
            type: string
          description: Limit to one batch.
      responses:
        '200':
          description: JSON reply. Errors are also returned with HTTP 200; check `status`.
          content:
            application/json:
              schema:
                anyOf:
                  - type: object
                    required:
                      - status
                    properties:
                      status:
                        $ref: '#/components/schemas/Reseller_Status'
                      data:
                        type: array
                        items:
                          type: object
                          additionalProperties: true
                  - $ref: '#/components/schemas/Reseller_Error'
              examples:
                success:
                  summary: Success
                  value:
                    status: STATUS_SUCCESS
                    data:
                      - batch_name: BATCH-20261017-A1B2C
                        created_by: '5'
                        package_id: '3'
                        is_trial: '0'
                        created_at: '1760700000'
                        total_codes: '2'
                        stock_count: '2'
                        active_count: '0'
                        disabled_count: '0'
                        package_name: 1 Month
                        creator_name: reseller1
                        ready_codes: '2'
                        active_codes: '0'
                no_session:
                  summary: Reseller session not found.
                  value:
                    status: STATUS_FAILURE
                    error: Reseller session not found.
                invalid_key:
                  $ref: '#/components/examples/Reseller_InvalidKey'
                no_permissions:
                  $ref: '#/components/examples/Reseller_NoPermissions'
        '503':
          $ref: '#/components/responses/Reseller_Maintenance'
  /{reseller_access_code}/?action=export_active_code_batch:
    get:
      operationId: Reseller_export_active_code_batch
      tags:
        - Reseller API
      summary: Export a batch
      description: |-
        `format=txt` (or `text`) returns printable voucher text in `content`; anything else returns JSON vouchers in `data`.

        **Token scope:** token scopes `full`, `read`, `lines` (src/Core/Auth/ApiTokens.php:106-128); legacy keys are not scope-limited.

        **Source:** `src/Public/Controllers/Api/ResellerRestApiController.php:211`, `src/Public/Controllers/Api/ResellerAPIWrapper.php:727`, `src/Domain/Line/ActiveCodeService.php:1136`
      parameters:
        - $ref: '#/components/parameters/Reseller_AccessCode'
        - name: action
          in: query
          required: true
          schema:
            type: string
            enum:
              - export_active_code_batch
          description: Action name. May also be sent in a form-encoded POST body (POST overrides GET).
        - name: batch_name
          in: query
          required: true
          schema:
            type: string
          description: Batch to export.
        - name: format
          in: query
          required: false
          schema:
            type: string
            enum:
              - json
              - txt
              - text
            default: json
          description: Output format.
      responses:
        '200':
          description: JSON reply. Errors are also returned with HTTP 200; check `status`.
          content:
            application/json:
              schema:
                anyOf:
                  - type: object
                    properties:
                      status:
                        $ref: '#/components/schemas/Reseller_Status'
                      format:
                        type: string
                        enum:
                          - json
                          - txt
                      content:
                        type: string
                      data:
                        type: array
                        items:
                          type: object
                          additionalProperties: true
                      error:
                        type: string
                  - $ref: '#/components/schemas/Reseller_Error'
              examples:
                success:
                  summary: Success
                  value:
                    status: STATUS_SUCCESS
                    format: json
                    data:
                      - voucher_no: 1
                        activation_code: K7M3Q9TZ2H
                        batch_name: BATCH-20261017-A1B2C
                        package_name: 1 Month
                        status: Ready
                        max_connections: 1
                        portal_url: http://tv.example.com/portal
                        credentials:
                          username: ac_1f9e2d3c4
                          password: 8c1d2e3f4a
                        created_at: 1760700000
                        created_at_formatted: '2026-10-17 11:20:00'
                txt:
                  summary: format=txt
                  value:
                    status: STATUS_SUCCESS
                    format: txt
                    content: |-
                      ========================================================================
                                         ACTIVATION CODES VOUCHER BATCH                      
                      ...
                no_batch:
                  summary: Batch name is required.
                  value:
                    status: STATUS_FAILURE
                    error: Batch name is required.
                no_session:
                  summary: Reseller session not found.
                  value:
                    status: STATUS_FAILURE
                    error: Reseller session not found.
                invalid_key:
                  $ref: '#/components/examples/Reseller_InvalidKey'
                no_permissions:
                  $ref: '#/components/examples/Reseller_NoPermissions'
        '503':
          $ref: '#/components/responses/Reseller_Maintenance'
  /{reseller_access_code}/?action=check_active_code:
    get:
      operationId: Reseller_check_active_code
      tags:
        - Reseller API
      summary: Check an activation code
      description: |-
        Looks up any code (not limited to yours). **Always** `status: STATUS_SUCCESS`; the outcome is in `data.status` (SUCCESS, INVALID_CODE, DISABLED, EXPIRED) and `data.valid`. The wrapper's "Invalid or inactive code." branch is unreachable because checkCode never returns an empty array.

        **Token scope:** token scopes `full`, `read`, `lines` (src/Core/Auth/ApiTokens.php:106-128); legacy keys are not scope-limited.

        **Source:** `src/Public/Controllers/Api/ResellerRestApiController.php:214`, `src/Public/Controllers/Api/ResellerAPIWrapper.php:744`, `src/Domain/Line/ActiveCodeService.php:1501`
      parameters:
        - $ref: '#/components/parameters/Reseller_AccessCode'
        - name: action
          in: query
          required: true
          schema:
            type: string
            enum:
              - check_active_code
          description: Action name. May also be sent in a form-encoded POST body (POST overrides GET).
        - name: code
          in: query
          required: true
          schema:
            type: string
            example: K7M3Q9TZ2H
          description: Code (trimmed, upper-cased).
      responses:
        '200':
          description: JSON reply. Errors are also returned with HTTP 200; check `status`.
          content:
            application/json:
              schema:
                anyOf:
                  - type: object
                    required:
                      - status
                    properties:
                      status:
                        $ref: '#/components/schemas/Reseller_Status'
                      data:
                        type: object
                        additionalProperties: true
                  - $ref: '#/components/schemas/Reseller_Error'
              examples:
                success:
                  summary: Success
                  value:
                    status: STATUS_SUCCESS
                    data:
                      status: SUCCESS
                      valid: true
                      code: K7M3Q9TZ2H
                      code_status: 1
                      status_label: Ready (Stock)
                      package_name: 1 Month
                      is_trial: false
                      max_connections: 1
                      is_activated: false
                      activated_at: null
                      exp_date: null
                      exp_date_formatted: null
                      is_device_locked: false
                invalid:
                  summary: Unknown code
                  value:
                    status: STATUS_SUCCESS
                    data:
                      status: INVALID_CODE
                      valid: false
                      message: Invalid or unknown activation code.
                expired:
                  summary: Expired
                  value:
                    status: STATUS_SUCCESS
                    data:
                      status: EXPIRED
                      valid: false
                      code_status: 3
                      exp_date: 1757000000
                      exp_date_formatted: '2025-09-04 15:33:20'
                      message: This activation code has expired.
                invalid_key:
                  $ref: '#/components/examples/Reseller_InvalidKey'
                no_permissions:
                  $ref: '#/components/examples/Reseller_NoPermissions'
        '503':
          $ref: '#/components/responses/Reseller_Maintenance'
  /{reseller_access_code}/?action=get_lines:
    get:
      operationId: Reseller_get_lines
      tags:
        - Reseller API
      summary: List own and sub-reseller lines
      description: |-
        Intended to return the `lines` table scoped to rows owned by you or any of your sub-resellers (src/Public/Controllers/Reseller/ResellerTableController.php :158).

        **Known bug (source as reviewed):** in API mode ResellerTableController::index() reloads the user row from the DB (src/Public/Controllers/Reseller/ResellerTableController.php:69), which drops the `reports` key that ResellerAPIWrapper::createSession() added; the check at src/Public/Controllers/Reseller/ResellerTableController.php:96-99 then always fires, so **every reseller table action currently answers `{"status":"STATUS_SUCCESS","data":[]}`**. The parameters and row fields below describe the intended behaviour.

        Gate: group permission `create_line`; when missing the handler exits with an empty body.

        Paging: `limit` is passed as `length`; values <=0 or >1000 become 1000.

        Search (`search[value]`): lines.username, password, owner username, FROM_UNIXTIME(exp_date), max_connections, reseller_notes.

        **order[0][column]** index map: 0=(none), 1=`id`, 2=`username`, 3=`password`, 4=`owner`, 5=`status`, 6=`online`, 7=`is_trial`, 8=`is_restreamer`, 9=`active_connections`, 10=`max_connections`, 11=`exp_date`, 12=`last connection`.

        Row fields (raw DB values, numbers as strings; filtered by show_columns/hide_columns): id, member_id, last_activity, last_activity_array, username, password, exp_date, admin_enabled, is_restreamer, enabled, admin_notes, reseller_notes, max_connections, is_trial, contact, is_isplock, active_connections, owner_name, stream_display_name, stream_id, last_active.

        **Token scope:** re-checked as `get_lines`; a `lines`-scope token can read get_lines/get_mags/get_enigmas only.

        **Source:** `src/Public/Controllers/Api/ResellerRestApiController.php:68`, `src/Public/Controllers/Api/ResellerAPIWrapper.php:68`, `src/Public/Controllers/Reseller/ResellerTableController.php:57-106`, `src/Public/Controllers/Reseller/ResellerTableController.php:158`
      parameters:
        - $ref: '#/components/parameters/Reseller_AccessCode'
        - name: action
          in: query
          required: true
          schema:
            type: string
            enum:
              - get_lines
          description: Action name. May also be sent in a form-encoded POST body (POST overrides GET).
        - $ref: '#/components/parameters/Reseller_Start'
        - $ref: '#/components/parameters/Reseller_Limit'
        - $ref: '#/components/parameters/Reseller_ShowColumns'
        - $ref: '#/components/parameters/Reseller_HideColumns'
        - $ref: '#/components/parameters/Reseller_SearchValue'
        - $ref: '#/components/parameters/Reseller_OrderColumn'
        - $ref: '#/components/parameters/Reseller_OrderDir'
        - name: reseller
          in: query
          required: false
          schema:
            type: integer
          description: Only rows owned by this registered user id (`member_id` / `owner_id`).
        - name: filter
          in: query
          required: false
          schema:
            type: integer
            enum:
              - 1
              - 2
              - 3
              - 4
              - 5
          description: 1 active, 2 disabled, 3 banned, 4 expired, 5 trial.
      responses:
        '200':
          description: JSON reply. Errors are also returned with HTTP 200; check `status`.
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/Reseller_TableResponse'
                  - $ref: '#/components/schemas/Reseller_Error'
                  - type: string
                    const: ''
                    description: Empty body (handler permission failure).
              examples:
                success:
                  summary: Success
                  value:
                    status: STATUS_SUCCESS
                    data: []
                intended:
                  summary: Intended shape if the reports bug is fixed
                  value:
                    status: STATUS_SUCCESS
                    data:
                      - id: '12'
                        username: john01
                    recordsTotal: '1'
                    recordsFiltered: '1'
                table_permission_denied:
                  summary: 'Gate failed: empty body'
                  value: ''
                invalid_key:
                  $ref: '#/components/examples/Reseller_InvalidKey'
                no_permissions:
                  $ref: '#/components/examples/Reseller_NoPermissions'
        '503':
          $ref: '#/components/responses/Reseller_Maintenance'
  /{reseller_access_code}/?action=get_mags:
    get:
      operationId: Reseller_get_mags
      tags:
        - Reseller API
      summary: List own and sub-reseller MAG devices
      description: |-
        Intended to return the `mags` table scoped to rows owned by you or any of your sub-resellers (src/Public/Controllers/Reseller/ResellerTableController.php :368).

        **Known bug (source as reviewed):** in API mode ResellerTableController::index() reloads the user row from the DB (src/Public/Controllers/Reseller/ResellerTableController.php:69), which drops the `reports` key that ResellerAPIWrapper::createSession() added; the check at src/Public/Controllers/Reseller/ResellerTableController.php:96-99 then always fires, so **every reseller table action currently answers `{"status":"STATUS_SUCCESS","data":[]}`**. The parameters and row fields below describe the intended behaviour.

        Gate: group permission `create_mag`; when missing the handler exits with an empty body.

        Paging: `limit` is passed as `length`; values <=0 or >1000 become 1000.

        Search (`search[value]`): username, mac, stb_type, owner username, exp_date, reseller_notes.

        **order[0][column]** index map: 0=(none), 1=`id`, 2=`username`, 3=`mac`, 4=`stb_type`, 5=`owner`, 6=`enabled`, 7=`active_connections`, 8=`is_trial`, 9=`exp_date`.

        Row fields (raw DB values, numbers as strings; filtered by show_columns/hide_columns): id, last_activity_array, username, member_id, is_isplock, mac, stb_type, mag_id, exp_date, admin_enabled, enabled, reseller_notes, max_connections, is_trial, owner_name, active_connections.

        **Token scope:** re-checked as `get_mags`; a `lines`-scope token can read get_lines/get_mags/get_enigmas only.

        **Source:** `src/Public/Controllers/Api/ResellerRestApiController.php:71`, `src/Public/Controllers/Api/ResellerAPIWrapper.php:68`, `src/Public/Controllers/Reseller/ResellerTableController.php:57-106`, `src/Public/Controllers/Reseller/ResellerTableController.php:368`
      parameters:
        - $ref: '#/components/parameters/Reseller_AccessCode'
        - name: action
          in: query
          required: true
          schema:
            type: string
            enum:
              - get_mags
          description: Action name. May also be sent in a form-encoded POST body (POST overrides GET).
        - $ref: '#/components/parameters/Reseller_Start'
        - $ref: '#/components/parameters/Reseller_Limit'
        - $ref: '#/components/parameters/Reseller_ShowColumns'
        - $ref: '#/components/parameters/Reseller_HideColumns'
        - $ref: '#/components/parameters/Reseller_SearchValue'
        - $ref: '#/components/parameters/Reseller_OrderColumn'
        - $ref: '#/components/parameters/Reseller_OrderDir'
        - name: reseller
          in: query
          required: false
          schema:
            type: integer
          description: Only rows owned by this registered user id (`member_id` / `owner_id`).
        - name: filter
          in: query
          required: false
          schema:
            type: integer
            enum:
              - 1
              - 2
              - 3
              - 4
          description: '1 active, 2 disabled, 3 expired, 4 trial (note: 3 is expired here, not banned).'
      responses:
        '200':
          description: JSON reply. Errors are also returned with HTTP 200; check `status`.
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/Reseller_TableResponse'
                  - $ref: '#/components/schemas/Reseller_Error'
                  - type: string
                    const: ''
                    description: Empty body (handler permission failure).
              examples:
                success:
                  summary: Success
                  value:
                    status: STATUS_SUCCESS
                    data: []
                intended:
                  summary: Intended shape if the reports bug is fixed
                  value:
                    status: STATUS_SUCCESS
                    data:
                      - id: '12'
                        username: john01
                    recordsTotal: '1'
                    recordsFiltered: '1'
                table_permission_denied:
                  summary: 'Gate failed: empty body'
                  value: ''
                invalid_key:
                  $ref: '#/components/examples/Reseller_InvalidKey'
                no_permissions:
                  $ref: '#/components/examples/Reseller_NoPermissions'
        '503':
          $ref: '#/components/responses/Reseller_Maintenance'
  /{reseller_access_code}/?action=get_enigmas:
    get:
      operationId: Reseller_get_enigmas
      tags:
        - Reseller API
      summary: List own and sub-reseller Enigma2 devices
      description: |-
        Intended to return the `enigmas` table scoped to rows owned by you or any of your sub-resellers (src/Public/Controllers/Reseller/ResellerTableController.php :499).

        **Known bug (source as reviewed):** in API mode ResellerTableController::index() reloads the user row from the DB (src/Public/Controllers/Reseller/ResellerTableController.php:69), which drops the `reports` key that ResellerAPIWrapper::createSession() added; the check at src/Public/Controllers/Reseller/ResellerTableController.php:96-99 then always fires, so **every reseller table action currently answers `{"status":"STATUS_SUCCESS","data":[]}`**. The parameters and row fields below describe the intended behaviour.

        Gate: group permission `create_enigma`; when missing the handler exits with an empty body.

        Paging: `limit` is passed as `length`; values <=0 or >1000 become 1000.

        Search (`search[value]`): username, mac, public_ip, owner, exp_date, reseller_notes.

        **order[0][column]** index map: 0=(none), 1=`id`, 2=`username`, 3=`mac`, 4=`public_ip`, 5=`owner`, 6=`enabled`, 7=`active_connections`, 8=`is_trial`, 9=`exp_date`.

        Row fields (raw DB values, numbers as strings; filtered by show_columns/hide_columns): id, username, member_id, is_isplock, mac, public_ip, device_id, exp_date, admin_enabled, enabled, reseller_notes, max_connections, is_trial, owner_name, active_connections.

        **Token scope:** re-checked as `get_enigmas`; a `lines`-scope token can read get_lines/get_mags/get_enigmas only.

        **Source:** `src/Public/Controllers/Api/ResellerRestApiController.php:74`, `src/Public/Controllers/Api/ResellerAPIWrapper.php:68`, `src/Public/Controllers/Reseller/ResellerTableController.php:57-106`, `src/Public/Controllers/Reseller/ResellerTableController.php:499`
      parameters:
        - $ref: '#/components/parameters/Reseller_AccessCode'
        - name: action
          in: query
          required: true
          schema:
            type: string
            enum:
              - get_enigmas
          description: Action name. May also be sent in a form-encoded POST body (POST overrides GET).
        - $ref: '#/components/parameters/Reseller_Start'
        - $ref: '#/components/parameters/Reseller_Limit'
        - $ref: '#/components/parameters/Reseller_ShowColumns'
        - $ref: '#/components/parameters/Reseller_HideColumns'
        - $ref: '#/components/parameters/Reseller_SearchValue'
        - $ref: '#/components/parameters/Reseller_OrderColumn'
        - $ref: '#/components/parameters/Reseller_OrderDir'
        - name: reseller
          in: query
          required: false
          schema:
            type: integer
          description: Only rows owned by this registered user id (`member_id` / `owner_id`).
        - name: filter
          in: query
          required: false
          schema:
            type: integer
            enum:
              - 1
              - 2
              - 3
              - 4
          description: 1 active, 2 disabled, 3 expired, 4 trial.
      responses:
        '200':
          description: JSON reply. Errors are also returned with HTTP 200; check `status`.
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/Reseller_TableResponse'
                  - $ref: '#/components/schemas/Reseller_Error'
                  - type: string
                    const: ''
                    description: Empty body (handler permission failure).
              examples:
                success:
                  summary: Success
                  value:
                    status: STATUS_SUCCESS
                    data: []
                intended:
                  summary: Intended shape if the reports bug is fixed
                  value:
                    status: STATUS_SUCCESS
                    data:
                      - id: '12'
                        username: john01
                    recordsTotal: '1'
                    recordsFiltered: '1'
                table_permission_denied:
                  summary: 'Gate failed: empty body'
                  value: ''
                invalid_key:
                  $ref: '#/components/examples/Reseller_InvalidKey'
                no_permissions:
                  $ref: '#/components/examples/Reseller_NoPermissions'
        '503':
          $ref: '#/components/responses/Reseller_Maintenance'
  /{reseller_access_code}/?action=get_users:
    get:
      operationId: Reseller_get_users
      tags:
        - Reseller API
      summary: List sub-resellers
      description: |-
        Intended to return the `reg_users` table scoped to rows owned by you or any of your sub-resellers (src/Public/Controllers/Reseller/ResellerTableController.php :1576).

        **Known bug (source as reviewed):** in API mode ResellerTableController::index() reloads the user row from the DB (src/Public/Controllers/Reseller/ResellerTableController.php:69), which drops the `reports` key that ResellerAPIWrapper::createSession() added; the check at src/Public/Controllers/Reseller/ResellerTableController.php:96-99 then always fires, so **every reseller table action currently answers `{"status":"STATUS_SUCCESS","data":[]}`**. The parameters and row fields below describe the intended behaviour.

        Gate: group permission `create_sub_resellers`; when missing the handler exits with an empty body.

        Paging: `limit` is passed as `length`; values <=0 or >1000 become 1000.

        Search (`search[value]`): id, username, notes, owner username, date_registered, last_login, email, ip, group_name.

        **order[0][column]** index map: 0=(none), 1=`id`, 2=`username`, 3=`owner`, 4=`ip`, 5=`status`, 6=`credits`, 7=`user_count`, 8=`last_login`.

        Row fields (raw DB values, numbers as strings; filtered by show_columns/hide_columns): id, status, is_reseller, notes, owner_id, credits, username, email, ip, date_registered, last_login (Y-m-d H:i:s or null), owner_username, group_name, user_count.

        **Token scope:** re-checked as `get_reg_users`; a `lines`-scope token can read get_lines/get_mags/get_enigmas only.

        **Source:** `src/Public/Controllers/Api/ResellerRestApiController.php:77`, `src/Public/Controllers/Api/ResellerAPIWrapper.php:68`, `src/Public/Controllers/Reseller/ResellerTableController.php:57-106`, `src/Public/Controllers/Reseller/ResellerTableController.php:1576`
      parameters:
        - $ref: '#/components/parameters/Reseller_AccessCode'
        - name: action
          in: query
          required: true
          schema:
            type: string
            enum:
              - get_users
          description: Action name. May also be sent in a form-encoded POST body (POST overrides GET).
        - $ref: '#/components/parameters/Reseller_Start'
        - $ref: '#/components/parameters/Reseller_Limit'
        - $ref: '#/components/parameters/Reseller_ShowColumns'
        - $ref: '#/components/parameters/Reseller_HideColumns'
        - $ref: '#/components/parameters/Reseller_SearchValue'
        - $ref: '#/components/parameters/Reseller_OrderColumn'
        - $ref: '#/components/parameters/Reseller_OrderDir'
        - name: reseller
          in: query
          required: false
          schema:
            type: integer
          description: Only rows owned by this registered user id (`member_id` / `owner_id`).
        - name: filter
          in: query
          required: false
          schema:
            type: integer
            enum:
              - 1
              - 2
          description: 1 enabled, 2 disabled.
      responses:
        '200':
          description: JSON reply. Errors are also returned with HTTP 200; check `status`.
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/Reseller_TableResponse'
                  - $ref: '#/components/schemas/Reseller_Error'
                  - type: string
                    const: ''
                    description: Empty body (handler permission failure).
              examples:
                success:
                  summary: Success
                  value:
                    status: STATUS_SUCCESS
                    data: []
                intended:
                  summary: Intended shape if the reports bug is fixed
                  value:
                    status: STATUS_SUCCESS
                    data:
                      - id: '12'
                        username: john01
                    recordsTotal: '1'
                    recordsFiltered: '1'
                table_permission_denied:
                  summary: 'Gate failed: empty body'
                  value: ''
                invalid_key:
                  $ref: '#/components/examples/Reseller_InvalidKey'
                no_permissions:
                  $ref: '#/components/examples/Reseller_NoPermissions'
        '503':
          $ref: '#/components/responses/Reseller_Maintenance'
  /{reseller_access_code}/?action=activity_logs:
    get:
      operationId: Reseller_activity_logs
      tags:
        - Reseller API
      summary: Activity log of own lines
      description: |-
        Intended to return the `line_activity` table scoped to rows owned by you or any of your sub-resellers (src/Public/Controllers/Reseller/ResellerTableController.php :1095).

        **Known bug (source as reviewed):** in API mode ResellerTableController::index() reloads the user row from the DB (src/Public/Controllers/Reseller/ResellerTableController.php:69), which drops the `reports` key that ResellerAPIWrapper::createSession() added; the check at src/Public/Controllers/Reseller/ResellerTableController.php:96-99 then always fires, so **every reseller table action currently answers `{"status":"STATUS_SUCCESS","data":[]}`**. The parameters and row fields below describe the intended behaviour.

        Gate: group permission `reseller_client_connection_logs`; when missing the handler exits with an empty body.

        Paging: `limit` is passed as `length`; values <=0 or >1000 become 1000.

        Search (`search[value]`): user_agent, user_ip, container, date_start, date_end, geoip_country_code, lines.username, MAG/Enigma mac, stream_display_name.

        **order[0][column]** index map: 0=(none), 1=`username`, 2=`stream`, 3=`user_agent`, 4=`isp`, 5=`user_ip`, 6=`date_start`, 7=`date_end`, 8=`duration`, 9=`container`, 10=`is_restreamer`.

        Row fields (raw DB values, numbers as strings; filtered by show_columns/hide_columns): mag_id, device_id, is_e2, is_mag, activity_id, container, isp, user_id, stream_id, series_no, server_id, user_agent, user_ip, date_start, date_end, geoip_country_code, username, stream_display_name, type, is_restreamer.

        **Token scope:** re-checked as `get_line_activity`; a `lines`-scope token can read get_lines/get_mags/get_enigmas only.

        **Source:** `src/Public/Controllers/Api/ResellerRestApiController.php:80`, `src/Public/Controllers/Api/ResellerAPIWrapper.php:68`, `src/Public/Controllers/Reseller/ResellerTableController.php:57-106`, `src/Public/Controllers/Reseller/ResellerTableController.php:1095`
      parameters:
        - $ref: '#/components/parameters/Reseller_AccessCode'
        - name: action
          in: query
          required: true
          schema:
            type: string
            enum:
              - activity_logs
          description: Action name. May also be sent in a form-encoded POST body (POST overrides GET).
        - $ref: '#/components/parameters/Reseller_Start'
        - $ref: '#/components/parameters/Reseller_Limit'
        - $ref: '#/components/parameters/Reseller_ShowColumns'
        - $ref: '#/components/parameters/Reseller_HideColumns'
        - $ref: '#/components/parameters/Reseller_SearchValue'
        - $ref: '#/components/parameters/Reseller_OrderColumn'
        - $ref: '#/components/parameters/Reseller_OrderDir'
        - name: range
          in: query
          required: false
          schema:
            type: string
            example: 2026-10-01 - 2026-10-17
          description: Date range `YYYY-MM-DD - YYYY-MM-DD` (first and last 10 characters are used; 00:00:00 to 23:59:59).
        - name: stream
          in: query
          required: false
          schema:
            type: integer
          description: Stream id.
        - name: user
          in: query
          required: false
          schema:
            type: integer
          description: Owner (reseller) id.
        - name: line
          in: query
          required: false
          schema:
            type: integer
          description: Line id.
      responses:
        '200':
          description: JSON reply. Errors are also returned with HTTP 200; check `status`.
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/Reseller_TableResponse'
                  - $ref: '#/components/schemas/Reseller_Error'
                  - type: string
                    const: ''
                    description: Empty body (handler permission failure).
              examples:
                success:
                  summary: Success
                  value:
                    status: STATUS_SUCCESS
                    data: []
                intended:
                  summary: Intended shape if the reports bug is fixed
                  value:
                    status: STATUS_SUCCESS
                    data:
                      - id: '12'
                        username: john01
                    recordsTotal: '1'
                    recordsFiltered: '1'
                table_permission_denied:
                  summary: 'Gate failed: empty body'
                  value: ''
                invalid_key:
                  $ref: '#/components/examples/Reseller_InvalidKey'
                no_permissions:
                  $ref: '#/components/examples/Reseller_NoPermissions'
        '503':
          $ref: '#/components/responses/Reseller_Maintenance'
  /{reseller_access_code}/?action=live_connections:
    get:
      operationId: Reseller_live_connections
      tags:
        - Reseller API
      summary: Live connections of own lines
      description: |-
        Intended to return the `live_connections` table scoped to rows owned by you or any of your sub-resellers (src/Public/Controllers/Reseller/ResellerTableController.php :1221).

        **Known bug (source as reviewed):** in API mode ResellerTableController::index() reloads the user row from the DB (src/Public/Controllers/Reseller/ResellerTableController.php:69), which drops the `reports` key that ResellerAPIWrapper::createSession() added; the check at src/Public/Controllers/Reseller/ResellerTableController.php:96-99 then always fires, so **every reseller table action currently answers `{"status":"STATUS_SUCCESS","data":[]}`**. The parameters and row fields below describe the intended behaviour.

        Gate: group permission `reseller_client_connection_logs`; when missing the handler exits with an empty body.

        Paging: `limit` is passed as `length`; values <=0 or >1000 become 1000.

        Search (`search[value]`): MySQL mode only, as activity_logs.

        **order[0][column]** index map: 0=(none), 1=`uuid`, 2=`divergence`, 3=`identifier`, 4=`stream_display_name`, 5=`user_agent`, 6=`isp`, 7=`user_ip`, 8=`active_time`, 9=`container`.

        Row fields (raw DB values, numbers as strings; filtered by show_columns/hide_columns): MySQL mode: mag_id, device_id, is_e2, is_mag, activity_id, divergence, user_id, stream_id, series_no, is_restreamer, isp, server_id, user_agent, user_ip, container, uuid, date_start, geoip_country_code, username, stream_display_name, type.

        **Token scope:** re-checked as `get_live_connections`; a `lines`-scope token can read get_lines/get_mags/get_enigmas only.

        **Source:** `src/Public/Controllers/Api/ResellerRestApiController.php:83`, `src/Public/Controllers/Api/ResellerAPIWrapper.php:68`, `src/Public/Controllers/Reseller/ResellerTableController.php:57-106`, `src/Public/Controllers/Reseller/ResellerTableController.php:1221`
      parameters:
        - $ref: '#/components/parameters/Reseller_AccessCode'
        - name: action
          in: query
          required: true
          schema:
            type: string
            enum:
              - live_connections
          description: Action name. May also be sent in a form-encoded POST body (POST overrides GET).
        - $ref: '#/components/parameters/Reseller_Start'
        - $ref: '#/components/parameters/Reseller_Limit'
        - $ref: '#/components/parameters/Reseller_ShowColumns'
        - $ref: '#/components/parameters/Reseller_HideColumns'
        - $ref: '#/components/parameters/Reseller_SearchValue'
        - $ref: '#/components/parameters/Reseller_OrderColumn'
        - $ref: '#/components/parameters/Reseller_OrderDir'
        - name: user
          in: query
          required: false
          schema:
            type: integer
          description: Owner (reseller) id; must be in your reports.
        - name: stream_id
          in: query
          required: false
          schema:
            type: integer
          description: Stream id (Redis mode).
        - name: stream
          in: query
          required: false
          schema:
            type: integer
          description: Stream id (MySQL mode).
        - name: line
          in: query
          required: false
          schema:
            type: integer
          description: Line id.
      responses:
        '200':
          description: JSON reply. Errors are also returned with HTTP 200; check `status`.
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/Reseller_TableResponse'
                  - $ref: '#/components/schemas/Reseller_Error'
                  - type: string
                    const: ''
                    description: Empty body (handler permission failure).
              examples:
                success:
                  summary: Success
                  value:
                    status: STATUS_SUCCESS
                    data: []
                intended:
                  summary: Intended shape if the reports bug is fixed
                  value:
                    status: STATUS_SUCCESS
                    data:
                      - id: '12'
                        username: john01
                    recordsTotal: '1'
                    recordsFiltered: '1'
                table_permission_denied:
                  summary: 'Gate failed: empty body'
                  value: ''
                invalid_key:
                  $ref: '#/components/examples/Reseller_InvalidKey'
                no_permissions:
                  $ref: '#/components/examples/Reseller_NoPermissions'
        '503':
          $ref: '#/components/responses/Reseller_Maintenance'
  /{reseller_access_code}/?action=user_logs:
    get:
      operationId: Reseller_user_logs
      tags:
        - Reseller API
      summary: Credit/activity log of you and your sub-resellers
      description: |-
        Intended to return the `reg_user_logs` table scoped to rows owned by you or any of your sub-resellers (src/Public/Controllers/Reseller/ResellerTableController.php :1439).

        **Known bug (source as reviewed):** in API mode ResellerTableController::index() reloads the user row from the DB (src/Public/Controllers/Reseller/ResellerTableController.php:69), which drops the `reports` key that ResellerAPIWrapper::createSession() added; the check at src/Public/Controllers/Reseller/ResellerTableController.php:96-99 then always fires, so **every reseller table action currently answers `{"status":"STATUS_SUCCESS","data":[]}`**. The parameters and row fields below describe the intended behaviour.

        No permission gate.

        Paging: `limit` is passed as `length`; values <=0 or >1000 become 1000.

        Search (`search[value]`): owner username, type, action.

        **order[0][column]** index map: 0=(none), 1=`owner`, 2=`log_id`, 3=`type,action`, 4=`cost`, 5=`credits_after`, 6=`date`.

        Row fields (raw DB values, numbers as strings; filtered by show_columns/hide_columns): username (owner), id, owner, type (line|mag|enigma|user), action (new|extend|edit), log_id, package_id, cost, credits_after, date.

        **Token scope:** re-checked as `get_reg_user_logs`; a `lines`-scope token can read get_lines/get_mags/get_enigmas only.

        **Source:** `src/Public/Controllers/Api/ResellerRestApiController.php:86`, `src/Public/Controllers/Api/ResellerAPIWrapper.php:68`, `src/Public/Controllers/Reseller/ResellerTableController.php:57-106`, `src/Public/Controllers/Reseller/ResellerTableController.php:1439`
      parameters:
        - $ref: '#/components/parameters/Reseller_AccessCode'
        - name: action
          in: query
          required: true
          schema:
            type: string
            enum:
              - user_logs
          description: Action name. May also be sent in a form-encoded POST body (POST overrides GET).
        - $ref: '#/components/parameters/Reseller_Start'
        - $ref: '#/components/parameters/Reseller_Limit'
        - $ref: '#/components/parameters/Reseller_ShowColumns'
        - $ref: '#/components/parameters/Reseller_HideColumns'
        - $ref: '#/components/parameters/Reseller_SearchValue'
        - $ref: '#/components/parameters/Reseller_OrderColumn'
        - $ref: '#/components/parameters/Reseller_OrderDir'
        - name: range
          in: query
          required: false
          schema:
            type: string
            example: 2026-10-01 - 2026-10-17
          description: Date range `YYYY-MM-DD - YYYY-MM-DD` (first and last 10 characters are used; 00:00:00 to 23:59:59).
        - name: reseller
          in: query
          required: false
          schema:
            type: integer
          description: Only rows owned by this registered user id (`member_id` / `owner_id`).
      responses:
        '200':
          description: JSON reply. Errors are also returned with HTTP 200; check `status`.
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/Reseller_TableResponse'
                  - $ref: '#/components/schemas/Reseller_Error'
                  - type: string
                    const: ''
                    description: Empty body (handler permission failure).
              examples:
                success:
                  summary: Success
                  value:
                    status: STATUS_SUCCESS
                    data: []
                intended:
                  summary: Intended shape if the reports bug is fixed
                  value:
                    status: STATUS_SUCCESS
                    data:
                      - id: '12'
                        username: john01
                    recordsTotal: '1'
                    recordsFiltered: '1'
                table_permission_denied:
                  summary: 'Gate failed: empty body'
                  value: ''
                invalid_key:
                  $ref: '#/components/examples/Reseller_InvalidKey'
                no_permissions:
                  $ref: '#/components/examples/Reseller_NoPermissions'
        '503':
          $ref: '#/components/responses/Reseller_Maintenance'
