Import Lighter Credentials
Account
Import Lighter Credentials
Import existing Lighter API credentials for a wallet. Used when delegation or server wallet generation is not possible.
POST
Import Lighter Credentials
Import existing Lighter API credentials for a wallet. This endpoint is used when delegation or server wallet generation is not possible, allowing users to provide their own pre-generated API keys from the Lighter platform.
Features
- Credential Import: Link existing Lighter API keys to your HyperDEX account
- Secure Storage: Credentials are encrypted and stored securely
- Flexible Wallet Linking: Use wallet address or internal wallet ID
When to Use
Use this endpoint when:- You already have Lighter API credentials generated from the Lighter platform
- Server-side wallet delegation is not available
- You want to use your existing Lighter account with HyperDEX
Request
- Method:
POST - Endpoint:
/api/trading/lighter/import - Authentication: Required (JWT Bearer token)
Headers
| Header | Value | Required |
|---|---|---|
Content-Type | application/json | Yes |
Authorization | Bearer <jwt_token> | Yes |
Request Body
Request Parameters
| Field | Type | Required | Description |
|---|---|---|---|
walletIdOrAddress | string | Yes | The wallet address or internal wallet ID associated with these credentials |
accountIndex | number | Yes | The Lighter account index (usually 0 or 1) |
apiKeyIndex | number | Yes | The index of the API key being imported |
apiPublicKey | string | Yes | The public key of the API key pair |
apiPrivateKey | string | Yes | The private key of the API key pair |
Example Request
Success Response
Response Fields
| Field | Type | Description |
|---|---|---|
success | boolean | Operation status |
message | string | Success message |
timestamp | number | Unix timestamp in milliseconds |
Error Responses
400 Bad Request - Missing Parameters
401 Unauthorized - Missing Token
500 Internal Server Error - Wallet Not Found
How to Get Lighter Credentials
- Visit Lighter DEX and create an account
- Navigate to your account settings
- Generate API keys from the dashboard
- Note down your:
accountIndex- Your Lighter account indexapiKeyIndex- The API key indexapiPublicKey- Your API public keyapiPrivateKey- Your API private key
After importing credentials, you can use the standard trading endpoints to place orders on Lighter without providing credentials as query parameters.
Authorizations
JWT token for authentication. Required for smart order execution.
Body
application/json
The wallet address or internal wallet ID associated with these credentials
Example:
"0xA5BD439c4d4Fc7cA8B14A9FE77fd5C4FFd7e4996"
The Lighter account index (usually 0 or 1)
Example:
0
The index of the API key being imported
Example:
10
The public key of the API key pair
Example:
"0x..."
The private key of the API key pair
Example:
"0x..."