Quickstart (5 minutes)
Follow these steps to make your first authenticated request and wire it into a tiny script/app.
Prerequisites
- AquaCloud account & credentials
- Terminal with curl
- (Optional) Node.js / Python / Go
1) Set environment variables
export AQC_USERNAME="<your_username>"
export AQC_PASSWORD="<your_password>"
2) Get an access token
AQC_TOKEN=$(\
curl -s -X POST https://api.aquacloud.ai/token \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=password" \
-d "username=${AQC_USERNAME}" \
-d "password=${AQC_PASSWORD}" \
| jq -r '.access_token'
)
echo "Token acquired: ${#AQC_TOKEN} chars"
If you don’t have jq, remove the pipe and copy access_token manually.
3) Call a protected endpoint
curl -s "https://api.aquacloud.ai/v3/common/farmers-in-aquacloud?offset=0&limit=10" \
-H "accept: application/json" \
-H "Authorization: Bearer $AQC_TOKEN" | head
4) Language snippets
JavaScript (Node / fetch)
const token = process.env.AQC_TOKEN;
const res = await fetch(
"https://api.aquacloud.ai/v3/common/farmers-in-aquacloud?offset=0&limit=10",
{ headers: { Authorization: `Bearer ${token}`, Accept: "application/json" } }
);
if (!res.ok) throw new Error(`${res.status} ${res.statusText}`);
console.log(await res.json());
Python (requests)
import os, requests
token = os.environ["AQC_TOKEN"]
url = "https://api.aquacloud.ai/v3/common/farmers-in-aquacloud"
r = requests.get(url, params={"offset": 0, "limit": 10},
headers={"Authorization": f"Bearer {token}", "Accept": "application/json"}, timeout=30)
r.raise_for_status()
print(r.json())
Go (net/http)
req, _ := http.NewRequest("GET", "https://api.aquacloud.ai/v3/common/farmers-in-aquacloud?offset=0&limit=10", nil)
req.Header.Set("Authorization", "Bearer "+os.Getenv("AQC_TOKEN"))
req.Header.Set("Accept", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil { log.Fatal(err) }
defer resp.Body.Close()
io.Copy(os.Stdout, resp.Body)
5) Refresh token (optional)
REFRESH_TOKEN="<paste refresh_token>"
AQC_TOKEN=$(curl -s -X POST https://api.aquacloud.ai/token \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=refresh_token" \
-d "refresh_token=${REFRESH_TOKEN}" | jq -r '.access_token')
6) Pagination example
curl -s "https://api.aquacloud.ai/v3/common/farmers-in-aquacloud?offset=10&limit=10" \
-H "Authorization: Bearer $AQC_TOKEN" -H "accept: application/json"
7) Quick troubleshooting
- 401: check Authorization: Bearer <token>; token may be expired.
- 403: request access to the resource.
- 404: verify path and version (/v3/...).
- 429: slow down; retry with exponential backoff.
Next steps
- Explore endpoints interactively at https://api.aquacloud.ai
- Explore our dashboard built using the AquaCloud API at https://insights.aquacloud.ai
- Pin API version (/v3/) in production