NovelAI /user/subscription/ API

The /user/subscription/ API from NovelAI — 2 operation(s) for /user/subscription/.

OpenAPI Specification

novelai-user-subscription-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: NovelAI Primary /ai/ /ai/ /user/subscription/ API
  description: "\n      The Primary API describes actions that our Frontend makes against the NovelAI backend.\n\n      In general, third-party NovelAI API users should not engage with the Primary API beyond the /ai/ routes.\n\n      Third-party API users developing user-facing applications must ask for a user's Persistent API token to continue.\n      For security reasons it is not recommended to hold a user's credentials in plaintext.\n\n      IMPORTANT: Existing and new API users must read the upcoming generation-specific documentation:\n\n      Image Generation documentation: https://image.novelai.net/docs/index.html\n      Text Generation documentation: https://text.novelai.net/docs/index.html\n    "
  version: '1.0'
  contact: {}
servers:
- url: https://api.novelai.net
  description: NovelAI Primary API
tags:
- name: /user/subscription/
paths:
  /user/subscription/bind:
    post:
      operationId: SubscriptionController_bindSubscription
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BindSubscriptionRequest'
      responses:
        '201':
          description: Subscription has been bound properly.
        '400':
          description: A validation error occured.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '401':
          description: Access Token is incorrect.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '404':
          description: Subscription ID was not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '409':
          description: A conflict occured while binding subscription.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '500':
          description: An unknown error occured.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
      tags:
      - /user/subscription/
      security:
      - bearer: []
  /user/subscription/change:
    post:
      operationId: SubscriptionController_changeSubscriptionPlan
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChangeSubscriptionPlanRequest'
      responses:
        '200':
          description: Subscription plan has been changed properly.
        '400':
          description: A validation error occured.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '401':
          description: Access Token is incorrect.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '404':
          description: Subscription SKU was not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '409':
          description: A conflict occured while changing subscription plan.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '500':
          description: An unknown error occured.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
      tags:
      - /user/subscription/
      security:
      - bearer: []
components:
  schemas:
    ChangeSubscriptionPlanRequest:
      type: object
      properties:
        newSubscriptionPlan:
          enum:
          - 0
          - 1
          - 2
          - 3
          type: number
          description: New plan SKU
      required:
      - newSubscriptionPlan
    BindSubscriptionRequest:
      type: object
      properties:
        paymentProcessor:
          type: string
          enum:
          - giftkey
          - trial
          description: Subscription payment processor
        subscriptionId:
          type: string
          description: Payment processor ID
        confirmedReplace:
          type: object
          default: false
          description: Whether the user confirmed replacing the subscription
        confirmedIgnore:
          type: object
          default: false
          description: Whether the user confirmed ignoring the subscription
      required:
      - paymentProcessor
      - subscriptionId
    ApiError:
      type: object
      properties:
        statusCode:
          type: number
        message:
          type: string
      required:
      - statusCode
      - message
  securitySchemes:
    bearer:
      scheme: bearer
      bearerFormat: JWT
      type: http