Help Center/Getting Started

Making your first API call

5 min read Updated February 10, 2026

Overview

This guide walks you through making your first live API call to ComplianceGrid using cURL. By the end, you'll have successfully queried the HS Code Search API on the sandbox environment.

Prerequisites

  • A ComplianceGrid account (sign up at compliancegrid.ai/register)
  • A sandbox API key (cg_sk_...) — see Creating your first API key
  • OAuth client credentials (client_id and client_secret) from the Developer Portal
  • cURL or any HTTP client (Postman, Insomnia, etc.)

Step 1: Get a Bearer Token

Exchange your credentials for an access token:

bash
curl -X POST https://sandbox.api.compliancegrid.ai/oauth/token \
  -d "grant_type=client_credentials" \
  -d "client_id=YOUR_CLIENT_ID" \
  -d "client_secret=cg_sk_your_sandbox_key"

The response includes an access_token field. Export it for convenience:

bash
export CG_TOKEN="eyJhbGciOiJSUzI1NiI..."

Step 2: Call an API Endpoint

Let's search for HS codes related to "laptop":

bash
curl -H "Authorization: Bearer $CG_TOKEN" \
  "https://sandbox.api.compliancegrid.ai/v1/hs/search?q=laptop"

Step 3: Inspect the Response

A successful response returns HTTP 200 with JSON containing matching HS code entries, including the HTS number, description, duty rates, and related codes.

Troubleshooting

  • 401 Unauthorized — Your token may be expired (tokens last 1 hour). Request a new one.
  • 403 Forbidden — Ensure you're using a sandbox key (cg_sk_) with the sandbox host, not the production host.
  • 429 Too Many Requests — You've exceeded the sandbox rate limit (60 req/min). Wait and retry.
  • Connection timeout — Check that your network allows outbound HTTPS to sandbox.api.compliancegrid.ai.

Was this article helpful?