Endpoint

GET https://altinapi.com/api/prices/ALTIN

cURL

bash
curl -H "x-api-key: hapi_xxxx" \
     https://altinapi.com/api/prices/ALTIN

JSON Yanıt

JSON
{
  "symbol":    "ALTIN",
  "category": "MADEN",
  "bid":      3248.50,   // alış fiyatı (TL/gram)
  "ask":      3251.00,   // satış fiyatı (TL/gram)
  "timestamp": 1741784400000  // Unix ms
}

Python

Python
import requests

API_KEY = "hapi_xxxx"
url     = "https://altinapi.com/api/prices/ALTIN"

resp = requests.get(url, headers={"x-api-key": API_KEY}, timeout=5)
data = resp.json()

print(f"Has Altın alış: {data['bid']} TL/gram")
print(f"Has Altın satış: {data['ask']} TL/gram")

JavaScript

JavaScript (fetch)
const resp = await fetch("https://altinapi.com/api/prices/ALTIN", {
  headers: { "x-api-key": "hapi_xxxx" },
});
const data = await resp.json();

console.log(`Has Altın alış: ${data.bid} TL/gram`);
console.log(`Has Altın satış: ${data.ask} TL/gram`);

WebSocket Aboneliği

Fiyat her değiştiğinde anlık almak için WebSocket kullanın:

JavaScript (socket.io-client)
import { io } from "socket.io-client";

const socket = io("https://altinapi.com", {
  auth: { apiKey: "hapi_xxxx" },
});

socket.on("connect", () => {
  socket.emit("subscribe", ["ALTIN"]);
});

socket.on("prices:update", ({ data }) => {
  const altin = data.find(p => p.symbol === "ALTIN");
  if (altin) console.log(altin.bid, altin.ask);
});

Tüm Fiyatlarla Birlikte

Tek istekte tüm kategorileri çekmek için /api/prices kullanın:

GET https://altinapi.com/api/prices

Yanıtta category: "MADEN" olanları filtreleyin — ALTIN bu grupta yer alır.

İlgili Semboller