Cascade provides a REST API. Below is a practical minimum in Go with the net/http client.
Useful links: API, send, verify, examples, FAQ, pricing, documentation.
Installation
The standard library is enough; a separate Cascade module may be missing.
# go mod init example.com/app
Send example
package main
import (
"bytes"
"encoding/json"
"net/http"
"os"
)
func cascade(path string, payload any) (map[string]any, error) {
b, _ := json.Marshal(payload)
req, _ := http.NewRequest(http.MethodPost, "https://cascade.kz/api"+path, bytes.NewReader(b))
req.Header.Set("Authorization", "Bearer "+os.Getenv("OTP_API_TOKEN"))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Accept", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil { return nil, err }
defer res.Body.Close()
var out map[string]any
json.NewDecoder(res.Body).Decode(&out)
return out, nil
}
Call /otp/send and /otp/verify, checking success. See API, errors, compare.