› compliance_grid.aiCOMPLIANCEGRIDGOV · COMPLIANCE · INTELLIGENCE
Help Center/SDKs & Libraries

Go quickstart

3 min read Updated October 21, 2026

SDK status

There is no Go SDK. Call the REST API with the standard library.

Calling the API

go
package main

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

func main() {
    body, _ := json.Marshal(map[string]any{
        "parties": []map[string]string{{"name": "Acme Corp", "country": "US"}},
    })
    req, _ := http.NewRequest("POST", "https://api.compliancegrid.ai/v1/compliance/restricted-party-screening", bytes.NewReader(body))
    req.Header.Set("x-api-key", os.Getenv("CG_API_KEY"))
    req.Header.Set("Content-Type", "application/json")

    client := &http.Client{Timeout: 30 * time.Second}
    res, err := client.Do(req)
    if err != nil {
        panic(err)
    }
    defer res.Body.Close()

    var out struct {
        Data struct {
            OverallResult string `json:"overallResult"`
            TotalMatches  int    `json:"totalMatches"`
        } `json:"data"`
    }
    json.NewDecoder(res.Body).Decode(&out)
    fmt.Println(res.StatusCode, out.Data.OverallResult, out.Data.TotalMatches)
}

Set a client timeout (screening and AI calls can take several seconds), check res.StatusCode, and retry 429 and 5xx responses with backoff. A 429 carries a Retry-After header.

Was this article helpful?