Back home
v1 · public preview

Customs as an API.

Every declaration in the GlobalLine dashboard is also a REST resource. File from your ERP, TMS, or checkout. JSON in, JSON out. Bearer auth. No SOAP, no SDR onboarding, no licence file.

Authentication

Generate a key in Settings → API & Webhooks. Send it as a Bearer token. Keys are hashed at rest and revocable instantly.

curl https://api.globalline.app/api/public/v1/declarations \
  -H "Authorization: Bearer gl_live_•••••••••••"

Endpoints

GET/api/public/v1/declarations?limit=50&status=queued

List declarations for the authenticated org. Filter by status (queued, approved, route1, cleared, rejected).

Response
{
  "data": [
    {
      "id": "f0e3…",
      "status": "approved",
      "mrn": "25GB01ZA001234",
      "hs_code": "8471.30",
      "origin_country": "CN",
      "declared_value": 12450.00,
      "duty_amount": 248.99,
      "vat_amount": 2540.00,
      "confidence": 0.97,
      "ai_handled": true,
      "created_at": "2026-05-08T10:12:33Z"
    }
  ],
  "total": 412,
  "limit": 50
}
POST/api/public/v1/declarations

Create a new declaration draft. Returns 201 with the new id; the agent picks it up and routes it through your autonomy gates.

Request body
{
  "supplier": "Acme Trading GmbH",
  "hs_code": "8471.30",
  "origin_country": "DE",
  "declared_value": 12450.00,
  "incoterm": "DAP"
}
Response
{
  "id": "9c2f…",
  "status": "queued",
  "hs_code": "8471.30",
  "declared_value": 12450.00,
  "duty_amount": 0,
  "vat_amount": 0,
  "created_at": "2026-05-08T10:14:01Z"
}
GET/api/public/v1/declarations/{id}

Fetch a single declaration by id, including the full agent draft JSON.

Response
{ "id": "9c2f…", "status": "approved", "draft_json": { … }, … }

Errors

All errors return JSON: { "error": { "code": "…", "message": "…" } }

  • 401 missing_bearer / invalid_key / revoked — auth problem
  • 400 invalid_body — request failed schema validation
  • 404 not_found — resource not in your org
  • 500 query_failed / insert_failed — server-side; we get paged