Documentation navigation
API docsSDK and HTTP clients
Essential guides
SDK and HTTP clients
Use the HTTP client that suits your stack.
The examples use cURL, JavaScript fetch, PHP cURL and Python’s standard library. They do not require an official StayClean SDK. Keep credentials on your server; use your HTTP client’s error handling and timeouts. Request examples describe API calls but never run them from this documentation.
Request example
cURL
curl --request 'GET' 'https://api.stayclean.io/api/v1/interventions?page=1&limit=25&sort=desc' \
--header 'Authorization: Basic YOUR_API_TOKEN' \
--header 'Accept: application/json'JavaScript
const response = await fetch("https://api.stayclean.io/api/v1/interventions?page=1&limit=25&sort=desc", {
"method": "GET",
"headers": {
"Authorization": "Basic YOUR_API_TOKEN",
"Accept": "application/json"
}
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const data = await response.json();PHP
<?php
$curl = curl_init('https://api.stayclean.io/api/v1/interventions?page=1&limit=25&sort=desc');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => array (
0 => 'Authorization: Basic YOUR_API_TOKEN',
1 => 'Accept: application/json',
),
]);
$response = curl_exec($curl);
if ($response === false) throw new RuntimeException(curl_error($curl));
curl_close($curl);
$data = json_decode($response, true, 512, JSON_THROW_ON_ERROR);PYTHON
import json
from urllib.request import Request, urlopen
headers = {
"Authorization": "Basic YOUR_API_TOKEN",
"Accept": "application/json"
}
data = None
request = Request("https://api.stayclean.io/api/v1/interventions?page=1&limit=25&sort=desc", data=data, headers=headers, method="GET")
with urlopen(request) as response:
result = json.load(response)