Using the REST API directly
4 min read Updated October 21, 2026
Calling the API directly
This is how every example in the docs works today: the Node.js and Python SDKs are source previews that are not yet published, and there is no Go SDK. Any HTTP client will do.
Authentication
The simplest way is your API key in the x-api-key header (cg_sk_ keys on sandbox.api.compliancegrid.ai, cg_pk_ keys on api.compliancegrid.ai). You can also exchange client credentials for a Bearer token:
bash
# Option 1: API key curl -H "x-api-key: $CG_API_KEY" "https://sandbox.api.compliancegrid.ai/v1/hs/search?q=laptop" # Option 2: OAuth client credentials export CG_TOKEN=$(curl -s -X POST https://sandbox.api.compliancegrid.ai/oauth/token \ -d "grant_type=client_credentials" \ -d "client_id=YOUR_CLIENT_ID" \ -d "client_secret=YOUR_CLIENT_SECRET" | jq -r '.access_token') curl -H "Authorization: Bearer $CG_TOKEN" "https://sandbox.api.compliancegrid.ai/v1/hs/search?q=laptop"
POST requests
bash
curl -X POST https://sandbox.api.compliancegrid.ai/v1/compliance/restricted-party-screening \
-H "x-api-key: $CG_API_KEY" \
-H "Content-Type: application/json" \
-d '{"parties": [{"name": "Test Corp", "country": "US"}]}'Response format
Successful responses are { "success": true, "data": ..., "meta": ... }. Errors are { "success": false, "error": { "code", "message", "details" } }, except authentication and rate-limit errors, which are the short form { "error": "invalid_api_key", "message": ... }. See the Errors page for every code.
Common headers
| Header | Direction | Description |
|---|---|---|
| `x-api-key` | Request | Your API key |
| `Content-Type` | Request | `application/json` for POST |
| `X-RateLimit-Limit`, `X-RateLimit-Remaining`, `X-RateLimit-Reset` | Response | The tightest rate-limit window |
| `Retry-After` | Response | Seconds to wait (429 only) |
| `X-Data-Provenance` | Response | Where the data comes from: live, database, computed or seed |
| `X-Compliance-Grid-Request-Id` | Response | Quote this when you contact support |
Was this article helpful?