Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.neariq.io/llms.txt

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

cURL

# Get business profile
curl https://app.neariq.io/api/v1/me \
  -H "X-NearIQ-Key: niq_your_key_here"

# Get recent danger alerts
curl "https://app.neariq.io/api/v1/me/alerts?severity=danger&limit=10" \
  -H "X-NearIQ-Key: niq_your_key_here"

# Register a webhook
curl -X POST https://app.neariq.io/api/v1/webhooks \
  -H "X-NearIQ-Key: niq_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://yourapp.com/hook","events":["*"],"secret":"your_secret"}'

Ruby

require 'net/http'
require 'json'

def neariq(path, params = {})
  uri = URI("https://app.neariq.io/api/v1#{path}")
  uri.query = URI.encode_www_form(params) unless params.empty?
  req = Net::HTTP::Get.new(uri)
  req['X-NearIQ-Key'] = ENV['NEARIQ_API_KEY']
  res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |h| h.request(req) }
  JSON.parse(res.body)
end

me = neariq('/me')
puts "#{me['name']}: #{me['rating']} stars"

Go

package main

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

func neariq(path string) (map[string]interface{}, error) {
    req, _ := http.NewRequest("GET", "https://app.neariq.io/api/v1"+path, nil)
    req.Header.Set("X-NearIQ-Key", os.Getenv("NEARIQ_API_KEY"))
    res, err := http.DefaultClient.Do(req)
    if err != nil {
        return nil, err
    }
    defer res.Body.Close()
    body, _ := io.ReadAll(res.Body)
    var result map[string]interface{}
    json.Unmarshal(body, &result)
    return result, nil
}

func main() {
    me, _ := neariq("/me")
    fmt.Printf("%s: %.1f stars\n", me["name"], me["rating"])
}