Cointime

Download App
iOS & Android

How to Use an API Key Securely: 5 Tips From Binance

Validated Venture

Main Takeaways

  • Application Programming Interface (API) keys can be used to grant certain programs convenient access to user data.
  • However, API keys can be compromised if not managed properly. Learning how to use your API keys safely is essential to prevent your assets from being compromised.
  • Binance now supports RSA API key pairs for increased security. Find out how to generate and use them.

API keys enable users to access their data conveniently. From RSA key pairs to API key whitelists, learn five tips from Binance to keep your API keys safe.

Application Programming Interface (API) keys are an efficient way to grant certain programs access to user data, allowing them to act on behalf of the user. However, API keys can bring vulnerabilities if not stored and used properly. For instance, malicious actors who steal or phish the API keys of their victims could potentially get access to their funds. Learn to keep your assets safe with our five API key security tips.

1. Do Not Share Your Key With Others

Your API key's secret key (HMAC) and private key (RSA) are highly sensitive data. It’s strongly suggested that you do not disclose this information. With it, anyone can initiate an API request on your behalf without being detected by our risk monitoring system.

You should also frequently check the active API keys on your account via the API management page. If you suspect that the security of any API key is compromised, don’t hesitate to delete it and replace it with a new one. It’s also a good idea to frequently delete old API keys and replace them with new ones, similar to how some systems require passwords to be changed every 30-90 days – regardless of whether you actively use them or not.

2. Be Diligent in Access Management

API keys are useful tools for automated trading, position and risk monitoring, and taxes. Hence, it may be tempting to enable all permissions for a single API key to use it for multiple purposes, such as API trading and data queries. However, this reduces the security of the key – if your API key gets compromised, a hacker could obtain full access to your account and funds.

It’s safer to use an API key for a single application and enable permissions required for that purpose only. For instance, if you want to monitor trading risk, report taxes, and execute API Spot and Futures trading, you should create at least four keys, each for one of the following purposes:

  1. Spot trading
  2. Futures trading
  3. Tax data query
  4. Trading data query (read-only permission)

On Binance, you can create up to 30 API keys for each sub-account.

3. Store Your API Key Data Securely

As mentioned, if your API keys fall into the hands of a bad actor, your assets may be compromised. Just like how you would protect your private keys, do not store your API details in plain text. Instead, encrypt it or use a trusted secrets manager. You should also avoid using a cloud-based solution to keep your API keys, as they may be vulnerable to hacks.

It’s also recommended to avoid storing your API key inside your application’s source code or repository. 

Consider storing your API key data in files or environment variables outside the third-party management system that you are using to avoid sharing your private information with them.

Since RSA private keys support password protection, users who are using RSA keys should add a password to any RSA private key they have.

4. Use an IP Whitelist

Binance highly recommends users to use an IP whitelist on all of their API keys, regardless of the permissions or purposes of the API keys. With an IP whitelist, your API keys can only be accessed from specific IP addresses. This prevents bad actors from using your API keys in the event that they get compromised. Therefore, you should whitelist all the IP addresses with which you use your API keys.

Be aware of scams

Although an API key cannot be used to initiate withdrawal requests without IP whitelisting, you need to protect your API keys. If a hacker gets access to your keys, they could use assets with a relatively small trading volume to pair trade and slowly siphon assets from your wallet. By executing buys of unwanted assets from the hacker’s account and trading it with your blue chip assets (BTC, BNB, BUSD, etc.), you will eventually be left with altcoins you never intended to buy. In other words, the hacker can use your API keys to trade your assets against their assets in a market that has relatively low liquidity..

To prevent such scams, Binance implemented an auto API key deletion policy in December 2022. If your API key is not IP whitelisted and inactive for 30 days, it will be deleted. To avoid automatic deletion, you should create your IP whitelist.

5. Use RSA Key Pairs

An RSA (Rivest-Shamir-Adleman) key pair is a mechanism that uses public and private keys to secure data transmission.

With an RSA key pair, the private key used to create signatures doesn’t need to be shared. This means that as long as the private key is kept secret and secure, no one else can initiate an authentic request on your behalf.

Binance Now Supports RSA API Keys

Binance now supports RSA API keys. You can now create RSA public and private key pairs, register the public key on Binance, and use the corresponding private key to create signed API requests. 

How to create an RSA key pair on Binance?

1. Download the latest version of the official RSA Keys Generator.

2. Launch the application. You can generate, copy, or save keys. You can also adjust your key size.

3. To register your RSA key via the Binance App, go to [Profile] - [API Management] - [Create API] - [Self-generated API key].

4. Copy the public key from the RSA Key generator and paste it into the box to register.

5. Enter a name for your API key, click [Next], and complete the 2FA to complete registration.

For more details, please refer to our guide on How to Generate an RSA Key Pair to Send API Requests on Binance.

Read more: https://www.binance.com/en/blog/community/how-to-use-an-api-key-securely-5-tips-from-binance-8638066848800196896

Get the latest news here: Cointime channel — https://t.me/cointime_en

Comments

All Comments

Recommended for you

  • U.S. Tech Hardware Stocks Face Sell-Off, Philadelphia Semiconductor Index Plummets 5.7%

    On October 22, U.S. semiconductor stocks collectively declined, with the Philadelphia Semiconductor Index dropping 5.67%, marking a new low since July 29. Among the component stocks, AMD fell 7.21%, Intel dropped 6.57%, Applied Materials decreased by 6.57%, Arm fell 6.75%, Seagate Technology dropped 7.81%, and Western Digital decreased by 6.95%. Micron Technology fell 4.29%, NVIDIA dropped 3.93%, TSMC decreased by 3.97%, Broadcom fell 3.79%, and ASML dropped 4.83%. Various sub-sectors, including memory and semiconductor equipment, as well as chip design, faced simultaneous pressure. Additionally, Lam Research fell 9.78%, Lumentum dropped 9.24%, Coherent decreased by 11.81%, and the 3x Long Semiconductor ETF fell 17.09%.

  • Spot Gold Falls Below $4,050/Ounce for the First Time Since August 4

    Spot gold has fallen below $4,050 per ounce for the first time since August 4, with a daily decline of 2.19%.

  • Nasdaq Opens Down 1.55%, Meta Falls Over 4%

    U.S. stock indices opened lower, with the Dow Jones down 0.44%, the S&P 500 down 0.91%, and the Nasdaq Composite down 1.55%. Chip equipment manufacturer Lam Research provided a disappointing earnings outlook, causing its stock to open down over 9%. Following a reduction in spending plans, Tesla's stock fell by 2.8%. Meta dropped over 4%, with the company's future spending commitments totaling $825 billion. IBM also fell over 4%, reporting third-quarter revenue of $17.1 billion, a 4.7% year-over-year increase.

  • DeepSeek Raises Financing Target from 50 Billion to 100 Billion Yuan, Potentially Paving the Way for Sci-Tech Board IPO

    On October 22, market sources reported that domestic large model company DeepSeek plans to raise approximately 100 billion yuan (about 15 billion USD) in its latest financing round. Tencent and CATL are the largest investors in this round, with the transaction expected to be officially completed in the coming days. As of now, neither DeepSeek nor the related investors, including Tencent, have publicly responded. Journalists have cross-verified the information with multiple sources close to the company and investors, confirming its accuracy. Sources revealed that the initial fundraising target was set at 50 billion yuan, which has since been raised multiple times to approximately 100 billion yuan, although it has not been officially announced and the final amount is still not fully determined. The funds will continue to be used for model training, computing power construction, and talent recruitment to support DeepSeek's participation in global competition. Some sources also speculate that this round of financing will pave the way for the company's upcoming IPO on the Sci-Tech Board. (Shanghai Securities Journal)

  • Ethereum Researchers Propose Reducing Final Transaction Confirmation Time from 16 Minutes to Approximately 4 Minutes

    On October 22, Ethereum researchers proposed a draft for a rapid finality mechanism aimed at reducing the final transaction confirmation time from the current approximately 16 minutes to about 4 minutes, targeting an enhancement of around 4 times. The draft was submitted on Wednesday by Ben Edgington, the coordinator of the rapid finality research, and is still in the early stages, with no activation timeline determined yet. The proposal plans to split the validator voting for determining new blocks and finalizing historical blocks into two separate mechanisms, allowing for a faster pace of finality.

  • Visa Negotiates Acquisition of Fireblocks Valued at Approximately $2.5 Billion

    On October 22, Bloomberg reported that Visa is in talks to acquire the cryptocurrency custody infrastructure company Fireblocks, with a transaction valuation of approximately $2.5 billion. If the deal is finalized, it will further expand Visa's presence in the digital asset custody and blockchain payment infrastructure sectors. This information is yet to be confirmed, and specific terms and progress of the acquisition negotiations have not been disclosed.

  • US Spot Ethereum ETF Sees Net Inflow of $14.98 Million Yesterday

    On October 22, according to monitoring by Trader T, the US spot Ethereum ETF recorded a net inflow of $14.98 million yesterday.

  • Sonic to Transfer 13 Million S Tokens via Strategic OTC Agreement in Next 24 to 48 Hours

    On October 22, Sonic announced on the X platform that approximately 13 million S tokens will be transferred in the next 24 to 48 hours under a strategic over-the-counter (OTC) agreement. The counterparty is a long-term partner of Sonic, and both parties will collaborate to expand Sonic's reach and enhance user engagement through the partner's network.

  • Bank of Korea Maintains Interest Rate as Expected

    On October 22, the Bank of Korea kept the policy interest rate unchanged at 3%, in line with market expectations. Previously, South Korea raised interest rates in consecutive meetings in July and August.

  • U.S. Treasury Secretary Becerra: GENIUS Act Establishes Federal Regulatory Framework for Stablecoin Payments

    U.S. Treasury Secretary Scott Becerra stated that the GENIUS Act is a milestone in the American financial sector, further solidifying the U.S. position as a global cryptocurrency hub. He compared the bill to the National Currency Act signed by President Lincoln in 1863, asserting that it establishes a federal regulatory framework for stablecoin payments in the digital age. Becerra also mentioned that the final rules issued by the Office of the Comptroller of the Currency (OCC) will facilitate the implementation of the bill, providing a clear and pragmatic institutional foundation for private sector innovation, market competition, and maintaining U.S. leadership in the digital asset space.