Power Trade Guides and FAQ
  • Power Trade Guides and FAQ
  • How to use PowerTrade
    • Getting Started
      • What is PowerTrade?
      • Signing up for a New Account
      • Verify the account
    • Login
      • Signing In to Your Account
      • Common Login Issues
    • Email Issues
      • Not Receiving Emails
    • Subaccounts
      • Subaccounts Overview
      • Web, Creating / Managing Subaccounts
      • Web, Funding Subaccounts
      • Mobile, Creating / Managing Subaccounts
      • Mobile, Funding Subaccounts
    • Deposits
      • Depositing on Web
      • Depositing on Mobile
      • My Deposit is Delayed
    • Withdrawals
      • Withdrawing on Web
    • Account Verification
      • Account Verification Status / Limits
      • Proof of Identity (Requirements)
      • Proof of Address (Requirements)
      • Updating Your Address
    • Corporate Accounts
      • Institutional Account Verification
    • Fees
      • Trading Fees
      • Withdrawal Fees and Minimum
      • Cryptocurrency Recovery Fee
  • API
    • API Overview
    • Authentication
  • Trading
    • Options
      • Options Introduction
      • Options Contract Specifications
    • Futures
      • Futures Introduction
    • Margin & Liquidation
      • Account Health & Liquidation
      • Portfolio Margin
      • Margin Methodology
    • Perpetuals
      • Perpetuals Introduction
      • Perpetuals Contract Specifications
      • Full perpetual documentation
    • Spot
      • Spot Trading
  • Insurance Fund
    • Insurance Fund Specifications
  • PTF Token
    • PowerTrade Fuel Token (PTF)
    • Token Specifications
      • Token Burn Mechanics
      • Trading Reward Programme
      • Liquidity Providers Reward Programme
    • PTF Token Litepaper
  • Legal
    • Legal and Privacy Policies
      • Terms of Service
      • Privacy Policy
      • API License Agreement
      • Cookie Policy
    • Country Availability
      • List of Prohibited Countries
    • Risk Disclosure
      • Risk Disclosure Statement
    • Security
      • Security Policy
  • PowerDEX
    • What is PowerDEX
      • PowerDEX FAQ
      • PowerDEX Multi-Signature Wallet
    • Using PowerDEX
      • Sign in to PowerDEX
      • Setting up your Account
      • Making a Deposit
      • Settling your Account Balance
      • Making a Withdrawal
      • Safe Mode
Powered by GitBook
On this page
  • Generate an API Key and Private Key​
  • Generate an access token - JWT​
  • Still have questions?
  1. API

Authentication

PreviousAPI OverviewNextOptions

Last updated 1 year ago

All private endpoints require a valid access token.

Generate an API Key and Private Key

  • Create an account on the .

  • In the account profile menu in the top right and choose API Keys

  • The resulting API Key api_key and Private key private_key can be used to generate a JWT.

Generate an access token - JWT

Use the ES256 algorithm and add {client: "api"} to the payload when generating the token jwt_token.

Example in python

Using

def generate_access_token(api_key, private_key):
    now = utils.time.time_s()
    return jwt.encode({"exp": now + 60, "iat": now,
                       "sub": api_key, "client": "api"}, private_key, algorithm="ES256")

Example in Node.js

Using

import rs from "jsrsasign";

const header = { alg: "ES256", typ: "JWT" };

const payload = {
  sub: api_key,
  iat: rs.KJUR.jws.IntDate.get("now"),
  exp: getUnixTime(add(Date.now(), { days: 10 })),
  client: "api",
  nonce: getUnixTime(Date.now()),
};

const headerString = JSON.stringify(header);
const payloadString = JSON.stringify(payload);

return rs.KJUR.jws.JWS.sign("ES256", headerString, payloadString, private_key);

Web Based JWT builder

If you want a quick way to verify that your API Key is working, you can also use our web based jwt builder:

Still have questions?

Email Support:

Telegram:

​
Power Trade's web application
​
PyJWT
jsrsasign
https://app.power.trade/jwt-builder
support@power.trade
https://t.me/power_trade