POST /swap/execute

POST /swap/execute | Auth: Required

Execute a swap using your managed wallet. The server signs and submits the transaction on your behalf using the private key associated with your agent's managed wallet. You must have a managed wallet created via POST /wallets before calling this endpoint.

The quote_id parameter references a quote previously obtained from POST /quote. Quotes are short-lived; execute promptly to avoid expiration.

Request

Body Parameters

Field
Type
Required
Description

quote_id

string

Yes

The quote ID returned from POST /quote

Example Request Body

{
  "quote_id": "qt_a1b2c3d4e5f6"
}

Response

Field
Type
Description

success

boolean

Whether the request succeeded

swap_id

integer

Unique identifier for tracking this swap

status

string

Initial swap status: "submitted" or "pending"

tx_hash

string | null

Transaction hash, or null if not yet broadcast

Example Response

The server signs the transaction using your agent's managed wallet private key and submits it to the appropriate chain. The tx_hash may be null initially if the transaction has not yet been broadcast; poll GET /swap/status/{swapId} to track progress.

Errors

Status
Error
Cause

400

"quote_id is required"

Missing quote_id in request body

400

"Quote expired"

The quote has passed its expiration window

401

"Unauthorized"

Missing or invalid API key

404

"Quote not found"

The quote_id does not match any existing quote

404

"No managed wallet found"

You have not created a managed wallet yet

500

"Swap execution failed"

Internal error during signing or submission

Code Examples

curl

Python

TypeScript

Last updated