For the complete documentation index, see llms.txt. This page is also available as Markdown.

Authentication

Learn how to authenticate requests against the Sonoran CAD v2 API.

All current v2 API endpoints require bearer authentication.

Base URL

https://api.sonorancad.com

Required Headers

Header
Value
Description

Authorization

Bearer YOUR_API_KEY

Authenticates the request

Accept

application/json

Recommended for all requests

Example Request

-- luarocks install sonoran.lua
-- For SonoranCADFiveM in-game usage, see the SonoranCADFiveM tab for the export-based client.
local Sonoran = require("sonoran")

local sonoran = Sonoran.createClient({
  product = Sonoran.productEnums.CAD,
  communityId = "YOUR_COMMUNITY_ID",
  apiKey = "YOUR_API_KEY",
  defaultServerId = 1
})

local response = sonoran.cad:getUnitsV2({
  onlyUnits = true,
  includeOffline = false
})

-- Inspect response.success, response.data, or response.reason as needed.
print(response.success)

Response Formats

Successful Requests

Successful responses return application/json.

Failed Requests

Failed requests return application/problem+json.

Example:

Common Authentication Errors

Status
Cause

401

Missing Authorization header

401

Authorization header is not using the Bearer scheme

401

API key is invalid

404

The requested serverId is not configured for the authenticated community

Rate Limits

All v2 endpoints are rate limited per API key. Limits vary by endpoint, so check the individual endpoint page for the current enforced limit.

When a request is rate limited, the API returns 429 Too Many Requests.

Example:

If the gateway provides a Retry-After header, your client should wait that long before retrying.

Our official libraries already help with this:

  • Sonoran.js automatically retries v2 CAD requests on 429 responses up to 2 times.

  • Sonoran.lua automatically retries v2 CAD requests on 429 responses up to 2 times.

  • Sonoran.Net automatically retries v2 CAD requests on 429 responses up to 2 times and respects Retry-After when it is provided.

  • Sonoran.py automatically retries v2 CAD requests on 429 responses up to 2 times and respects Retry-After when it is provided.

These retries are intentionally limited. High-frequency integrations should still avoid bursty request patterns and should respect the published per-endpoint limits.

Last updated

Was this helpful?