Clojure SDK
Integrate Meridian license validation into your Clojure application using clj-http with bearer-token authentication.
Installation
Add clj-http and cheshire to your deps.edn:
;; deps.edn
{:deps {clj-http {:mvn/version "3.13.0"}
cheshire {:mvn/version "5.13.0"}}}Authentication
All requests require a Bearer token set via the MERIDIAN_API_KEY environment variable.
(def api-key (System/getenv "MERIDIAN_API_KEY"))
(defn auth-headers []
{"Authorization" (str "Bearer " api-key)
"Content-Type" "application/json"})License Validation
POST to /v1/license/validate with the license key and hardware ID:
(defn validate-license [license-key hwid]
(let [url "https://api.getnimbus.net/v1/license/validate"
body (json/generate-string
{:license_key license-key
:hwid hwid
:product_id "meridian-pro"})
resp (http/post url
{:headers (auth-headers)
:body body
:socket-timeout 5000
:conn-timeout 5000})]
(if (= 200 (:status resp))
(json/parse-string (:body resp) true)
(throw (ex-info "License validation failed"
{:status (:status resp)
:body (:body resp)})))))Complete Example
(ns meridian.client
(:require [clj-http.client :as http]
[cheshire.core :as json]))
(def api-key (System/getenv "MERIDIAN_API_KEY"))
(defn auth-headers []
{"Authorization" (str "Bearer " api-key)
"Content-Type" "application/json"})
(defn validate-license [license-key hwid]
(let [url "https://api.getnimbus.net/v1/license/validate"
body (json/generate-string
{:license_key license-key
:hwid hwid
:product_id "meridian-pro"})
resp (http/post url
{:headers (auth-headers)
:body body
:socket-timeout 5000
:conn-timeout 5000})]
(if (= 200 (:status resp))
(json/parse-string (:body resp) true)
(throw (ex-info "License validation failed"
{:status (:status resp)
:body (:body resp)})))))
(defn -main [& args]
(let [license-key (first args)
hwid (second args)]
(try
(let [result (validate-license license-key hwid)]
(println "Valid:" (:valid result))
(println "Expires:" (:expires_at result))
(println "Tier:" (:tier result)))
(catch Exception e
(println "Error:" (.getMessage e))
(System/exit 1)))))Response Format
;; 200 OK
{:valid true
:expires_at "2026-06-15T00:00:00Z"
:tier "pro"
:seats 5
:features ["auto-update" "priority-support"]}
;; 401 Unauthorized
{:error "invalid_api_key"}
;; 422 Unprocessable
{:error "license_expired"
:expired_at "2025-12-01T00:00:00Z"}Error Handling
Wrap calls in try/catch and inspect the response status:
- 401Invalid or missing API key — check your environment variable.
- 422License expired, revoked, or hardware ID mismatch.
- 429Rate limited — implement exponential backoff with jitter.
- 5xxServer error — retry with backoff, surface to user if persistent.