Compass API Docs
Welcome to the Compass API.
Integrate our API directly into your workflow.
The Compass Labs DeFi API is here to level up your DeFi game and make your life easier. We provide an intuitive and powerful interface for interacting with DeFi. With higher abstraction and market-wide support, you can focus on your strategies and intent—quickly, without the technical overhead.
Here you can find our API reference.
Key features
-
Forget the nitty-gritty, focus on intent with high-level commands, and we’ll handle the technical stuff.
-
One API interface for all top protocols and chains
-
No authorization keys, just dive in and start building
Jump in
Check out the full API Reference and start building today!
Contact our team to discover how you can partner with us and integrate with Compass Labs API.
An example of how to set USDT allowance using our API.
import requests
def set_allowance(chain, token, contract_name, amount):
url = f"https://beta-api.compasslabs.ai/beta/v0/generic/allowance/set/{chain}"
payload = {
"sender": "0x...",
"call_data": {
"token": token,
"contract_name": contract_name,
"amount": amount
}
}
try:
response = requests.post(url, json=payload, headers={
"Content-Type": "application/json"})
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print("Error fetching allowance:", e)
return None
if __name__ == "__main__":
chain, token, contract_name, amount = "ethereum", "USDT", "UniswapV3Router", "1"
result = set_allowance(chain, token, contract_name, amount)