Skip to content

Phemex

Obtaining the API Key

Danger

WARNING: Do NOT use the same API key that you have created for other services.

If you don't have a Phemex account yet, sign up at Phemex.

To get the API keys for your Phemex account, click the profile icon at the top right of the Phemex main page, then select API Management from the menu.

Phemex header with the Buy Crypto, Markets, Contract, Spot, Earn, Web3, Learn and Promotions menus.

On the API Management page, click Create new API key.

Phemex API Management page with the Create new API key button.

Choose Default API entry and click Next.

Phemex Create new API key dialog with the High rate limit and Default API entry options.

Warning

Don't choose High rate limit unless Phemex has given your account VIP API access. Those keys only work through Phemex's VIP endpoint (vapi.phemex.com), which also needs your IP address approved by Phemex ([email protected]). Without that, the key test fails. If you do have VIP access, tick Use Phemex VIP High-Speed API in the HaasOnline account setup form.

Enter a name, choose Bind IP, paste the IP addresses and set the permission to Read & Trade, as below. Then click Confirm.

Info

For IP Address Bind IP configuration:

  • On HaasOnline TradeServer Cloud, paste the addresses shown under IP addresses to whitelist in the HaasOnline account setup form.
  • On a self-hosted TradeServer license, use the public IP address of your machine or server.

Phemex Default API entry form with the key name, Bind IP selected and Read & Trade Permission.

The red note in this screenshot is out of date: on a self-hosted TradeServer, use your server's public IP address, not a private one.

Complete the Safety Verification with your Google Authenticator code.

Phemex Safety Verification dialog asking for the Google Authenticator code.

Phemex then shows the new key's ID and API Secret:

Phemex Created successfully dialog with the key ID, API Secret and a note to store the secret safely.

Keep the pop-up open and move on to the next step.

Adding the API to HaasOnline TradeServer

Log in to TradeServer.

Click on the user menu icon in the top right and select Exchange Accounts

HaasOnline TradeServer Exchange Accounts page with the user menu open and Exchange Accounts highlighted.

Click the + button at the bottom of the accounts list (on an empty page it reads Add account).

HaasOnline TradeServer Exchange Accounts page with the add account button highlighted.

Select Exchange account.

HaasOnline TradeServer Select Account Type modal with Exchange account highlighted.

In Connect an exchange account, click Phemex (or type it in the search box).

Connect an exchange account list with Phemex among the supported exchanges.

Choose what this account should trade: a Spot market, or a Derivatives market. Each market is its own exchange account, so repeat these steps to add another one with the same API key, if you enabled it for that market. Click the Continue with … button, which names the market you picked.

What should this account trade, showing the Phemex Spot and Derivatives markets.

Enter an Account name.

From the Phemex API Management page earlier, click on Copy under API Key and paste it in the TradeServer window under ID. Repeat the same for API Secret but paste it under API Secret.

Phemex account setup form with the IP whitelist, account name and API key fields.

Info

Check for spaces at the start and end of each key after you paste it. Stray spaces are a common cause of a failed key test.

Click Test keys. When the test passes, click Save account to add the account to the platform.