• Website
  • Server status
  • API documentation
  • Blog
Telegram Icon Community
EN
Русский
Português
English
中文 (中国)
Tiếng Việt
Sign in Start free
  • Website
  • Server status
  • API documentation
  • Blog
  • Community
  • English (US) Русский Português English 中文 (中国) Tiếng Việt
Log in View Plans

Custom Python scripts

Build powerful automation workflows with Python and the Multilogin API. Create, manage, and launch browser profiles with fully customizable scripts.

search icon

Try a different keyword or check for typos. If you still need help, contact support.

  • Getting started with Multilogin automation
  • Basic automation with CLI
  • Low-code automation with Postman
  • Script runner & predefined scripts
  • Puppeteer, Selenium, and Playwright
  • Custom Python scripts
  • Quick solutions with Developer Tools
  • External automation tools
  • Home
  • breadcrumb separator bar
  • Explore features
  • breadcrumb separator bar
  • Efficient task automation with API
  • breadcrumb separator bar
  • Custom Python scripts
  • breadcrumb separator bar
  • How to run Multilogin API scripts on multiple servers with Python

How to run Multilogin API scripts on multiple servers with Python

Written by Marcelo B ( Updated on October 15th, 2026 )

Updated on October 15th, 2026

Need to run the same Multilogin API script on several servers? Python and SSH let you run everything from one computer, so you don't have to connect to each server and start the script yourself.

➡️ Generate an automation token → set up SSH access → add remote_api.py to each server → run auto.py from your computer.

This example checks your Multilogin API connection by retrieving a list of cloud phones. Once it works, you can replace the test request with your own automation tasks.

Before you start

You'll need:

  • Python 3 on your computer and remote servers
  • SSH key access to each server, with its host key verified
  • A valid Multilogin automation token
  • Internet access from each server to the Multilogin API

SSH and Multilogin use different credentials. Your SSH key connects you to a server, while your automation token lets the script send Multilogin API requests.

This example uses Linux or macOS servers
You can also use Windows servers, but you'll need to adjust the file paths and Python commands.

 

Step 1: prepare your servers

First, make sure you can connect to each server through SSH.

Open a terminal on your computer and try:

ssh username@server-ip

Replace username and server-ip with your details.

If it's your first connection, check the server's SSH fingerprint with your administrator before trusting it.

Next, install the Python libraries.

On your computer:

python3 -m pip install paramiko

On each remote server:

python3 -m pip install requests

If you're using a Python virtual environment, install the libraries there and use that environment to run your scripts.

Step 2: create the Multilogin API script

Let's start with a simple test. We'll ask the Multilogin API for your cloud phone list to make sure each server can connect.

Create a file called remote_api.py in the home folder of each remote server.

import sys
import requests

token = sys.stdin.readline().strip()

if not token:
    raise SystemExit("No automation token provided.")

url = "https://api.multilogin.com/mobile_profiles/phone/list"

headers = {
    "Authorization": f"Bearer {token}",
    "Accept": "application/json",
}

params = {
    "page": 1,
    "page_size": 10,
}

try:
    response = requests.get(
        url,
        headers=headers,
        params=params,
        timeout=30,
    )
    response.raise_for_status()

    result = response.json()
    status = result.get("status", {})

    if status.get("http_code") != 200:
        raise RuntimeError(
            status.get("message", "Unknown API error")
        )

    print("Connected to Multilogin API successfully.")

except (requests.RequestException, ValueError, RuntimeError) as error:
    print(f"API request failed: {error}")
    raise SystemExit(1)

The script receives your automation token when it runs. You don't need to save your Multilogin email, password, or token in the file.

This test doesn't change your profiles. It only requests the first page of your cloud phone list.

Step 3: create the server connection script

Now let's connect everything.

Create auto.py on your computer. This script connects to each server, passes your automation token, and runs remote_api.py.

import sys
import getpass
import paramiko

servers = [
    {"username": "username1", "host": "server1-ip", "port": 22},
    {"username": "username2", "host": "server2-ip", "port": 22},
]

token = getpass.getpass("Multilogin automation token: ")

if not token:
    raise SystemExit("No automation token provided.")

failed_servers = []

for server in servers:
    username = server["username"]
    host = server["host"]
    port = server.get("port", 22)

    print(f"\nConnecting to {username}@{host}")

    try:
        with paramiko.SSHClient() as ssh:
            ssh.load_system_host_keys()
            ssh.set_missing_host_key_policy(
                paramiko.RejectPolicy()
            )

            ssh.connect(
                hostname=host,
                port=port,
                username=username,
                look_for_keys=True,
                allow_agent=True,
                timeout=15,
            )

            stdin, stdout, stderr = ssh.exec_command(
                "python3 ~/remote_api.py"
            )

            stdin.write(token + "\n")
            stdin.flush()
            stdin.channel.shutdown_write()

            output = stdout.read().decode().strip()
            errors = stderr.read().decode().strip()
            exit_code = stdout.channel.recv_exit_status()

            if output:
                print(output)

            if errors:
                print(errors)

            if exit_code != 0:
                print(f"Script failed with code {exit_code}")
                failed_servers.append(host)

    except Exception as error:
        print(f"Connection failed: {error}")
        failed_servers.append(host)

if failed_servers:
    print("\nFailed servers: " + ", ".join(failed_servers))
    sys.exit(1)

Replace the example usernames, server addresses, and ports with your own.

The script uses SSH keys, so you don't need to put server passwords in your code. It also checks that each server is trusted before connecting.

Step 4: run your scripts

Everything ready? Let's check the connection.

  1. Open a terminal on your computer
  2. Go to the folder containing auto.py
  3. Run:
python3 auto.py
  1. Enter your automation token when prompted.
  2. Check the results for each server.
  3. If a server connects successfully, you'll see:
Connected to Multilogin API successfully.

If something goes wrong, the script will show which server failed.

Your token won't appear while you type it, and the script won't print or save it.

Step 5: add your own automation

Once the test works, you're ready to do more than check the connection.

Replace the test request in remote_api.py with the Multilogin API actions you need.

For example, you can:

  • Get a list of cloud phones or browser profiles
  • Check which profiles are running
  • Create or update profiles
  • Start or stop supported profiles

Say you manage accounts across several servers. You could use this setup to check profile statuses on all of them without connecting to each server separately.

You'll find the available endpoints, required parameters, and response examples in the Multilogin API documentation.

Using local launcher endpoints?
If your script starts or controls browser profiles through the local launcher API, the required Multilogin desktop components must be running on that server. The cloud API connection alone doesn't start the desktop app.

 

Troubleshooting

SSH connection fails

Try connecting manually:

ssh username@server-ip

If that doesn't work, check your SSH key and make sure you have permission to access the server.

If you get an unknown host key error, verify the server's fingerprint and add it to your trusted SSH hosts before trying again.

Python can't find a library

Check that you've installed the right library in the right place:

  • Your computer: paramiko
  • Remote servers: requests

If you use a virtual environment, make sure you're running the script with the correct Python interpreter.

The Multilogin API returns an error

Check the error message first. These are some common responses:

  • 401 – Unauthorized: your automation token may be missing, incorrect, or expired
  • 403 – Forbidden: your workspace or role may not have permission for the request
  • 429 – Too Many Requests: your workspace has reached its API rate limit

For more help, see Multilogin API rate limits and response codes.

Python can't verify the API certificate

If you're using a company proxy or custom network setup, Python might not recognize the certificate used for the connection.

Ask your administrator for the approved certificate authority (CA) bundle and configure Requests to use it.

Don't disable certificate verification. It's there to protect your connection.

Keep your automation token private

Only run these scripts on servers you trust.

Your automation token travels through an encrypted SSH connection, but the remote script can access it while running. Someone with control of that server could potentially capture the token and use its workspace permissions.

Was this article helpful?

Give feedback about this article

In this article

  • Before you start
  • Step 1: prepare your servers
  • Step 2: create the Multilogin API script
  • Step 3: create the server connection script
  • Step 4: run your scripts
  • Step 5: add your own automation
  • Troubleshooting
  • SSH connection fails
  • Python can't find a library
  • The Multilogin API returns an error
  • Python can't verify the API certificate
  • Keep your automation token private

Multilogin community

Stay informed, share your thoughts, and engage with others!

Telegram Icon Join us on Telegram

Read more on the topic

10 Best Datacenter Proxies for Web Scraping (2025 Edition) Apr 2, 2025 5 min read Google SERP Img

What is a Google SERP Proxy and Why Should You Care?

Apr 1, 2025 6 min read
UK Proxy Img

What Are Dedicated UK Proxies? Everything You Need to Know

Apr 1, 2025 6 min read
Related Article Title Icon

Related articles

  • Getting started with automation scripting
  • How to choose the best automation framework
  • How to launch Multilogin desktop app via script
  • How to retrieve API tokens with Python

Mobile

  • Cloud phone
  • Virtual phone
  • Remote phone
  • Phone farming
  • Cloud cell phone
  • Cloud Android emulation
  • AI Quick Action Automation

Multi-accounting

  • Multiple Instagram accounts
  • Multiple Tiktok accounts
  • Multiple Reddit accounts
  • Multiple Telegram accounts
  • Multiple Facebook accounts
  • Multiple Youtube accounts
  • Multiple LinkedIn accounts

COMPARISON

  • Multilogin vs. MoreLogin
  • Multilogin vs. FlashID
  • Multilogin vs. DuoPlus
  • Multilogin vs. VMOS cloud
  • Multilogin vs. Octo Browser
  • Multilogin vs. AdsPower
  • Multilogin vs. GoLogin

Platform proxies

  • Mobile proxy
  • Reddit proxy
  • Instagram proxy
  • TikTok proxy
  • Facebook proxy
  • Youtube proxy
  • LinkedIn proxy

USECASES

  • Cloud phones for Tiktok
  • Cloud phones for Instagram
  • Cloud phones for Reddit
  • Cloud phones for Facebook
  • Cloud phones for Youtube

RESOURCES

  • Knowledge base
  • API documentation
  • Glossary
  • Academy
  • Blog
  • Server status
  • Release notes

FREE TOOLS

  • YouTube views to money calculator
  • Instagram money calculator
  • Online URL to text converter
  • Google local SERP checker
  • Random address generator

GET IN TOUCH

  • Contact 24/7 support
    [email protected]
  • Referral program
  • Affiliate program
  • Pricing page
  • Careers
GDPR Compliant

© 2026 Multilogin. All rights reserved.

  • Privacy policy
  • Terms of service
  • Cookie policy
Multilogin watermark
  • MOBILE

    • Cloud phone
    • Virtual phone
    • Remote phone
    • Phone farming
    • Cloud cell phone
    • Cloud Android emulation
    • AI Quick Action Automation
  • MULTI-ACCOUNTING

    • Multiple Instagram accounts
    • Multiple Tiktok accounts
    • Multiple Reddit accounts
    • Multiple Telegram accounts
    • Multiple Facebook accounts
    • Multiple Youtube accounts
    • Multiple LinkedIn accounts
  • COMPARISON

    • Multilogin vs. MoreLogin
    • Multilogin vs. FlashID
    • Multilogin vs. DuoPlus
    • Multilogin vs. VMOS cloud
    • Multilogin vs. Octo Browser
    • Multilogin vs. AdsPower
    • Multilogin vs. GoLogin
  • PLATFORM PROXIES

    • Mobile proxy
    • Reddit proxy
    • Instagram proxy
    • TikTok proxy
    • Facebook proxy
    • Youtube proxy
    • LinkedIn proxy
  • USECASES

    • Cloud phones for Tiktok
    • Cloud phones for Instagram
    • Cloud phones for Reddit
    • Cloud phones for Facebook
    • Cloud phones for Youtube
  • RESOURCES

    • Knowledge base
    • API documentation
    • Glossary
    • Academy
    • Blog
    • Server status
    • Release notes
  • FREE TOOLS

    • YouTube views to money calculator
    • Instagram money calculator
    • Online URL to text converter
    • Google local SERP checker
    • Random address generator
  • GET IN TOUCH

    • Contact 24/7 support
      [email protected]
    • Referral program
    • Affiliate program
    • Pricing page
    • Careers
GDPR Compliant
  • Privacy policy
  • Terms of service
  • Cookie policy

© 2026 Multilogin. All rights reserved.

Expand