# Create a new VPN subscription

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /api/public/v1/subscription/create:
    post:
      summary: Create a new VPN subscription
      deprecated: false
      description: ''
      tags:
        - 📢 Public
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - serverId
                - duration
              properties:
                serverId:
                  type: string
                duration:
                  type: integer
                  enum:
                    - 1
                    - 3
                    - 6
                    - 12
                referralCode:
                  type: string
                  nullable: true
              x-apidog-orders:
                - serverId
                - duration
                - referralCode
              x-apidog-ignore-properties: []
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceOrder'
          headers: {}
          x-apidog-name: ''
        '400':
          description: Invalid Input
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
          headers: {}
          x-apidog-name: ''
        '503':
          description: Service Unavailable (Maintenance Mode)
          headers: {}
          x-apidog-name: ''
      security: []
      x-apidog-folder: 📢 Public
      x-apidog-status: released
      x-run-in-apidog: https://app.eu.apidog.com/web/project/361232/apis/api-4063129-run
components:
  schemas:
    InvoiceOrder:
      type: object
      required:
        - invoice
        - paymentHash
        - amountSats
        - orderId
      properties:
        invoice:
          type: string
          description: BOLT11 encoded Lightning Network invoice.
        paymentHash:
          type: string
          description: SHA-256 hash representing the invoice.
        amountSats:
          type: integer
          description: Amount in Satoshis.
        orderId:
          type: string
          format: uuid
          description: TunnelSats internal UUID.
      x-apidog-orders:
        - invoice
        - paymentHash
        - amountSats
        - orderId
      x-apidog-ignore-properties: []
      x-apidog-folder: ''
    ApiError:
      type: object
      required:
        - error
        - message
      properties:
        error:
          type: string
          description: Machine-readable error code.
          examples:
            - ERR_RATE_LIMIT_EXCEEDED
        message:
          type: string
          description: Human-readable explanation.
          examples:
            - Too many requests.
        details:
          type: object
          x-apidog-orders: []
          properties: {}
          x-apidog-ignore-properties: []
          nullable: true
      x-apidog-orders:
        - error
        - message
        - details
      x-apidog-ignore-properties: []
      x-apidog-folder: ''
  securitySchemes:
    ApiKeyAuth:
      type: bearer
      scheme: bearer
      description: Authenticate using your TunnelSats API Key (sk_live_...).
    NostrAuth:
      type: bearer
      scheme: bearer
      description: >-
        NIP-98 Nostr Authentication. The 'token' should be the base64-encoded
        NIP-98 event JSON.
servers:
  - url: https://tunnelsats.com
    description: Prod Env
security: []

```