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

# newBot

> Create new bot.



## OpenAPI

````yaml /openapi.yaml post /newBot
openapi: 3.1.0
info:
  title: AlphaInsider
  version: '1.0'
  description: >-
    The official API and websocket documentation for
    [AlphaInsider.com](https://alphainsider.com/)
servers:
  - url: https://alphainsider.com/api
security: []
tags:
  - name: Introduction
  - name: Authentication
  - name: Users
  - name: Strategies
  - name: Subscriptions
  - name: Payments
  - name: Withdrawals
  - name: Timelines
  - name: Stocks
  - name: Trades
  - name: Webhooks
  - name: Bots
  - name: Websockets
paths:
  /newBot:
    post:
      tags:
        - Bots
      summary: newBot
      description: Create new bot.
      operationId: newBot
      parameters:
        - $ref: '#/components/parameters/api_token'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - broker
                - broker_keys
              properties:
                broker:
                  type: string
                  description: Bot broker.
                  enum:
                    - bitfinex
                    - binance
                    - alpaca
                    - hyperliquid
                broker_keys:
                  $ref: '#/components/schemas/broker_keys'
      responses:
        '200':
          description: Request was successful.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    $ref: '#/components/schemas/success'
                  response:
                    type: object
                    description: >-
                      Endpoint-specific response payload, or an error message
                      when `success` is false.
                    properties:
                      bot_id:
                        $ref: '#/components/schemas/bot_id'
                      user_id:
                        $ref: '#/components/schemas/user_id'
                      leverage:
                        type: string
                        description: Requested leverage.
                      slippage:
                        type: string
                        description: Slippage value or configured slippage fraction.
                      rebalance_on_start:
                        type: boolean
                        description: Whether the bot rebalances when started.
                      close_on_stop:
                        type: boolean
                        description: Whether the bot closes positions when stopped.
                      broker:
                        type: string
                        enum:
                          - hyperliquid
                          - bitfinex
                          - binance
                          - alpaca
                        description: Broker used by the bot.
                      type:
                        type: string
                        enum:
                          - cryptocurrency
                          - stock
                        description: Type or category for this object.
                      live:
                        type: boolean
                        description: Whether the broker account is live rather than paper.
                      account_id:
                        type: string
                        description: Broker account identifier.
                      status:
                        type: string
                        enum:
                          - 'on'
                          - scheduled_rebalance
                          - rebalancing
                          - scheduled_close
                          - closing
                          - stopping
                          - 'off'
                        description: Current status.
                      notifications:
                        type: array
                        description: Enabled notification types.
                        items:
                          type: string
                          enum:
                            - start
                            - stop
                            - info
                            - warning
                            - error
                      updated_at:
                        $ref: '#/components/schemas/updated_at'
                      created_at:
                        $ref: '#/components/schemas/created_at'
              examples:
                '200':
                  value:
                    success: true
                    response:
                      bot_id: h_zZfeqsX9o8hgB8DVc0P
                      user_id: user_1
                      leverage: '2.000000000000000'
                      slippage: '0.005000000000000'
                      rebalance_on_start: true
                      close_on_stop: true
                      broker: alpaca
                      type: stock
                      live: false
                      account_id: AAABBBCCC
                      status: 'off'
                      notifications: []
                      updated_at: '2024-10-23T14:36:02.484Z'
                      created_at: '2024-10-23T14:36:02.484Z'
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
components:
  parameters:
    api_token:
      in: header
      name: Authorization
      description: User API token.
      required: true
      schema:
        type: string
        format: JWT
  schemas:
    broker_keys:
      type: object
      description: Broker keys.
      properties:
        live:
          type: boolean
          description: Live or paper account.
        bitfinex_key:
          type: string
          description: Bitfinex key.
        bitfinex_secret:
          type: string
          description: Bitfinex secret.
        binance_key:
          type: string
          description: Binance key.
        binance_secret:
          type: string
          description: Binance secret.
        alpaca_key:
          type: string
          description: Alpaca key.
        alpaca_secret:
          type: string
          description: Alpaca secret.
        hyperliquid_key:
          type: string
          description: Hyperliquid key.
        hyperliquid_secret:
          type: string
          description: Hyperliquid secret.
    success:
      type: boolean
      description: True when the request succeeded.
    bot_id:
      type: string
      description: AlphaInsider bot identifier.
    user_id:
      type: string
      description: AlphaInsider user identifier.
    updated_at:
      type: string
      format: date-time
      description: Last update timestamp.
    created_at:
      type: string
      format: date-time
      description: Creation timestamp.
  responses:
    '400':
      description: Request failed.
      content:
        application/json:
          schema:
            type: object
            properties:
              success:
                type: boolean
                description: False when the request failed.
              response:
                type: string
                description: Error message.
          examples:
            '400':
              value:
                success: false
                response: Request failed.
    '401':
      description: Authentication failed.
      content:
        application/json:
          schema:
            type: object
            properties:
              success:
                type: boolean
                description: False when the request failed.
              response:
                type: string
                description: Error message.
          examples:
            '401':
              value:
                success: false
                response: Authentication failed.

````