### Install pybitlaunch from source Source: https://github.com/bitlaunchio/pybitlaunch/blob/master/README.md Clone the repository and install using setup.py. ```sh git clone https://github.com/bitlaunchio/pybitlaunch.git cd pybitlaunch python setup.py install ``` -------------------------------- ### Install pybitlaunch via PIP Source: https://github.com/bitlaunchio/pybitlaunch/blob/master/README.md Install the library using the Python package manager. ```sh pip install -U pybitlaunch ``` -------------------------------- ### Show Specific Server Details Source: https://context7.com/bitlaunchio/pybitlaunch/llms.txt Get detailed information about a single server using its unique ID. Includes status, IP address, region, and size. ```python import pybitlaunch client = pybitlaunch.Client("your_api_token") # Get server details by ID server_id = "server-123456" server, err = client.Servers.Show(server_id) if err is not None: print(f"Error: {err}") else: print(f"Server ID: {server.get('id')}") print(f"Name: {server.get('name')}") print(f"Status: {server.get('status')}") print(f"IP Address: {server.get('ipAddress')}") print(f"Region: {server.get('regionID')}") print(f"Size: {server.get('sizeID')}") ``` -------------------------------- ### Get a Specific Transaction Source: https://context7.com/bitlaunchio/pybitlaunch/llms.txt Retrieve details for a specific cryptocurrency transaction using its ID. Handles potential errors during the API call. ```python transaction_id = "tx-123456" transaction, err = client.Transactions.Show(transaction_id) if err is not None: print(f"Error: {err}") else: print(f"Transaction ID: {transaction.get('id')}") print(f"Amount USD: ${transaction.get('amountUSD')}") print(f"Crypto Symbol: {transaction.get('cryptoSymbol')}") print(f"Status: {transaction.get('status')}") ``` -------------------------------- ### Complete Server Provisioning Workflow in Python Source: https://context7.com/bitlaunchio/pybitlaunch/llms.txt Demonstrates the full process of provisioning a new server, including SSH key creation/retrieval, fetching available options, creating the server, and waiting for it to become active. Requires an API token for authentication. ```python import pybitlaunch import time def provision_server(token, server_name): """Complete workflow to provision a new server with SSH access.""" client = pybitlaunch.Client(token) # Step 1: Create or get SSH key ssh_keys = client.SSHKeys.List() if not ssh_keys: new_key = pybitlaunch.SSHKey( name="deploy-key", content="ssh-rsa AAAAB3... user@example.com" ) ssh_key, err = client.SSHKeys.Create(new_key) if err: return None, f"Failed to create SSH key: {err}" ssh_key_id = ssh_key.get('id') else: ssh_key_id = ssh_keys[0].get('id') # Step 2: Get available options host_id = 4 # DigitalOcean options, err = client.CreateOptions.Show(host_id) if err: return None, f"Failed to get options: {err}" # Step 3: Create server new_server = pybitlaunch.Server( name=server_name, hostID=host_id, hostImageID=options['image'][0]['versions'][0]['id'], sizeID=options['size'][0]['id'], regionID=options['region'][0]['id'], sshKeys=[ssh_key_id] ) server, err = client.Servers.Create(new_server) if err: return None, f"Failed to create server: {err}" print(f"Server {server.get('id')} created, waiting for ready state...") # Step 4: Wait for server to be ready server_id = server.get('id') for _ in range(60): server, err = client.Servers.Show(server_id) if err: return None, f"Failed to check server status: {err}" if server.get('status') == 'active': break time.sleep(5) return server, None # Usage token = "your_api_token" server, err = provision_server(token, "my-production-server") if err: print(f"Error: {err}") else: print(f"Server ready at IP: {server.get('ipAddress')}") ``` -------------------------------- ### Initialize pybitlaunch client Source: https://github.com/bitlaunchio/pybitlaunch/blob/master/README.md Import the library and authenticate using an API token. ```python import pybitlaunch ``` ```python client = pybitlaunch.Client(token) ``` -------------------------------- ### Retrieve Server Creation Options Source: https://context7.com/bitlaunchio/pybitlaunch/llms.txt Fetch available server creation options for a given host provider ID. This includes details on images, regions, and server sizes. ```python import pybitlaunch client = pybitlaunch.Client("your_api_token") # Get creation options for a specific host # Host IDs: 4 = DigitalOcean, etc. host_id = 4 create_options, err = client.CreateOptions.Show(host_id) if err is not None: print(f"Error: {err}") else: # Available options include: # - hostID: The host provider ID # - image: Available OS images # - region: Available regions # - size: Available server sizes # - available: Whether host is available # - bandwidthCost: Cost per GB of bandwidth # - planTypes: Available plan types # - hostOptions: Additional host-specific options print(f"Host ID: {create_options.get('hostID')}") # List available images for image in create_options.get('image', []): print(f"Image: {image.get('name')}") for version in image.get('versions', []): print(f" - {version.get('description')} (ID: {version.get('id')})") # List available regions for region in create_options.get('region', []): print(f"Region: {region.get('name')} (ID: {region.get('id')})") # List available sizes for size in create_options.get('size', []): print(f"Size: {size.get('id')} - {size.get('description')}") ``` -------------------------------- ### Retrieve Create Options Source: https://github.com/bitlaunchio/pybitlaunch/blob/master/README.md Fetch available configuration options for a specific host. ```python createOptionsArray, err = client.CreateOptions.Show(hostID) # createOptionsArray = ['hostID', 'image', 'region', 'size', 'available', 'bandwidthCost', 'planTypes', 'hostOptions'] if err is not None: # handle error else: # process data ``` -------------------------------- ### CreateOptions.Show Source: https://context7.com/bitlaunchio/pybitlaunch/llms.txt Retrieves available server creation options for a specific host provider. ```APIDOC ## GET /create-options/{host_id} ### Description Retrieves detailed creation options for servers from a specific host provider, including available images, regions, sizes, and pricing. ### Method GET ### Endpoint `/create-options/{host_id}` ### Parameters #### Path Parameters - **host_id** (integer) - Required - The identifier of the host provider (e.g., 4 for DigitalOcean). ### Response #### Success Response (200) - **hostID** (integer) - The ID of the host provider. - **image** (array) - A list of available operating system images. - **name** (string) - The name of the image. - **versions** (array) - A list of available versions for the image. - **description** (string) - Description of the image version. - **id** (string) - The ID of the image version. - **region** (array) - A list of available regions for deployment. - **name** (string) - The name of the region. - **id** (string) - The ID of the region. - **size** (array) - A list of available server sizes/plans. - **id** (string) - The ID of the server size. - **description** (string) - A description of the server size. - **available** (boolean) - Indicates if the host provider is currently available. - **bandwidthCost** (number) - The cost per gigabyte of bandwidth. - **planTypes** (array) - Available plan types offered by the host. - **hostOptions** (object) - Additional host-specific configuration options. #### Response Example ```json { "hostID": 4, "image": [ { "name": "Ubuntu", "versions": [ { "description": "Ubuntu 20.04 LTS", "id": "10000" }, { "description": "Ubuntu 22.04 LTS", "id": "10001" } ] } ], "region": [ { "name": "New York 1", "id": "lon1" }, { "name": "London 1", "id": "nyc1" } ], "size": [ { "id": "nibble-1024", "description": "1 vCPU, 1024MB RAM" }, { "id": "small-2048", "description": "2 vCPU, 2048MB RAM" } ], "available": true, "bandwidthCost": 0.01, "planTypes": ["standard", "cpu-optimized"], "hostOptions": {} } ``` ``` -------------------------------- ### Initialize pybitlaunch Client Source: https://context7.com/bitlaunchio/pybitlaunch/llms.txt Initialize the pybitlaunch client with your BitLaunch API token. This client object is used to access all available services. ```python import pybitlaunch # Initialize the client with your API token # Get your token from: https://app.bitlaunch.io/account/api token = "your_api_token_here" client = pybitlaunch.Client(token) # The client provides access to all services: # - client.Account # - client.SSHKeys # - client.Servers # - client.Transactions # - client.CreateOptions ``` -------------------------------- ### Servers.Create Source: https://context7.com/bitlaunchio/pybitlaunch/llms.txt Creates a new cloud server with specified configuration. ```APIDOC ## POST /servers ### Description Provisions a new cloud server based on the provided configuration, including host provider, image, size, region, and access credentials. ### Method POST ### Endpoint `/servers` ### Parameters #### Request Body - **name** (string) - Required - A name for the new server. - **hostID** (integer) - Required - The identifier of the host provider (e.g., 4 for DigitalOcean). - **hostImageID** (string) - Required - The ID of the operating system image to use. - **sizeID** (string) - Required - The ID of the server size or plan. - **regionID** (string) - Required - The ID of the region where the server will be deployed. - **sshKeys** (array of strings) - Optional - A list of SSH key IDs for accessing the server. Use this OR `password`. - **password** (string) - Optional - The root password for accessing the server. Use this OR `sshKeys`. - **initscript** (string) - Optional - A script to be executed upon server initialization. ### Request Example ```json { "name": "my-web-server", "hostID": 4, "hostImageID": "10000", "sizeID": "nibble-1024", "regionID": "lon1", "sshKeys": ["ssh-key-id-123"], "password": null, "initscript": "#!/bin/bash\necho \"Hello, World!\" > /root/hello.txt" } ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier for the newly created server. - **name** (string) - The name assigned to the server. - **status** (string) - The initial status of the server (e.g., "pending"). #### Response Example ```json { "id": "server-new-987654", "name": "my-web-server", "status": "pending" } ``` ``` -------------------------------- ### Create a New Cloud Server Source: https://context7.com/bitlaunchio/pybitlaunch/llms.txt Provision a new cloud server with specified configurations, including name, host provider, image, size, region, and SSH keys or password. ```python import pybitlaunch client = pybitlaunch.Client("your_api_token") # First, get your SSH key IDs ssh_keys = client.SSHKeys.List() ssh_key_ids = [key.get('id') for key in ssh_keys] if ssh_keys else [] # Create a new server object new_server = pybitlaunch.Server( name="my-web-server", hostID=4, # Host provider ID (e.g., 4 for DigitalOcean) hostImageID="10000", # OS image ID sizeID="nibble-1024", # Server size/plan ID regionID="lon1", # Region ID sshKeys=ssh_key_ids, # List of SSH key IDs (use this OR password) password=None, # Root password (use this OR sshKeys) initscript=None # Optional initialization script ) # Create the server server, err = client.Servers.Create(new_server) if err is not None: print(f"Error creating server: {err}") else: print(f"Server created successfully!") print(f"Server ID: {server.get('id')}") print(f"Name: {server.get('name')}") print(f"Status: {server.get('status')}") ``` -------------------------------- ### Manage Servers Source: https://github.com/bitlaunchio/pybitlaunch/blob/master/README.md Perform lifecycle operations on servers including creation, destruction, and configuration updates. ```python serverObj, err = client.Servers.List() if err is not None: # handle error else: # process data ``` ```python serverObj, err = client.Servers.Show(serverObj.id) if err is not None: # handle error else: # process data ``` ```python newServer = pybitlaunch.Server( name = "myServer", hostID = 4, hostImageID = "10000", sizeID = "nibble-1024", regionID = "lon1", password = "MySecurePassword", # Optional must use sshKeys instead sshKeys = [sshKeyObj["id"]], # Optional must use password instead initscript = None # Optional ) serverObj, err = client.Servers.Create(serverObj) if err is not None: # handle error else: # process data ``` ```python err = client.Servers.Destroy(serverObj.id) if err is not None: # handle error ``` ```python createOpts, err = client.CreateOptions.Show(4) if err is not None: # handle error newImage = pybitlaunch.RebuildImage( createOpts["image"][0]["versions"][1]["id"], createOpts["image"][0]["versions"][1]["description"] ) err = client.Servers.Rebuild(serverObj.id, newImage) if err is not None: # handle error ``` ```python err = client.Servers.Resize(serverObj.id, "nibble-2048") if err is not None: # handle error ``` ```python err = client.Servers.Restart(serverObj.id) if err is not None: # handle error ``` ```python server, err = client.Servers.Protection(serverObj.id, True) if err is not None: # handle error else: # process data ``` ```python ports = [ pybitlaunch.Port(1234, "tcp"), pybitlaunch.Port(1234, "udp"), pybitlaunch.Port(1235, "tcp"), ] server, err = client.Servers.SetPorts(serverObj.id, ports) if err is not None: # handle error else: # process data ``` -------------------------------- ### Show Account Information Source: https://context7.com/bitlaunchio/pybitlaunch/llms.txt Retrieve current account details, including user information and balance. Ensure the client is initialized with a valid API token. ```python import pybitlaunch client = pybitlaunch.Client("your_api_token") # Get account information account_info = client.Account.Show() if account_info is not None: print(f"Account ID: {account_info.get('id')}") print(f"Email: {account_info.get('email')}") print(f"Balance: ${account_info.get('balance', 0)}") ``` -------------------------------- ### POST /Servers.Resize Source: https://context7.com/bitlaunchio/pybitlaunch/llms.txt Changes the plan or size of an existing server. ```APIDOC ## POST /Servers.Resize ### Description Resizes a server to a different plan. ### Parameters #### Path Parameters - **server_id** (string) - Required - The unique identifier of the server. #### Request Body - **new_size** (string) - Required - The target size ID. ``` -------------------------------- ### POST /Servers.Restart Source: https://context7.com/bitlaunchio/pybitlaunch/llms.txt Initiates a restart for a running server. ```APIDOC ## POST /Servers.Restart ### Description Restarts a running server. ### Parameters #### Path Parameters - **server_id** (string) - Required - The unique identifier of the server. ``` -------------------------------- ### List All Servers Source: https://context7.com/bitlaunchio/pybitlaunch/llms.txt Retrieve a list of all servers associated with the account. Displays basic information for each server. ```python import pybitlaunch client = pybitlaunch.Client("your_api_token") # Get all servers servers, err = client.Servers.List() if err is not None: print(f"Error: {err}") else: for server in servers.get('servers', []): print(f"Server ID: {server.get('id')}") print(f"Name: {server.get('name')}") print(f"Status: {server.get('status')}") print(f"IP Address: {server.get('ipAddress')}") print("---") ``` -------------------------------- ### Servers.List Source: https://context7.com/bitlaunchio/pybitlaunch/llms.txt Lists all servers associated with the user's account. ```APIDOC ## GET /servers ### Description Retrieves a list of all servers currently provisioned under the user's account. ### Method GET ### Endpoint `/servers` ### Response #### Success Response (200) - **servers** (array) - A list of server objects. - **id** (string) - The unique identifier for the server. - **name** (string) - The name assigned to the server. - **status** (string) - The current operational status of the server (e.g., "active", "pending", "stopped"). - **ipAddress** (string) - The primary IP address assigned to the server. - **regionID** (string) - The ID of the region where the server is located. - **sizeID** (string) - The ID of the server size or plan. #### Response Example ```json { "servers": [ { "id": "server-123456", "name": "web-server-01", "status": "active", "ipAddress": "192.0.2.1", "regionID": "nyc1", "sizeID": "small-2048" }, { "id": "server-789012", "name": "db-server-01", "status": "active", "ipAddress": "192.0.2.2", "regionID": "lon1", "sizeID": "medium-4096" } ] } ``` ``` -------------------------------- ### POST /Servers.Rebuild Source: https://context7.com/bitlaunchio/pybitlaunch/llms.txt Rebuilds an existing server with a new OS image while maintaining the same server ID. ```APIDOC ## POST /Servers.Rebuild ### Description Rebuilds a server with a new OS image. ### Parameters #### Path Parameters - **server_id** (string) - Required - The unique identifier of the server. #### Request Body - **hostImageID** (string) - Required - The ID of the image version. - **imageDescription** (string) - Required - Description of the image. ``` -------------------------------- ### SSHKeys.Create Source: https://context7.com/bitlaunchio/pybitlaunch/llms.txt Create a new SSH key for server authentication. ```APIDOC ## POST /ssh-keys ### Description Create a new SSH key for server authentication. ### Method POST ### Request Body - **name** (string) - Required - Name of the SSH key - **content** (string) - Required - Public key content ``` -------------------------------- ### List SSH Keys Source: https://context7.com/bitlaunchio/pybitlaunch/llms.txt Retrieve a list of all SSH keys associated with your BitLaunch account. Each key object contains its ID, name, and fingerprint. ```python import pybitlaunch client = pybitlaunch.Client("your_api_token") # Get all SSH keys ssh_keys = client.SSHKeys.List() if ssh_keys is not None: for key in ssh_keys: print(f"Key ID: {key.get('id')}") print(f"Key Name: {key.get('name')}") print(f"Fingerprint: {key.get('fingerprint')}") print("---") ``` -------------------------------- ### Servers.Show Source: https://context7.com/bitlaunchio/pybitlaunch/llms.txt Retrieves detailed information about a specific server. ```APIDOC ## GET /servers/{server_id} ### Description Fetches detailed information for a single server, identified by its unique ID. ### Method GET ### Endpoint `/servers/{server_id}` ### Parameters #### Path Parameters - **server_id** (string) - Required - The unique identifier of the server to retrieve. ### Response #### Success Response (200) - **id** (string) - The unique identifier for the server. - **name** (string) - The name assigned to the server. - **status** (string) - The current operational status of the server. - **ipAddress** (string) - The primary IP address assigned to the server. - **regionID** (string) - The ID of the region where the server is located. - **sizeID** (string) - The ID of the server size or plan. #### Response Example ```json { "id": "server-123456", "name": "web-server-01", "status": "active", "ipAddress": "192.0.2.1", "regionID": "nyc1", "sizeID": "small-2048" } ``` ``` -------------------------------- ### Manage Transactions Source: https://github.com/bitlaunchio/pybitlaunch/blob/master/README.md List, show, and create financial transactions. ```python transactionObjArray, err = client.Transactions.List(page=1, pPage=25) # Optional: page, pPage if err is not None: # handle error else: # process data ``` ```python transactionObj, err = client.Transactions.Show(transactionObj.id) if err is not None: # handle error else: # process data ``` ```python newTransaction = pybitlaunch.Transaction( amountUSD = 20, cryptoSymbol = None, # Optional lightningNetwork = None # Optional ) transactionObj, err = client.Transactions.Create(newTransaction) if err is not None: # handle error else: # process data ``` -------------------------------- ### Manage SSH Keys Source: https://github.com/bitlaunchio/pybitlaunch/blob/master/README.md List, create, and delete SSH keys for server access. ```python sshKeyObjArray = client.SSHKeys.List() if sshKeyObjArray is not None: # process data ``` ```python newKey = pybitlaunch.SSHKey(name="sshkey_name", content="sshkey_rsa_pub") sshKeyObj, err = client.SSHKeys.Create(newKey) if err is not None: # handle error else: # process data ``` ```python err = client.SSHKeys.Delete(sshKeyObj.id) if err is not None: # handle error ``` -------------------------------- ### Rebuild Server with New OS Image Source: https://context7.com/bitlaunchio/pybitlaunch/llms.txt Rebuilds a server using a specified OS image version while retaining the server ID. First, retrieve available images for the host, then construct a RebuildImage object with the desired image version ID and description. ```python import pybitlaunch client = pybitlaunch.Client("your_api_token") # First, get available images for the host host_id = 4 create_opts, err = client.CreateOptions.Show(host_id) if err is not None: print(f"Error getting options: {err}") else: # Select an image version for rebuild image = create_opts['image'][0] version = image['versions'][0] # Create a RebuildImage object new_image = pybitlaunch.RebuildImage( hostImageID=version['id'], imageDescription=version['description'] ) # Rebuild the server server_id = "server-123456" err = client.Servers.Rebuild(server_id, new_image) if err is not None: print(f"Error rebuilding server: {err}") else: print("Server rebuild initiated successfully") ``` -------------------------------- ### Servers API Source: https://github.com/bitlaunchio/pybitlaunch/blob/master/README.md Endpoints for managing server lifecycle, including creation, destruction, and configuration. ```APIDOC ## GET /servers ### Description List all servers. ## GET /servers/{id} ### Description Show details for a specific server. ## POST /servers ### Description Create a new server. ## DELETE /servers/{id} ### Description Destroy a server. ## POST /servers/{id}/rebuild ### Description Rebuild a server with a new image. ## POST /servers/{id}/resize ### Description Resize a server. ## POST /servers/{id}/restart ### Description Restart a server. ## POST /servers/{id}/protection ### Description Toggle server protection. ## POST /servers/{id}/setports ### Description Configure server ports. ``` -------------------------------- ### Account.Show Source: https://context7.com/bitlaunchio/pybitlaunch/llms.txt Retrieve current account information including user details and balance. ```APIDOC ## GET /account ### Description Retrieve current account information including user details and balance. ### Method GET ### Response #### Success Response (200) - **id** (string) - Account ID - **email** (string) - User email - **balance** (float) - Account balance in USD ``` -------------------------------- ### Restart Running Server Source: https://context7.com/bitlaunchio/pybitlaunch/llms.txt Restarts a server that is currently running. Provide the server ID to initiate the restart process. ```python import pybitlaunch client = pybitlaunch.Client("your_api_token") # Restart a server server_id = "server-123456" err = client.Servers.Restart(server_id) if err is not None: print(f"Error restarting server: {err}") else: print("Server restart initiated successfully") ``` -------------------------------- ### Resize Server to Different Plan Source: https://context7.com/bitlaunchio/pybitlaunch/llms.txt Resizes a server to a new plan or size. Specify the server ID and the target size ID for the operation. ```python import pybitlaunch client = pybitlaunch.Client("your_api_token") # Resize a server to a larger plan server_id = "server-123456" new_size = "nibble-2048" # Target size ID err = client.Servers.Resize(server_id, new_size) if err is not None: print(f"Error resizing server: {err}") else: print(f"Server resize to {new_size} initiated successfully") ``` -------------------------------- ### SSHKeys.List Source: https://context7.com/bitlaunchio/pybitlaunch/llms.txt List all SSH keys associated with the account. ```APIDOC ## GET /ssh-keys ### Description List all SSH keys associated with the account. ### Method GET ``` -------------------------------- ### Show Transaction Details Source: https://context7.com/bitlaunchio/pybitlaunch/llms.txt Retrieve detailed information for a specific transaction by its unique ID. Requires the client to be initialized. ```python import pybitlaunch client = pybitlaunch.Client("your_api_token") ``` -------------------------------- ### Manage Account Data Source: https://github.com/bitlaunchio/pybitlaunch/blob/master/README.md Retrieve account information, usage statistics, and history. ```python accountObj = client.Account.Show() if accountObj is not None: # process data ``` ```python usage = client.Account.Usage("2020-10") if usage is not None: # process data ``` ```python history = client.Account.History(1, 25) if history is not None: # process data ``` -------------------------------- ### Create SSH Key Source: https://context7.com/bitlaunchio/pybitlaunch/llms.txt Create a new SSH key for server authentication. Requires a name for the key and its content (public key). ```python import pybitlaunch client = pybitlaunch.Client("your_api_token") # Create a new SSH key object new_key = pybitlaunch.SSHKey( name="my-deploy-key", content="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC... user@example.com" ) # Submit the key to BitLaunch ssh_key_obj, err = client.SSHKeys.Create(new_key) if err is not None: print(f"Error creating SSH key: {err}") else: print(f"Created SSH key with ID: {ssh_key_obj.get('id')}") print(f"Fingerprint: {ssh_key_obj.get('fingerprint')}") ``` -------------------------------- ### Destroy Server by ID Source: https://context7.com/bitlaunchio/pybitlaunch/llms.txt Use this to permanently delete a server. Ensure you have the correct server ID before proceeding. ```python server_id = "server-123456" err = client.Servers.Destroy(server_id) if err is not None: print(f"Error destroying server: {err}") else: print("Server destroyed successfully") ``` -------------------------------- ### Show Account Usage Source: https://context7.com/bitlaunchio/pybitlaunch/llms.txt Retrieve account usage statistics for a specified billing period (YYYY-MM format) or the latest available usage data. ```python import pybitlaunch client = pybitlaunch.Client("your_api_token") # Get usage for a specific month (format: YYYY-MM) usage = client.Account.Usage("2024-01") if usage is not None: print(f"Usage data: {usage}") # Get latest usage (default) latest_usage = client.Account.Usage() if latest_usage is not None: print(f"Latest usage: {latest_usage}") ``` -------------------------------- ### POST /Servers.SetPorts Source: https://context7.com/bitlaunchio/pybitlaunch/llms.txt Configures the list of allowed ports for servers with DDoS protection enabled. ```APIDOC ## POST /Servers.SetPorts ### Description Sets allowed ports for DDoS-protected servers. ### Parameters #### Path Parameters - **server_id** (string) - Required - The unique identifier of the server. #### Request Body - **ports** (array) - Required - List of port objects containing portNumber and protocol. ``` -------------------------------- ### Destroy a Server Source: https://context7.com/bitlaunchio/pybitlaunch/llms.txt Permanently delete a server from your account using its ID. This action is irreversible. ```python import pybitlaunch client = pybitlaunch.Client("your_api_token") ``` -------------------------------- ### Show Account History Source: https://context7.com/bitlaunchio/pybitlaunch/llms.txt Retrieve account security and activity history. Supports pagination by specifying the page number and items per page. ```python import pybitlaunch client = pybitlaunch.Client("your_api_token") # Get account history with pagination # Parameters: page (int), items per page (int) history = client.Account.History(page=1, items=25) if history is not None: for event in history.get('events', []): print(f"Event: {event.get('action')} at {event.get('timestamp')}") ``` -------------------------------- ### Account.History Source: https://context7.com/bitlaunchio/pybitlaunch/llms.txt Retrieve account security and activity history with pagination support. ```APIDOC ## GET /account/history ### Description Retrieve account security and activity history with pagination support. ### Method GET ### Parameters #### Query Parameters - **page** (int) - Optional - Page number - **items** (int) - Optional - Items per page ``` -------------------------------- ### Transactions.List Source: https://context7.com/bitlaunchio/pybitlaunch/llms.txt List all transactions with pagination support. ```APIDOC ## GET /transactions ### Description List all transactions with pagination support. ### Method GET ### Parameters #### Query Parameters - **page** (int) - Optional - Page number - **pPage** (int) - Optional - Items per page ``` -------------------------------- ### Transactions.Create Source: https://context7.com/bitlaunchio/pybitlaunch/llms.txt Creates a new cryptocurrency payment transaction. ```APIDOC ## POST /transactions ### Description Creates a new cryptocurrency payment transaction. You can specify the amount in USD, the cryptocurrency symbol, and whether to use the Lightning Network. ### Method POST ### Endpoint `/transactions` ### Parameters #### Request Body - **amountUSD** (number) - Required - The amount for the transaction in USD. - **cryptoSymbol** (string) - Optional - The symbol of the cryptocurrency to use (e.g., "BTC", "ETH"). Defaults to a system-defined default if not provided. - **lightningNetwork** (boolean) - Optional - Whether to use the Lightning Network for Bitcoin transactions. Defaults to false. ### Request Example ```json { "amountUSD": 20, "cryptoSymbol": "BTC", "lightningNetwork": false } ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier for the newly created transaction. - **paymentAddress** (string) - The address where the payment should be sent. - **cryptoAmount** (number) - The exact amount of cryptocurrency to be paid. - **cryptoSymbol** (string) - The symbol of the cryptocurrency for this transaction. #### Response Example ```json { "id": "tx-abcdef123456", "paymentAddress": "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa", "cryptoAmount": 0.0005, "cryptoSymbol": "BTC" } ``` ``` -------------------------------- ### Create a New Cryptocurrency Transaction Source: https://context7.com/bitlaunchio/pybitlaunch/llms.txt Initiate a new cryptocurrency payment transaction. Specify the amount in USD and optionally the cryptocurrency symbol and whether to use the Lightning Network. ```python import pybitlaunch client = pybitlaunch.Client("your_api_token") # Create a new transaction for account funding new_transaction = pybitlaunch.Transaction( amountUSD=20, # Amount in USD (required) cryptoSymbol="BTC", # Cryptocurrency symbol (optional) lightningNetwork=False # Use Lightning Network (optional) ) transaction, err = client.Transactions.Create(new_transaction) if err is not None: print(f"Error creating transaction: {err}") else: print(f"Transaction created: {transaction.get('id')}") print(f"Payment address: {transaction.get('paymentAddress')}") print(f"Amount to pay: {transaction.get('cryptoAmount')} {transaction.get('cryptoSymbol')}") ``` -------------------------------- ### Configure Allowed Ports for DDoS Protection Source: https://context7.com/bitlaunchio/pybitlaunch/llms.txt Sets the allowed ports for DDoS-protected servers. Define a list of `Port` objects, each specifying a port number and protocol. The response includes the configured allowed ports. ```python import pybitlaunch client = pybitlaunch.Client("your_api_token") # Define ports to allow through DDoS protection ports = [ pybitlaunch.Port(portNumber=22, protocol="tcp"), # SSH pybitlaunch.Port(portNumber=80, protocol="tcp"), # HTTP pybitlaunch.Port(portNumber=443, protocol="tcp"), # HTTPS pybitlaunch.Port(portNumber=25565, protocol="tcp"), # Minecraft pybitlaunch.Port(portNumber=25565, protocol="udp"), # Minecraft UDP ] # Set allowed ports on a protected server server_id = "server-123456" server, err = client.Servers.SetPorts(server_id, ports) if err is not None: print(f"Error setting ports: {err}") else: print("Ports configured successfully") print(f"Allowed ports: {server.get('allowedPorts')}") ``` -------------------------------- ### Account.Usage Source: https://context7.com/bitlaunchio/pybitlaunch/llms.txt Retrieve account usage statistics for a specific billing period. ```APIDOC ## GET /account/usage ### Description Retrieve account usage statistics for a specific billing period. ### Method GET ### Parameters #### Query Parameters - **period** (string) - Optional - Billing period in YYYY-MM format ``` -------------------------------- ### POST /Servers.Protection Source: https://context7.com/bitlaunchio/pybitlaunch/llms.txt Enables or disables DDoS protection for a specific server. ```APIDOC ## POST /Servers.Protection ### Description Configures DDoS protection settings. ### Parameters #### Path Parameters - **server_id** (string) - Required - The unique identifier of the server. #### Request Body - **enabled** (boolean) - Required - Whether to enable or disable protection. ### Response #### Success Response (200) - **protectedIP** (string) - The IP address protected by the service. ``` -------------------------------- ### DELETE /Servers.Destroy Source: https://context7.com/bitlaunchio/pybitlaunch/llms.txt Permanently deletes a server instance by its unique identifier. ```APIDOC ## DELETE /Servers.Destroy ### Description Destroys a server instance by its ID. ### Parameters #### Path Parameters - **server_id** (string) - Required - The unique identifier of the server to destroy. ``` -------------------------------- ### Servers.Destroy Source: https://context7.com/bitlaunchio/pybitlaunch/llms.txt Permanently deletes a server by its ID. ```APIDOC ## DELETE /servers/{server_id} ### Description Initiates the permanent deletion of a specified server. This action cannot be undone. ### Method DELETE ### Endpoint `/servers/{server_id}` ### Parameters #### Path Parameters - **server_id** (string) - Required - The unique identifier of the server to delete. ### Response #### Success Response (200) - **message** (string) - Confirmation message indicating the server deletion has been initiated. #### Response Example ```json { "message": "Server deletion initiated for server-123456." } ``` ``` -------------------------------- ### Account API Source: https://github.com/bitlaunchio/pybitlaunch/blob/master/README.md Endpoints for retrieving account information, usage statistics, and history. ```APIDOC ## GET /account ### Description Retrieve current account information. ### Method GET ## GET /account/usage ### Description Retrieve account usage for a specific period. ### Parameters #### Query Parameters - **period** (string) - Required - The billing period (e.g., "2020-10") ## GET /account/history ### Description Retrieve account history. ### Parameters #### Query Parameters - **page** (integer) - Required - Page number - **pPage** (integer) - Required - Items per page ``` -------------------------------- ### Enable/Disable Server DDoS Protection Source: https://context7.com/bitlaunchio/pybitlaunch/llms.txt Manages DDoS protection for a server. Use `enabled=True` to enable and `enabled=False` to disable. The response includes the protected IP if protection is enabled. ```python import pybitlaunch client = pybitlaunch.Client("your_api_token") server_id = "server-123456" # Enable DDoS protection server, err = client.Servers.Protection(server_id, enabled=True) if err is not None: print(f"Error enabling protection: {err}") else: print("DDoS protection enabled") print(f"Protected IP: {server.get('protectedIP')}") # Disable DDoS protection server, err = client.Servers.Protection(server_id, enabled=False) if err is not None: print(f"Error disabling protection: {err}") else: print("DDoS protection disabled") ``` -------------------------------- ### SSHKeys API Source: https://github.com/bitlaunchio/pybitlaunch/blob/master/README.md Endpoints for managing SSH keys associated with the account. ```APIDOC ## GET /sshkeys ### Description List all SSH keys. ## POST /sshkeys ### Description Create a new SSH key. ### Request Body - **name** (string) - Required - Name of the key - **content** (string) - Required - Public key content ## DELETE /sshkeys/{id} ### Description Delete an existing SSH key. ### Parameters #### Path Parameters - **id** (integer) - Required - The ID of the SSH key to delete ``` -------------------------------- ### Transactions.Show Source: https://context7.com/bitlaunchio/pybitlaunch/llms.txt Retrieves details of a specific cryptocurrency transaction. ```APIDOC ## GET /transactions/{transaction_id} ### Description Retrieves details of a specific cryptocurrency transaction using its ID. ### Method GET ### Endpoint `/transactions/{transaction_id}` ### Parameters #### Path Parameters - **transaction_id** (string) - Required - The unique identifier of the transaction. ### Response #### Success Response (200) - **id** (string) - The transaction ID. - **amountUSD** (number) - The amount of the transaction in USD. - **cryptoSymbol** (string) - The symbol of the cryptocurrency used in the transaction. - **status** (string) - The current status of the transaction. #### Response Example ```json { "id": "tx-123456", "amountUSD": 50.75, "cryptoSymbol": "BTC", "status": "completed" } ``` ``` -------------------------------- ### List Transactions Source: https://context7.com/bitlaunchio/pybitlaunch/llms.txt Retrieve a list of all transactions associated with your account. Supports pagination by specifying page number and items per page. ```python import pybitlaunch client = pybitlaunch.Client("your_api_token") # List transactions with pagination # Parameters: page (int), items per page (int) transactions, err = client.Transactions.List(page=1, pPage=25) if err is not None: print(f"Error: {err}") else: for tx in transactions.get('transactions', []): print(f"Transaction ID: {tx.get('id')}") print(f"Amount: ${tx.get('amountUSD')}") print(f"Status: {tx.get('status')}") print("---") ``` -------------------------------- ### Delete SSH Key Source: https://context7.com/bitlaunchio/pybitlaunch/llms.txt Delete an existing SSH key from your account by providing its unique ID. This action cannot be undone. ```python import pybitlaunch client = pybitlaunch.Client("your_api_token") # Delete an SSH key by ID key_id = "abc123-key-id" err = client.SSHKeys.Delete(key_id) if err is not None: print(f"Error deleting SSH key: {err}") else: print("SSH key deleted successfully") ``` -------------------------------- ### SSHKeys.Delete Source: https://context7.com/bitlaunchio/pybitlaunch/llms.txt Delete an SSH key from the account by its ID. ```APIDOC ## DELETE /ssh-keys/{id} ### Description Delete an SSH key from the account by its ID. ### Method DELETE ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the SSH key to delete ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.