Skip to main content

Documentation Index

Fetch the complete documentation index at: https://developer.alterscope.org/llms.txt

Use this file to discover all available pages before exploring further.

package main

import (
  "encoding/json"
  "fmt"
  "net/http"
  "os"
)

func main() {
  req, _ := http.NewRequest("GET", "https://dev.alterscope.org/v2/oracle/morpho-usdc-lending/classification", nil)
  req.Header.Set("Authorization", "Bearer "+os.Getenv("ALTERSCOPE_API_KEY"))
  resp, err := http.DefaultClient.Do(req)
  if err != nil { panic(err) }
  defer resp.Body.Close()

  var payload map[string]any
  if err := json.NewDecoder(resp.Body).Decode(&payload); err != nil { panic(err) }
  meta, _ := payload["meta"].(map[string]any)
  agentic, _ := meta["_agentic"].(map[string]any)
  freshness, _ := agentic["freshness"].(map[string]any)
  fmt.Println("freshness", freshness["status"])
}
header := http.Header{"Authorization": []string{"Bearer " + os.Getenv("ALTERSCOPE_API_KEY")}}
conn, _, err := websocket.DefaultDialer.Dial("wss://dev.alterscope.org/v2/events", header)
if err != nil { panic(err) }
defer conn.Close()
conn.WriteJSON(map[string]any{"action": "subscribe", "types": []string{"oracle.stale"}})
func verify(secret, body []byte, timestamp, signature string) bool {
  mac := hmac.New(sha256.New, secret)
  mac.Write([]byte(timestamp + "."))
  mac.Write(body)
  expected := hex.EncodeToString(mac.Sum(nil))
  return hmac.Equal([]byte(signature), []byte(expected))
}
Retry 429 and 5xx responses with exponential backoff. Respect Retry-After; treat 401 as invalid credentials and 403 as missing scope. Next: Pricing, Changelog, API Reference, Recipes.