> ## 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.

# Зарегистрировать или запросить файл

> Регистрирует file_id или просит пользователя отправить файл боту



## OpenAPI

````yaml POST /api/v1/bot/{bot}/telegram-files
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.
  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: 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}/telegram-files:
    post:
      tags:
        - Telegram files
      summary: Register or request a file
      description: >-
        Adds a Telegram file. Files live on Telegram's servers (the Bot API
        upload limit is 50 MB), so there are two modes: send `file_id` and
        `type` to register a file that was already uploaded through this bot by
        any method (Bot API or MTProto, up to ~2 GB); or send an empty body to
        ask the user to send a file to the bot — the received file then appears
        in the list endpoint until it is attached. In both modes the user must
        have started the bot.
      operationId: createTelegramFile
      parameters:
        - name: bot
          in: path
          required: true
          description: Bot ID
          schema:
            type: integer
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                file_id:
                  type: string
                  maxLength: 255
                  description: >-
                    A Telegram file_id for a file uploaded through this bot by
                    any method (Bot API or MTProto). Required together with
                    `type` to register.
                type:
                  type: string
                  enum:
                    - photo
                    - video
                    - document
                    - audio
                    - voice
                    - video_note
                    - animation
                    - sticker
                  description: File type (required together with `file_id`)
      responses:
        '201':
          description: File registered, or an upload was requested
          content:
            application/json:
              schema:
                oneOf:
                  - type: object
                    description: Returned when a file_id is registered
                    properties:
                      data:
                        $ref: '#/components/schemas/TelegramFile'
                  - type: object
                    description: >-
                      Returned when the body is empty: the user is asked to send
                      the file to the bot
                    properties:
                      status:
                        type: string
                        example: waiting
                      expires_at:
                        type: string
                        format: date-time
                        description: When the upload request expires
                      bot_username:
                        type: string
                        description: Bot username the user should send the file to
                      chat_id:
                        type: integer
                        description: Chat ID to send the file to
                      token_hint:
                        type: string
                        description: First characters of the bot token
                      max_file_size:
                        type: integer
                        description: Maximum file size in bytes
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden — lacks access to this bot
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: The user has not started the bot
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: >-
            Validation error. When registering: `file_id` invalid (Telegram
            rejected it) or `type` does not match the file.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    TelegramFile:
      type: object
      properties:
        id:
          type: integer
          description: File ID
        type:
          type: string
          enum:
            - photo
            - video
            - document
            - audio
            - voice
            - video_note
            - animation
            - sticker
          description: File type
        name:
          type:
            - string
            - 'null'
          description: Original file name
        size:
          type:
            - integer
            - 'null'
          description: File size in bytes
        created_at:
          type:
            - string
            - 'null'
          format: date-time
          description: Upload timestamp
    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
  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.