API Docs v2
Integrate Obsidian swap routing into your project and unlock quest tracking for approved middleman contracts on Cronos.
Welcome to the Powered by Obsidian integration guide.
This documentation is for third-party projects that want to:
Route swaps through Obsidian's aggregator
Display Obsidian's whitelisted token list and logos
Earn quest tracking attribution for their users when routing through approved middleman contracts
Note. This is a public partner guide. It only covers supported external integration flows and onboarding requirements.
AI-friendly by design. The endpoint summaries, request bodies, and examples in this guide are structured so they can be handed directly to your editor or coding assistant with minimal rewriting. See Section 5 for prompts and workflows.
Quick Reference
Environment
Base URL
https://api.obsidian.finance
Cronos chain ID
25
Native token placeholder
0x0000000000000000000000000000000000000000
WCRO
0x5C7F8A570d578ED84E63fdFA7b1eE72dEae1AE23
Obsidian router
0x1189331089b6ca8beA989C1F2fFd0EfAdCd33a69
Capabilities
Direct swap integration
β Supported
Public quote and calldata routes
Public token list and logos
β Supported
Helper route for token pickers and branding
Quest tracking for approved middleman contracts
π Supported (gated)
Requires review and a partner API key
Custom dual-recipient partner fee splitting
β Not in public flow
Not documented here
Endpoint Summary
Get quote
POST
/:chainId/v1/getquote
Build swap calldata
POST
/v1/getswap
Get public token list
GET
/:chainId/v1/whitelisted-tokens
Submit partner tx hashes for quest tracking
POST
/v1/partners/trades/ingest
1. Direct Swap Integration
The end-to-end partner swap flow is three steps:
Call
POST /:chainId/v1/getquoteCall
POST /v1/getswapBroadcast the returned router transaction
The currently documented execution path is EXACT_INPUT.
1.0 Workflow Overview
1.1 Get Quote
Route
Request body
Request notes
Use
tradeType: 0for exact-input quoting.Use the zero address
0x0000...0000for native CRO.amount.valuemust be the raw integer amount in smallest units.maxSplits: 0is the simplest default.
Response highlights
fee
Quote fee metadata
gasEstimate
Estimated gas for the quoted route
inputAmount
Effective input amount
outputAmount
Effective output amount
routes
Route breakdown used for execution
tradeType
Returned trade type metadata
Implementation notes. The quote fee currently resolves to 0.004 (0.4%). gasEstimateInUSD exists in the response shape, but should not be treated as authoritative today.
1.2 Build Swap Calldata
Route
Converts a quote into executable router calldata.
Request body
Mapping rules: quote β trade
From quote
To trade
quote.inputAmount.value
trade.inputAmount.quotient
quote.outputAmount.value
trade.outputAmount.quotient
quote.routes[i].path[j].address
trade.routes[i].path[j].wrapped.address
quote.routes[i].pools[k].address
trade.routes[i].pools[k].address
(constant)
trade.tradeType = "EXACT_INPUT"
Additional rules:
When a token is native CRO, always set
isNative: true.Preserving the native zero address at the trade-level input is acceptable.
Route paths still use wrapped-token hop addresses, so native CRO routes usually begin with WCRO.
For native output, use the WCRO address anywhere a wrapped output address is required. The API appends the unwrap step internally.
Response highlights
calldata
Router calldata to broadcast
value
Native value to send with the tx
routerAddress
Router contract to call
estimatedGas
Estimated gas usage
paths
Path and pool breakdown
recipient
Final swap recipient
multiHopRoute
Whether the route spans multiple hops
feeApplied
Obsidian fee metadata in the built transaction
Broadcasting
Send the user's transaction with:
to
routerAddress
data
calldata
value
value
Execution guidance. estimatedGas already includes an API-side safety buffer. If you add more padding client-side, keep it conservative. deadlineOrPreviousBlockhash should usually be a future Unix timestamp. If you omit it, Obsidian defaults the deadline to roughly 10 minutes from request time.
1.3 Compact End-to-End Example
The fastest possible implementation handoff to an engineer or an LLM.
2. Public Token List
Pull token metadata and logos for swap forms, token pickers, and branding.
Route
Example
Returned token fields
name
Token name
symbol
Token symbol
address
Contract address
decimals
Token decimals
logoURI
Token logo URL
Rate limits
Public route
Rate limited per IP
Current default limit: 60 requests per minute
3. Quest Tracking for Partner Contracts
If your project uses its own middleman contract and still wants Obsidian quest tracking, onboarding starts with a Discord ticket.
3.1 Open a Discord Ticket With
Project name and primary contact
Main point of contact for follow-up
Target chain ID
For example 25 for Cronos
Deployed contract address or addresses
Include all relevant live contracts
Block explorer links
Explorer links for each contract
Verified contract on the relevant explorer
Obsidian can pull contract details from there
Flow description
Explain how your contract routes swaps into Obsidian
One to three real successful tx hashes
Use live successful examples
Expected end-user wallet for each tx hash
Needed for attribution validation
Fee-flow explanation
Include if your contract skims fees before routing
3.2 Contract Requirements
The important requirement is not the outer contract brand or implementation style. The important requirement is that Obsidian can prove the end user and the actual routed swap.
Your contract must:
Forward a decodable Obsidian router call inside the transaction flow
Route the swap so the nested Obsidian recipient is the real end user
Provide a reliable way to attribute the end user
Supported attribution sources
Transaction sender
A function argument
An emitted event argument
Preferred event fields
user
Required
inputToken
Required
inputAmount
Required
feeAmount
Required
outputToken
Helpful
outputAmount
Helpful
Example event shape
Important notes. Output token and output amount are helpful, but they are not the main source of truth. Obsidian verifies partner trades primarily from nested router calldata and token transfer logs. Quest volume is tracked from the net amount that actually reached Obsidian after any partner-side skim.
3.3 Partner API Key
After your contract flow is approved, Obsidian will issue a partner API key.
Header name
x-obsidian-partner-key
Header format
clientId.secret
Default rate limit
60 requests per minute per key
Scope
Approved chain IDs and approved contract addresses
3.4 Submit Transaction Hashes
Route
Headers
Implementation note. Call this route from your backend, worker, or serverless function. Do not expose x-obsidian-partner-key in frontend or browser code. Store the key in an environment variable or server-side secret.
Request body
Request rules
Maximum 4 unique transaction hashes per request
Hashes must be standard
0x-prefixed transaction hashesRe-submitting the same successful transaction is safe and idempotent
Default partner-key rate limit is
60requests per minute unless Obsidian provisions a different limit for your project
Response shape
Result statuses
processed
The trade was verified and written into Obsidian trade tracking
skipped_existing
The transaction was already processed earlier
failed
The hash was received but could not be verified for the approved partner scope
4. Final Notes
Direct swap integration routes are public.
Partner quest tracking ingestion is authenticated and only enabled after contract review.
If your project wants quest tracking, provide real sample transactions early. That shortens onboarding more than anything else.
5. Building with AI
This API was designed to be readable by coding assistants. The endpoint summaries, request bodies, mapping rules, and examples are written so that an AI agent can scaffold a working integration with minimal hand-holding.
This section gives you the patterns, prompts, and guardrails to do it well.
5.1 Why This Doc Is AI-Friendly
The structure of this guide is deliberate:
Stable endpoint tables
Models can cite exact routes without hallucinating paths
Explicit request bodies
Models can copy the shape instead of guessing field names
Quote-to-trade mapping table
The most error-prone step is spelled out as a direct map
Constant values in tables
Router, WCRO, native placeholder, and chain ID are easy to extract
Compact end-to-end example
Models can use it as a single-shot reference for full flows
When you hand this doc to an assistant, you do not need to re-explain any of these. They are already in a form the model can use.
5.2 Recommended Workflow
A simple loop that works for most partner integrations:
The shorter and more specific the prompt, the better the output.
5.3 Starter Prompts
Copy, adapt, and paste. Each prompt assumes you have also provided the relevant doc section to the assistant.
Quote and Swap (Frontend)
Token Picker (Frontend)
Partner Ingest Worker (Backend)
Contract Scaffolding (Quest Tracking Onboarding)
5.4 Guardrails When Building with AI
Coding assistants are excellent at scaffolding and weak at on-chain reasoning. Use these guardrails:
Always verify the router address from this doc
Models sometimes invent or stale-cache addresses
Always confirm the chain ID is 25
Some models default to mainnet-style chain IDs
Always test with small amounts on Cronos first
An incorrect calldata field will silently route wrong
Pin the exact tradeType values
0 is for the quote route, "EXACT_INPUT" is for the swap route
Treat gasEstimateInUSD as informational only
Documented as non-authoritative
Never let an AI agent hold your partner API key
Use a server-side proxy and inject the key from env
Diff AI output against the example payloads in 1.3
Field-by-field comparison catches almost every shape error
5.5 Suggested Project Files for AI-First Builders
If you are starting a new partner integration, this is a clean repo layout that AI assistants tend to handle well:
Point your assistant at this structure and ask it to fill in one file at a time. Small, focused prompts beat one giant prompt every time.
5.6 When To Ask Obsidian Instead Of An AI
Some things an AI cannot answer for you. Open a Discord ticket if:
You need quest tracking enabled for a custom middleman contract
You need a higher rate limit than
60requests per minuteYour event attribution does not match any of the supported attribution sources
You see consistent
failedstatuses in your ingest responsesYou want to discuss flows not documented in this guide
Real sample transactions speed up every one of these conversations.
Last updated