Skip to content

ProxyMarket Connector: Sell Your Proxies Without Code

Ask AI

Ready taskInstall and set up pm-connector on your server

Coding agents

Claude CodeOpens the desktop appCodexOpens the desktop appCursorOpens the app from the web

Chat assistants

Open in ChatGPTNew tabOpen in ClaudeNew tab

Copy

View as MarkdownPlain text for AI tools
See the prompt
I run proxies on my own servers and want to sell them on ProxyMarket (market.xproxy.io) with pm-connector. Read https://xproxy.io/document/proxymarket-connector.md. If you cannot open links, download them with curl.
Then, on this machine:
1. Find out how a customer gets a proxy username and password here, and how they are deleted: the API of my panel or backend, or a password file of my proxy software. Ask me what you cannot find.
2. Install pm-connector and run pm-connector init with me. When it asks whether ProxyMarket can reach this server, answer No unless I tell you I forwarded a port or have a public address. I paste the key myself.
3. Write the script in the language my system already uses, following "the script standard" on the page, or start from the closest ready one (pm-connector sample shows them) and change it: the create and delete actions first, then rotate, whitelist and list only if my system can do them (delete the others).
4. Run pm-connector test and fix every ❌ line. Show me what my script printed when an action fails.
5. Install it as a service.
6. Tell me which plans to add in the Vendor Dashboard (name, country, price, proxy IP and port) and remind me to send a test order.
Never print or commit my API keys, passwords or customer logins. Ask me before you open firewall ports, restart services or change config files you did not create.
Other XProxy guides, each with a Markdown copy at its URL + .md, are listed in https://xproxy.io/llms.txt.

The app opens with the prompt filled in. Nothing runs until you press Enter.

You already sell proxies from your own servers. pm-connector is a small program that lets ProxyMarket sell them for you. When a customer pays, it lets that customer into your proxy. When the rental ends, it shuts them out again. You do not need a domain or an open port for it.

You need: a vendor account on market.xproxy.io, a Linux or Windows server that can reach your proxy panel or your proxy's password file, and proxies that customers can reach from the internet.

How does it work?

When you sell a proxy by hand, you do two things: you make a username and password for the buyer, and you delete them when the rental is over. The connector does the same for every order, through one script of yours:

One order, from start to end
1. A customer buys your plan "US T-Mobile, 30 days"
   (your proxy: 203.0.113.5, port 31001).

2. The connector makes up a login for this customer:
       username   pm_9b1c2d3e4f506172
       password   k7m2xq4wyhn3bt5d

3. It runs YOUR script and tells it to add that login:
       python3 panel.py create
           PM_USERNAME = pm_9b1c2d3e4f506172
           PM_PASSWORD = k7m2xq4wyhn3bt5d
           PM_PORT     = 31001

4. The customer gets 203.0.113.5:31001 with that username and password.

5. 30 days later it runs YOUR script again, to delete the login:
       python3 panel.py delete
           PM_USERNAME = pm_9b1c2d3e4f506172

You never choose a customer's username or password: the connector makes them up and hands them to your script. Customer traffic never passes through the connector or ProxyMarket; customers connect straight to your proxy.

How do I start selling?

  1. Install the connector on a server that can reach your proxy panel or your proxy's password file.

    bash
    curl -fsSL https://x-proxy.io/pm-connector/install.sh | sh
    pm-connector version

    For Linux on Intel/AMD (amd64) and ARM (arm64, armv7) servers and boxes. The script checks the download and puts pm-connector in /usr/local/bin.

  2. Run pm-connector init. It asks one question: can ProxyMarket reach this server from the internet? ProxyMarket needs that to send you orders, to end them, and for the customer's Change IP button.

    • No, or not sure (recommended). You open nothing. The connector connects out to ProxyMarket and everything arrives through that connection. It works behind any router, NAT or 4G line. Key to create: ProxyMarket hook.
    • Yes. You forward one port on your router to this server, or point your own public address at it (how). Key to create: Custom webhook (your server).

    Then it tells you which key to create in the Vendor Dashboard under API Keys → New key. Paste the key when asked: it is shown only once.

    Terminal
    $ pm-connector init
    pm-connector 1.0.0 setup: writes config.yaml
    
    ProxyMarket has to reach this server: to send you orders, to end them,
    and when a customer presses "Change IP".
    
    You already open your proxy ports to the internet. Can you open one more
    for ProxyMarket (port forwarding / NAT on your router, or a public address)?
      1) No, or not sure (recommended)
         Nothing to open. The connector connects out to ProxyMarket and
         everything arrives through that connection.
      2) Yes, I will forward a port or use my own public address
    Choose [1]: 1
    
    Create your key: Vendor Dashboard > API Keys > New key > "ProxyMarket hook"
    Paste it here: pm_live_3f9c...
    ✅ Key accepted. Connected to ProxyMarket. No port was opened.
    
    ✅ Wrote config.yaml
    Next:
      1. Write your script, in any language, or start from a ready one:
           pm-connector sample          (shows the list: python, node, php, 3proxy)
      2. pm-connector test
      3. sudo pm-connector service install
  3. Write your script, or start from a ready one. The connector runs one program of yours for every order. It can be in any language, with any name, in any folder: you only tell the connector the command that starts it. These ready scripts are starting points; change them as you like, or write your own from scratch.

    panel.py
    #!/usr/bin/env python3
    # pm-connector script for a panel that has an API.
    # Python 3, nothing else to install. Change the lines marked CHANGE.
    import json
    import os
    import sys
    import urllib.error
    import urllib.request
    
    PANEL = "http://127.0.0.1:9000"   # CHANGE: your panel's address
    TOKEN = "YOUR_PANEL_TOKEN"        # CHANGE: your panel's API token
    
    
    def value(name):
        """What the connector passes for this order, for example value("USERNAME")."""
        return os.environ.get("PM_" + name, "")
    
    
    def call(method, path, body=None):
        req = urllib.request.Request(
            PANEL + path,
            method=method,
            data=None if body is None else json.dumps(body).encode(),
            headers={"Authorization": "Bearer " + TOKEN, "Content-Type": "application/json"},
        )
        with urllib.request.urlopen(req, timeout=20) as res:   # an error from the panel stops the script
            text = res.read().decode()
        return json.loads(text) if text else None
    
    
    def create():       # CHANGE: how your panel adds a login
        call("POST", "/api/users", {"username": value("USERNAME"), "password": value("PASSWORD"), "port": int(value("PORT"))})
    
    
    def delete():       # CHANGE: how your panel deletes a login
        try:
            call("DELETE", "/api/users/" + value("USERNAME"))
        except urllib.error.HTTPError as err:
            if err.code != 404:       # already deleted is fine
                raise
    
    
    def rotate():       # OPTIONAL: change the IP of the modem on this port, print the new IP
        print(call("POST", "/api/modems/" + value("PORT") + "/rotate")["ip"])
    
    
    def whitelist():    # OPTIONAL: only these IPs may use the customer's login
        ips = [ip for ip in value("IP_WHITELIST").split(",") if ip]
        call("PUT", "/api/users/" + value("USERNAME") + "/whitelist", {"ips": ips})
    
    
    def list_logins():  # OPTIONAL: print the logins that exist, one per line
        for user in call("GET", "/api/users")["data"]:
            print(user["username"])
    
    
    # Delete an OPTIONAL action here too if your panel cannot do it.
    ACTIONS = {"create": create, "delete": delete, "rotate": rotate, "whitelist": whitelist, "list": list_logins}
    
    action = sys.argv[1] if len(sys.argv) > 1 else ""
    if action == "actions":
        print("\n".join(ACTIONS))
    elif action in ACTIONS:
        ACTIONS[action]()
    else:
        sys.exit("unknown action: " + action)

    pm-connector sample python writes this file next to config.yaml and sets script: "python3 panel.py".

    pm-connector sample python (or node, php, 3proxy) puts a ready script next to config.yaml. In it, change the lines marked CHANGE: where your panel is, its token, and the two calls that add and delete a login. The parts marked OPTIONAL can wait (what they are for).

    Then put the command that starts your script into config.yaml. That is the whole file:

    config.yaml
    api_key: "pm_live_3f9c..."
    script: "python3 panel.py"
    
    # script: is any command that starts YOUR program. For example:
    #   script: "node panel.js"
    #   script: "php /opt/pm/panel.php"
    #   script: "/opt/pm/my-program"                      (Go, Rust, C#: a compiled program)
    #   script: "powershell -File C:\pm\panel.ps1"      (Windows)

    What the connector expects from a script, whatever the language, is in the script standard below.

  4. Run pm-connector test. It runs your script with a test login: adds it, checks it, deletes it. Fix every ❌ line before you go on (what they mean).

    Terminal
    $ pm-connector test
    ✅ config.yaml is valid
    ✅ Key accepted by ProxyMarket
    ✅ Connected to ProxyMarket: orders will reach this server
    ✅ Script runs: python3 panel.py (it can: create, delete, rotate, whitelist, list)
    No plans yet. Which of your proxy ports should the test use? 31001
    ✅ create: added the test login pm_test_4f2a
    ✅ list: pm_test_4f2a is there
    ✅ whitelist: set for pm_test_4f2a
    ✅ delete: removed pm_test_4f2a
    ℹ️  rotate was not run, it would change a modem's IP. Try it: pm-connector test --rotate 31001
    ℹ️  No plans use this key yet: add them in Vendor Dashboard > My Plans
    
    Ready. Keep it running: sudo pm-connector service install
  5. Keep it running as a service, so it starts with the server and comes back after a crash.

    bash
    sudo pm-connector service install
    journalctl -u pm-connector -f      # watch the log

    Starts with the server and restarts if it ever stops.

  6. Add your plans. A plan is one thing a customer can buy. In the Vendor Dashboard open My Plans → New plan and enter its name, country, price, how long it lasts, and the proxy IP and port customers connect to. Set API Key / Server to your key. What each field means.

  7. Send yourself a test order. In Integration Status press Send test order. It is free, hidden from customers and ends by itself after 10 minutes. You see each step turn ✅: order sent, login added, login works, login deleted. All green means you are on sale.

The script standard: what must my script do?

This is the whole interface between the connector and your script: one word on the command line, the order details as PM_ values, and how the script ends. There are no other arguments, nothing to install and nothing to import, so it works in any language. The ready scripts already follow it.

You can run your script by hand exactly the way the connector does:

Terminal
# Linux: add a test login, look in your panel, then delete it
PM_USERNAME=pm_test PM_PASSWORD=secret123 PM_PORT=31001 python3 panel.py create
PM_USERNAME=pm_test python3 panel.py delete

# Windows PowerShell
$env:PM_USERNAME="pm_test"; $env:PM_PASSWORD="secret123"; $env:PM_PORT="31001"
python panel.py create
python panel.py delete

1. It is run with one word: the action

The connector runs the command in script: and adds one word that says what to do, for example python3 panel.py create.

ActionWhen the connector runs itWhat your script doesNeeded?
createA customer paidAdds the login PM_USERNAME / PM_PASSWORDNeeded
deleteThe rental ended, or the order was cancelled or refundedDeletes the login PM_USERNAME. Already deleted counts as doneNeeded
rotateThe customer pressed Change IPChanges the IP of the modem on PM_PORT. It may print the new IPOptional
whitelistThe customer set which IPs may use the proxyLets only the IPs in PM_IP_WHITELIST use that loginOptional
listClean-up, for example after you reinstall the connectorPrints the logins that exist, one per lineOptional
actionsWhen the connector startsPrints the actions it has, one per line. Without it the connector uses only create and deleteFor optional actions

2. It reads the order from PM_ values

The connector passes the details as environment variables: named values every language can read. In shell $PM_USERNAME, in Python os.environ["PM_USERNAME"], in Node.js process.env.PM_USERNAME, in PowerShell $env:PM_USERNAME.

ValueFor exampleWhere it comes from
PM_USERNAMEpm_9b1c2d3e4f506172The connector makes it up, new for every order. It always starts with pm_
PM_PASSWORDk7m2xq4wyhn3bt5dThe connector makes it up, new for every order
PM_PORT31001The Proxy Port you typed on the plan the customer bought. It tells your system which modem or port was sold
PM_HOST203.0.113.5The Proxy IP you typed on that plan
PM_PLANmodem-7Your ID on that plan, if you filled it in
PM_ORDER_ID, PM_EXPIRES_ATthe order number and its end timeThe order on ProxyMarket
PM_IP_WHITELIST198.51.100.7,198.51.100.8Only for whitelist: the IPs the customer allows, separated by commas. Empty means everyone

Which values each action gets:

ActionValues
createPM_USERNAME, PM_PASSWORD, PM_PORT, PM_HOST, PM_PLAN, PM_ORDER_ID, PM_EXPIRES_AT
deletePM_USERNAME, PM_PORT, PM_HOST, PM_PLAN, PM_ORDER_ID
rotatePM_PORT, PM_HOST, PM_PLAN, PM_USERNAME, PM_ORDER_ID
whitelistPM_USERNAME, PM_IP_WHITELIST, PM_PORT, PM_ORDER_ID
list, actionsnone

3. It says whether it worked

  • Worked: the script ends normally (exit code 0).
  • Failed: the script ends with an error (any other exit code) and prints why. The connector shows that text in its log and in Integration Status. A failed create gives the customer their money back.
  • Each run may take up to 120 seconds. The connector runs one action at a time, so your script needs no locking.

4. If it has something to tell, it prints one line

Most scripts print nothing. Only when your system decides something the connector cannot know, create prints it as one line of JSON, the last line it prints:

What create may print
{"host": "203.0.113.5", "port": 31007}              you picked the modem yourself
{"username": "u8821", "password": "x7Kq2m"}         your panel made its own login
{"vpn_config": "...the whole config..."}            a VPN plan: this customer's config

Optional: Change IP, IP whitelist, clean-up

The Python, Node.js and shell scripts already contain these actions. Keep the ones your system can do and delete the others; the connector asks your script which ones it has. In a script of your own, add them the same way.

panel.py
def rotate():       # OPTIONAL: change the IP of the modem on this port, print the new IP
    print(call("POST", "/api/modems/" + value("PORT") + "/rotate")["ip"])


def whitelist():    # OPTIONAL: only these IPs may use the customer's login
    ips = [ip for ip in value("IP_WHITELIST").split(",") if ip]
    call("PUT", "/api/users/" + value("USERNAME") + "/whitelist", {"ips": ips})


def list_logins():  # OPTIONAL: print the logins that exist, one per line
    for user in call("GET", "/api/users")["data"]:
        print(user["username"])
  • rotate: with it, customers get a Change IP button and automatic rotation.
  • whitelist: with it, customers can limit which IPs may use their proxy.
  • list: with it, the connector also finds and deletes pm_ logins left behind, for example after you reinstall it. It never touches a login that does not start with pm_.

How do I set up my plans?

A plan is one thing a customer can buy, for example US T-Mobile 4G, 30 days, $25. You make plans in Vendor Dashboard → My Plans and can change the price or pause a plan there at any time.

FieldWhat to enter
Name, Country, Proxy Type, ProtocolWhat customers see and filter by
Duration, PriceHow long one purchase lasts and what it costs
StockHow many customers can use the plan at the same time. Enter 1 for a modem you rent to one person. A sale takes one; it comes back when the order ends
Proxy IP, Proxy PortThe public address customers connect to. Your script gets them as PM_HOST and PM_PORT
API Key / ServerYour connector's key. Orders for this plan go to that connector
Your ID (optional)Your own name for it, for example modem-7. Your script gets it as PM_PLAN

Leave Proxy Username, Proxy Password and Rotation Link empty: the connector makes a new login for every order.

I have many modems. One plan each?

  • One plan per modem, when customers should pick a specific one. Give each plan its own Proxy Port and Stock 1.
  • One plan for all of them, when any free modem will do. Set Stock to the number of modems and leave Proxy IP and Proxy Port empty. Your create picks a free modem and prints its address: {"host": "203.0.113.5", "port": 31007}.

What can I sell?

  • Proxies: HTTP, SOCKS5 or both, of any kind (mobile, residential, datacenter, ISP, IPv6). The customer gets your proxy IP and port with the username and password the connector made.
  • VPN: OpenVPN, WireGuard or VLESS. The customer gets a config file or a vless:// link instead of a login. On the plan pick Proxy Type: VPN and the VPN Protocol.

For VPN there are two ways to hand over the config. If every customer of a plan may use the same config, paste it into the plan's VPN Config field and your script has nothing to do. If each customer needs their own, your create makes it and prints {"vpn_config": "…the whole config…"}.

I answered Yes. How do I open it to ProxyMarket?

ProxyMarket then calls your server directly instead of using the connector's outgoing connection. Pick one:

  • Port forwarding (NAT). On your router, forward TCP port 8787 to this server, the same way you forward your proxy ports. Your address is http://YOUR_PUBLIC_IP:8787. The customer's login still travels encrypted.
  • Your own HTTPS address. Anything that serves HTTPS and passes requests on to port 8787: your reverse proxy (Caddy, nginx, IIS), a Cloudflare Tunnel or Tailscale Funnel. Your address is for example https://pm.example.com.

init writes this into config.yaml and starts answering on the port, so ProxyMarket can check it. Then create the key as Custom webhook (your server) with your address as Webhook URL.

config.yaml
api_key: "pm_live_..."          # a "Custom webhook (your server)" key
script: "python3 panel.py"

webhook:
  public_url: "http://203.0.113.5:8787"  # the Webhook URL you typed on the key
  listen: "0.0.0.0:8787"                 # the port you forwarded to this server

Not reachable after all? Run pm-connector init again and answer No. Everything else on this page is the same for both answers.

What do the test messages mean?

You seeWhat to do
❌ Key rejectedPaste the whole key, starting with pm_. If it still fails, the key was deleted or switched off in API Keys: make a new one
❌ This key is not a ProxyMarket hook keyYou answered No but pasted a Custom webhook key. Make a new key of type ProxyMarket hook, or run init again and answer Yes
❌ ProxyMarket cannot reach http://…:8787You answered Yes but the port is not open: check the port forward and the firewall, or run init again and answer No
❌ Cannot reach ProxyMarketThe server needs outgoing HTTPS (port 443) to market.xproxy.io and market-hook-service.xproxy.io. Check the firewall and DNS
❌ Script does not run: …The command in script: could not start: check the path, and that python3 or node is installed
❌ create failed: … or delete failed: …The text after the colon is what your script printed, usually your panel's answer. Check the lines marked CHANGE (address, token, the two calls) and test again
❌ list: the test login is not therecreate said it worked but the login is missing: check that create and list use the same panel or file
⚠️ Proxy IP … does not accept connectionsCustomers will not get through: open the port on your firewall or router, or fix Proxy IP and Proxy Port on the plan
Vendor account not approved yetYour key works, but an admin has not approved your vendor account. Message @xproxyio with your account email

After you are on sale, the Integration Status tab in the Vendor Dashboard shows whether the connector is connected, which plans are listed or hidden and why, and the last orders with the error of any that failed.

FAQ

Who chooses the customer's username and password?

The connector. For every order it makes up a new username (pm_ and 16 characters) and a 16-character password, and passes them to your script as PM_USERNAME and PM_PASSWORD. You do not set them anywhere.

My panel makes its own username and password. Can I use those?

Yes. Let your create print them, {"username": "…", "password": "…"}, and the customer gets those instead (rule 4).

Do I need to know how to code?

No. In a ready script you change your panel's address, its token and the two calls that add and delete a login; your panel's API documentation shows those. The Ask AI button at the top of this page can do it with you.

Does it work on Windows?

Yes. The Python, Node.js and PHP scripts are the same on Windows; set for example script: "python C:\pm\panel.py". A PowerShell or .bat script works too if it follows the standard.

What if my system is slow, or the connector is off?

Your create has 120 seconds. After that the customer gets their money back and the sale is removed from your earnings. The same happens to orders placed while the connector is off. If it stays off for two checks in a row (they run every 10 minutes), your plans are hidden until it is back. Once back, it deletes the logins of orders that ended while it was away.

I have several servers. One connector for all?

If one panel or script manages all of them, one connector is enough. Otherwise install a connector on each server, with its own key, and set each plan's API Key / Server to the key of the server that serves it. One key works with one connector at a time.

Can I end an order myself?

Yes: pm-connector expire ORDER_ID ends the order on ProxyMarket and deletes its login. It does not give the customer money back.

How do I update the connector?

Run the install command again, then restart the service. Your config.yaml, your script and your customers' logins stay as they are.

I run XProxy. Do I need this?

No. The XProxy panel sells on ProxyMarket by itself: see Sell with XProxy.

What next?

Open the dashboard to get your key, or see the other ways to sell.

Still stuck?A technician can look at your device with a one-time PIN, or chat with us on Telegram.