Quick start
On this page you buy 1 gram of gold (1000 mg). There are four steps: create a key, find the market, get a quote and place the order.
The Talano API has no sandbox. Every order you place executes against your real wallet balance. Use a small amount (for example the market minimum) while testing.
1. Create an API key
In the Talano app, create a key with the trade access level. The IP allow-list is optional, but for a trade key it is strongly recommended to add the public IP of the server your code runs on. The steps, with screenshots, are in Creating an API key.
You see the key only once. Put it in an environment variable:
export TALANO_API_KEY="tln_7KQ2M9XA_..."
2. Find the market
Never hard-code the market ID. Always read it from GET /markets/:
curl -s -H "X-API-Key: $TALANO_API_KEY" \
https://service.talano.ir/api/public/v1/markets/
Take the id of the market whose symbol is MLG/TMN.
3. Get a quote
A quote locks the price for 30 seconds:
curl -s -X POST \
-H "X-API-Key: $TALANO_API_KEY" \
-H "Content-Type: application/json" \
-d '{"market_id":"<MARKET_ID>","side":"buy","base_amount":1000}' \
https://service.talano.ir/api/public/v1/quotes/
{
"quote_id": "b6a0d0f4-2c51-4f3a-9d0e-7a3c5b8e1f22",
"side": "buy",
"kind": "spot",
"price": "10512",
"base_amount": "1000",
"quote_amount": "10512000",
"fee": "52560",
"total": "10564560",
"expires_at": "2026-11-07T08:54:41.115210Z"
}
price is Toman per milligram, and total is what is taken from your Toman wallet. Every number in a response is a string; parse it with Decimal in Python.
4. Place the order
Place the order before expires_at. Send the quote's base_amount as an integer, and add a client_id so that sending the request again never creates a second order:
curl -s -X POST \
-H "X-API-Key: $TALANO_API_KEY" \
-H "Content-Type: application/json" \
-d '{"quote_id":"<QUOTE_ID>","base_amount":1000,"client_id":"my-bot-0001"}' \
https://service.talano.ir/api/public/v1/orders/
A 201 response with "status": "done" means the purchase went through.
All steps in Python
pip install requests
"""Quick start: find the market, get a 30-second quote, place a spot buy of 1 g.
pip install requests
export TALANO_API_KEY="tln_..."
python quickstart.py
"""
import os
import uuid
from decimal import Decimal
import requests
BASE = os.environ.get("TALANO_BASE_URL", "https://service.talano.ir/api/public/v1")
s = requests.Session()
s.headers["X-API-Key"] = os.environ["TALANO_API_KEY"]
# 1. Discover the market (never hard-code its ID)
markets = s.get(f"{BASE}/markets/", timeout=10)
markets.raise_for_status()
market = next(m for m in markets.json() if m["symbol"] == "MLG/TMN")
print("market:", market["id"])
# 2. Indicative live price (Toman per milligram)
price = s.get(f"{BASE}/markets/{market['id']}/price/", timeout=10).json()
print("buy price per gram:", Decimal(price["buy"]["price"]) * 1000, "Toman") # never float for money
# 3. Lock a price for 30 seconds: buy 1 g = 1000 mg
quote = s.post(f"{BASE}/quotes/", json={
"market_id": market["id"], "side": "buy", "base_amount": 1000,
}, timeout=10)
quote.raise_for_status()
quote = quote.json()
print("price per mg:", quote["price"], "total:", quote["total"], "expires:", quote["expires_at"])
# 4. Place the order within 30 s, with a client_id so a retry can never double-buy
order = s.post(f"{BASE}/orders/", json={
"quote_id": quote["quote_id"],
"base_amount": int(quote["base_amount"]), # response numbers are strings
"client_id": str(uuid.uuid4()),
}, timeout=10)
order.raise_for_status()
print("status:", order.json()["status"]) # "done"
If you get an error
| Error code | Meaning | What to do |
|---|---|---|
ip_not_allowed | The key has an IP allow-list and your server's IP is not on it | Create a key that includes your server's public IP |
insufficient_scope | The key is read only | Create a trade key |
quote_expired | More than 30 s passed since the quote | Get a new quote |
insufficient_balance | Not enough balance | Top up your wallet in the app. The API has no payment gateway |
Full list in Errors.
Next steps
- Quote → spot order guide with full error handling
- Limit orders
- Safe retries with client_id