DeFiMara API Overview — Base URL, Authentication & Quickstart Guide

What Is the DeFiMara API?

The DeFiMara API exposes the same DeFi agent capabilities available in the UI as an HTTP interface. Any external agent, bot, or backend service can call it to execute swaps, limit orders, perps, and yield strategies — programmatically, with the same security guarantees.

Base URL & Formats

All endpoints are served from your deployed DeFiMara instance (default port 8000). All endpoints accept and return JSON. Streaming endpoints use Server-Sent Events (SSE).

How It Works

1. Authenticate — Sign a challenge with your EVM private key. The server issues a JWT valid for 24 hours. 2. Send a message — POST to /chat with your JWT and a natural-language instruction. 3. Stream the response — Responses are streamed as SSE events in real time. 4. Confirm on-chain actions — Transactions return a payload for you to sign and broadcast.

Requirements

DeFiMara server running (Node.js, port 8000). An EVM private key for agent authentication. Python 3.10+ or Node.js 18+ for client code. HTTP client with SSE support.

Back to Blog
API
November 20255 min read

API Overview

What Is the Defimara API?

The Defimara API exposes the same DeFi agent capabilities available in the UI as an HTTP interface. Any external agent, bot, or backend service can call it to execute swaps, limit orders, perps, and yield strategies - programmatically, with the same security guarantees.

Base URL: http://localhost:8000 (self-hosted) or your deployed instance. All endpoints accept and return JSON. Streaming endpoints use Server-Sent Events (SSE).

• How It Works

1
Authenticate
Sign a challenge with your EVM private key (secp256k1). The server issues a short-lived JWT.
2
Send a message
POST to /chat with your JWT and a natural-language instruction. The agent interprets and executes it.
3
Stream the response
Responses are streamed back as SSE events - tool calls, confirmations, and results appear in real time.
4
Confirm on-chain actions
Transactions that require wallet signing return a payload for you to sign and broadcast.

• Requirements

Defimara server running (Node.js, port 8000 by default)
An EVM private key for agent authentication
Python 3.10+ or Node.js 18+ for client SDKs
HTTP client that supports Server-Sent Events (SSE)

• Quick Example

curl
curl -X POST http://localhost:8000/chat   -H "Authorization: Bearer <JWT>"   -H "Content-Type: application/json"   -d '{"message": "swap 10 USDC for ETH"}'   --no-buffer

Share this article