API Authentication, Permissions & Error Codes

The ClimeqAI REST API (/api/v1/integrations/*) connects your ERP systems, supply-chain platforms, and smart-meter gateways using sust_... API Keys, scoped permissions, and standard error codes.

1. API Key & X-Api-Key Header

Organization administrators (Owner and Admin) can create dedicated API keys for each integration in the Security Center:

  • Key Format: Prefix sust_ followed by 48 random hexadecimal characters (e.g., sust_8f92a1b4c6d8e0f1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7).
  • Secure Storage (SHA-256): The raw key is shown once upon creation; only its SHA-256 hash is stored in the database.
  • HTTP Header: Pass the key in the X-Api-Key header on every request:
curl -X POST "https://api.climeqai.com/api/v1/integrations/emissions/calculate" \
  -H "X-Api-Key: sust_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "sourceType": "Natural Gas",
    "quantity": 450,
    "unit": "m3",
    "region": "TR",
    "calculationMethod": "ar6",
    "persist": false
  }'

2. Permission Scopes

Each API key can be restricted to the specific scopes it needs. Write scopes (*:write) automatically include calculation and read permissions within the same resource family:

ScopeAuthorized OperationsCovered Endpoint Family
emissions:calculateStateless (persist: false) calculations across core, AI mapping, energy, freight, procurement, travel, PCF, CBAM, and cloud carbonPOST /emissions/calculate, /mapping-agent/, /energy/, /freight/, /procurement/, /travel/, /pcf/, /cbam/, /cloud/calculate
emissions:writeSaving records to the carbon ledger (persist: true), background queueing (async: true), and smart-meter ingestionAll calculation endpoints (persist: true) + /telemetry/push
emissions:readRetrieving saved emission records, gas breakdowns, audit trails, and blockchain proofsGET /emissions/{id}, GET /telemetry/
factors:searchSearching emission factors and listing unit types, region codes, and dataset versionsGET /data/search, /data/unit-types, /data/regions, /data/versions
private-factors:readListing organization-specific private emission factorsGET /private-factors
private-factors:writeCreating organization-specific private emission factorsPOST /private-factors
private-factors:deleteDeleting organization-specific private emission factorsDELETE /private-factors/{id}

3. Account Isolation & Data License Protection

Security LayerEnforced PolicyViolation Response
Endpoint Isolationsust_... keys can only access the 31 integration endpoints under /api/v1/integrations/; console endpoints are blocked.401 / 403
Account IsolationEvery key is bound to one OrganizationId. Overriding the organization via X-Tenant-Id, ?orgId=, or body fields is rejected.403 Forbidden (missing_organization_context)
IP WhitelistingWhen IP whitelisting is enabled in Security Settings, only requests from approved IPv4/IPv6 ranges are accepted.401 Unauthorized
Commercial Dataset Masking (factorValueMasked)For calculation-only commercial datasets (e.g., Ecoinvent, IEA, EXIOBASE), total co2e is returned accurately while raw unit coefficients are masked (factorValueMasked: true).200 OK (Masked coefficient)

[!NOTE]

For security, URLs supplied in sourceLink on private emission factors block localhost, loopback, private network subnets (10.x, 192.168.x, 172.16-31.x), and cloud metadata services (169.254.169.254).

4. Response Format & Error Codes

Every integration endpoint returns a consistent JSON structure (success, data, message, errorCode, errors):

{
  "success": false,
  "data": null,
  "message": "No active emission factor found for selector 'steel_section' in exact region 'FR' (regionFallback=false).",
  "errorCode": "no_emission_factors_found",
  "errors": []
}

Standard Error Codes (errorCode)

HTTP StatuserrorCodeMeaning & Recommended Client Action
400invalid_inputMissing required field or non-positive numeric quantity. Validate payload schema before retrying.
400batch_limit_exceededBatch array exceeds 100 items. Split batch requests into chunks of at most 100 items.
400 / 422invalid_unit_typeSupplied unit is incompatible with the selected factor's dimension. Query GET /data/unit-types.
401(Auth Failure)Missing, malformed, expired, or revoked X-Api-Key, or client IP outside organization whitelist.
403missing_api_scopeAPI key lacks the required scope for the target endpoint.
403missing_organization_contextSupplied organizationId or X-Tenant-Id mismatches the key's bound organization.
403feature_not_entitledTarget module (e.g., CBAM, Private Factors, Blockchain Sealing) requires a higher subscription tier.
403quota_exceededMonthly persisted emission record quota (MonthlyEmissionRecords) has been reached.
404 / 422no_emission_factors_foundNo active emission factor matched the selector, region, or year constraints.
404resource_not_foundRequested record ID or cloud region does not exist.
422license_restrictedSelected factor cannot be used due to dataset license status.
429rate_limit_exceededPer-key rate limit (60 req/min) or monthly API quota exceeded. Wait for Retry-After (60s) before retrying.
503service_unavailableDownstream calculation engine is temporarily unavailable; retry shortly.

5. Request Size & Rate Limits

  • Max Request Body Size: 1 MB (1,048,576 bytes; 256 KB on telemetry ingestion).
  • Rate Limit: 60 requests / minute per API key (returns Retry-After: 60).
  • Collection Limits: Maximum 100 items per batch request, 25 legs per intermodal freight route, 50 BOM components per PCF request, and 120 characters per catalog search query.

Platform Guide & Technical Documents