Skip to main content

Request Body

The request body should contain the exact response from the /2/perp/quote endpoint, plus a signature field.
dex
string
required
The DEX identifier. Possible values: gains, lighter
marketId
string
required
Market pair identifier from the quote response.
chainId
string
required
Blockchain ID from the quote response.
payload
object
required
Execution payload object from the quote response. Structure varies by DEX type (see quote endpoint documentation).
payloadStr
string
required
JSON stringified version of the payload from the quote response. For Lighter orders, this must be signed by the user’s wallet.
signature
string
required
Signature of the payloadStr message. For Lighter orders, sign the payloadStr with your wallet’s private key. The signature is used to verify the signer’s address and associate it with a Lighter account.

Response

data
object
Execution result.

Error Responses

400 Bad Request

message
string
Error message (e.g. “invalid payloadStr”, “Validation failed”)
errors
array
Array of validation errors (Zod issues) if validation fails.

403 Forbidden

message
string
Error message (e.g. “no lighter account associated with the signer address”)
This error occurs when:
  • The signature doesn’t match a registered Lighter account
  • The signer address extracted from the signature has no associated Lighter account

500 Internal Server Error

message
string
Error message (e.g. “could not extract user address from signed payload”, “internal server error”)
This error occurs when:
  • The execution fails on the DEX
  • The payload type is not supported (e.g. EVM not yet implemented)
  • Other internal errors occur

Authentication

For Lighter orders:
  1. Sign the payloadStr from the quote response using your wallet’s private key
  2. The signature must be from a wallet address that has a registered Lighter account
  3. The API will verify the signature and extract your address to associate with the Lighter account
For EVM orders:
  • Currently not implemented

Example Flow

  1. Call /2/perp/quote to get a quote and payload
  2. Sign the payloadStr from the quote response
  3. Call /2/perp/execute with the quote response data plus your signature
  4. Receive execution confirmation with transaction details