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

# Buy Traffic

> Add GB to an existing rotating package.

The package keeps its credentials, geo and rotation settings; only its
traffic ceiling and expiry move. Same money path as a purchase: cap check,
per-user purchase lock, idempotent replay.



## OpenAPI

````yaml /api-reference/proxy.json post /v1/proxy/subscriptions/{sub_id}/traffic/purchase
openapi: 3.1.0
info:
  title: Lumi Proxy API
  version: 1.1.0
  description: >-
    Публичный REST API прокси Lumi. Ключ привязан к одному аккаунту и делает то
    же, что клиент делает в боте.


    Авторизация: `Authorization: Bearer <ключ>`. Денежные запросы дополнительно
    требуют заголовок `Idempotency-Key`.
servers:
  - url: https://api.lumiweb.cc/proxy
    description: production
security:
  - bearerAuth: []
paths:
  /v1/proxy/subscriptions/{sub_id}/traffic/purchase:
    post:
      tags:
        - proxy
      summary: Buy Traffic
      description: >-
        Add GB to an existing rotating package.


        The package keeps its credentials, geo and rotation settings; only its

        traffic ceiling and expiry move. Same money path as a purchase: cap
        check,

        per-user purchase lock, idempotent replay.
      operationId: buy_traffic
      parameters:
        - name: sub_id
          in: path
          required: true
          schema:
            type: integer
            title: Sub Id
        - name: authorization
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Authorization
        - name: Idempotency-Key
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Idempotency-Key
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TrafficTopupRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrderOut'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    TrafficTopupRequest:
      properties:
        quantity_gb:
          type: integer
          maximum: 1000
          minimum: 1
          title: Quantity Gb
      type: object
      required:
        - quantity_gb
      title: TrafficTopupRequest
      description: Add GB to an existing rotating subscription.
    OrderOut:
      properties:
        status:
          type: string
          title: Status
        category:
          type: string
          title: Category
        subscription_id:
          anyOf:
            - type: integer
            - type: 'null'
          title: Subscription Id
        order_id:
          anyOf:
            - type: integer
            - type: 'null'
          title: Order Id
        price_usd:
          anyOf:
            - type: string
            - type: 'null'
          title: Price Usd
        quantity:
          anyOf:
            - type: integer
            - type: 'null'
          title: Quantity
        country:
          anyOf:
            - type: string
            - type: 'null'
          title: Country
        is_top_up:
          type: boolean
          title: Is Top Up
          default: false
        geo_applied:
          type: boolean
          title: Geo Applied
          default: false
        geo_failed:
          type: boolean
          title: Geo Failed
          default: false
      type: object
      required:
        - status
        - category
      title: OrderOut
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Ключ вида lumi_proxy_… Выдаётся оператором.

````