> ## Documentation Index
> Fetch the complete documentation index at: https://api.zenedu.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Метрики восстановления дохода

> Возвращает карточки «Восстановление дохода» за период: восстановленные платежи, долю восстановлений, неуспешные списания и долю неуспешных с трендами.



## OpenAPI

````yaml GET /api/v1/bot/{bot}/subscriptions/revenue-recovery/metrics
openapi: 3.1.0
info:
  title: Zenedu API v1
  description: >-
    API for managing Telegram bots, subscribers, products, funnels, offers, and
    orders on the Zenedu platform. API v1 returns JSON by default; the Accept:
    application/json header is optional. File downloads return the file content,
    and 204 responses have no body. Errors returned by the application use JSON
    even when Accept is omitted.
  version: 1.0.0
servers:
  - url: https://app.zenedu.io
security:
  - bearerAuth: []
tags:
  - name: User
    description: Current user profile
  - name: Bots
    description: Bot management
  - name: Subscribers
    description: Subscriber management
  - name: Orders
    description: Order management
  - name: Products
    description: Product management
  - name: Funnels
    description: Funnel management
  - name: Offers
    description: Offer management
  - name: Links
    description: Link generation
  - name: Files
    description: File downloads
  - name: Zapier
    description: Zapier webhook management
  - name: Webhooks
    description: Account webhook subscriptions
  - name: Payment systems
    description: Account payment methods
  - name: Bot settings
    description: 'Bot configuration: email, branding, integrations, legal documents'
  - name: Commands
    description: Bot menu commands
  - name: Custom fields
    description: Subscriber custom fields
  - name: Tags
    description: Subscriber tags of the bot
  - name: Folders
    description: Folders for products, funnels, channels and groups
  - name: Slugs
    description: Public link slugs
  - name: Funnel links
    description: Subscription links of a funnel
  - name: Coupons
    description: Coupon management
  - name: Subscriptions
    description: Recurring subscription management
  - name: Tasks
    description: Student task review
  - name: Broadcasts
    description: Broadcast messages
  - name: Automations
    description: Event-based automations
  - name: Affiliate
    description: Affiliate program management
  - name: Shop
    description: Bot shop draft and publication
  - name: Channels
    description: Telegram channels connected to the bot
  - name: Groups
    description: Telegram groups connected to the bot
  - name: Mini-app
    description: Telegram mini app configuration
  - name: Web
    description: Web app configuration
  - name: Telegram files
    description: Telegram file attachments for steps and broadcasts
paths:
  /api/v1/bot/{bot}/subscriptions/revenue-recovery/metrics:
    get:
      tags:
        - Subscriptions
      summary: Get revenue recovery metrics
      description: >-
        Returns the metric cards of the Revenue recovery tab for a period:
        recovered payments (Zenedu recovered), recovery rate, failed charges and
        failure rate, each with a trend against the previous period of the same
        length. Amounts are in the account currency in major units, rates in
        percent (`null` when there is nothing to divide). Period bounds are
        counted in the account timezone.
      operationId: getRevenueRecoveryMetrics
      parameters:
        - name: bot
          in: path
          required: true
          description: Bot ID
          schema:
            type: integer
        - name: period
          in: query
          required: false
          description: >-
            Period preset of the dashboard select; default `30days`, `all` = all
            time without trends.
          schema:
            type: string
            enum:
              - today
              - yesterday
              - 7days
              - 30days
              - 90days
              - current_month
              - previous_month
              - current_year
              - previous_year
              - all
            default: 30days
      responses:
        '200':
          description: Metrics of the period
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/RevenueRecoveryMetrics'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: >-
            Forbidden — lacks access to this bot or to the Subscriptions section
            (manage orders)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: Unknown period preset
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    RevenueRecoveryMetrics:
      type: object
      properties:
        period:
          type: string
        currency:
          type: string
          description: Account currency of the amounts
        recovered:
          type: object
          description: >-
            «Zenedu recovered»: failed scheduled charges recovered by a retry,
            by recovery date
          properties:
            amount:
              type: number
            count:
              type: integer
            all_time_amount:
              type: number
              nullable: true
              description: '`null` until the first recovery'
            trend:
              type: object
              nullable: true
              description: >-
                Change against the previous period of the same length; `null`
                for all time or without a previous value
              properties:
                change:
                  type: number
                  description: >-
                    Change in percent for amounts, in percentage points for
                    rates
                unit:
                  type: string
                  enum:
                    - percent
                    - points
                improved:
                  type: boolean
                  description: Whether the change is good for the school
        recovery_rate:
          type: object
          description: >-
            Recovered among recovered and lost failed payments started in the
            period; payments still in progress are not counted
          properties:
            percent:
              type: number
              nullable: true
            trend:
              type: object
              nullable: true
              description: >-
                Change against the previous period of the same length; `null`
                for all time or without a previous value
              properties:
                change:
                  type: number
                  description: >-
                    Change in percent for amounts, in percentage points for
                    rates
                unit:
                  type: string
                  enum:
                    - percent
                    - points
                improved:
                  type: boolean
                  description: Whether the change is good for the school
        failed_charges:
          type: object
          description: Scheduled charges that failed at the first attempt, by charge date
          properties:
            amount:
              type: number
            count:
              type: integer
            trend:
              type: object
              nullable: true
              description: >-
                Change against the previous period of the same length; `null`
                for all time or without a previous value
              properties:
                change:
                  type: number
                  description: >-
                    Change in percent for amounts, in percentage points for
                    rates
                unit:
                  type: string
                  enum:
                    - percent
                    - points
                improved:
                  type: boolean
                  description: Whether the change is good for the school
        failure_rate:
          type: object
          description: Failed scheduled charges among all scheduled charges
          properties:
            percent:
              type: number
              nullable: true
            trend:
              type: object
              nullable: true
              description: >-
                Change against the previous period of the same length; `null`
                for all time or without a previous value
              properties:
                change:
                  type: number
                  description: >-
                    Change in percent for amounts, in percentage points for
                    rates
                unit:
                  type: string
                  enum:
                    - percent
                    - points
                improved:
                  type: boolean
                  description: Whether the change is good for the school
    Error:
      type: object
      properties:
        message:
          type: string
          description: Error message
        errors:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
          description: Validation errors keyed by field name
        code:
          type: string
          description: >-
            Machine-readable code of a business error: unauthorized, not_found,
            conflict, limit_exceeded, quota_exceeded, pro_required. Absent on
            validation errors.
        current_plan:
          type:
            - string
            - 'null'
          description: >-
            Only with code pro_required: the current plan as the dashboard names
            it (Pro, Basic, Trial), null without an active subscription.
        upgrade_url:
          type: string
          description: >-
            Only with code pro_required: the dashboard page where the plan can
            be upgraded.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: API token from the Zenedu dashboard

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.