Skip to main content

Error Model

Overview

The Click API uses the same error conventions as the Amove Web API, with one additional behavior specific to the local agent: authentication failures are surfaced as 401 Unauthorized rather than 499.

StatusMeaning
200 OKRequest succeeded.
401 UnauthorizedAuthentication failed: missing or invalid token, or the underlying session was rejected.
499Application-level validation error. Body contains a ValidationProblemDetails object with a specific error code.
500 Internal Server ErrorUnexpected server error. No body returned.

HTTP 499 Response Body

{
"type": "DUPLICATE",
"status": 499,
"errors": {
"DUPLICATE": [
"A resource with the same name already exists."
]
}
}

An error-code response header duplicates the value in type.

Error Codes

The full list of application error codes — same as the Web API — is documented in the main API error reference. Common codes you may encounter on the Click API include:

CodeMeaning
AUTHAuthentication failure (returned as HTTP 401 on the Click API)
TOKENToken is invalid, expired, or already used
SESSIONSession is invalid or expired
NOT_FOUNDResource not found
DUPLICATEA resource with the same unique field already exists
ACCESSAccess denied to the requested resource
DB_INSERT / DB_UPDATE / DB_DELETEDatabase operation failed
TRANSFERTransfer operation failed
SYNCSync operation failed
DOWNLOAD_OBJECTObject download failed
CHECKSUM_MISMATCHFile checksum verification failed
FILESYSTEM_ACCESSLocal filesystem access denied
INTERNAL_ERRORInternal server error surfaced as a validation error

Handling errors in client code

Python
import requests

response = requests.get(
"http://localhost:29123/user/get_all_users",
params={"token": "YOUR_TOKEN"},
)

if response.status_code == 200:
print(response.json())
elif response.status_code == 401:
print("Authentication required; refresh your token.")
elif response.status_code == 499:
body = response.json()
code = body["type"]
print(f"Application error {code}: {body['errors'][code][0]}")
elif response.status_code == 500:
print("Server error; try again later.")
JavaScript
const res = await fetch(
"http://localhost:29123/user/get_all_users?token=YOUR_TOKEN"
);

if (res.status === 200) {
console.log(await res.json());
} else if (res.status === 401) {
console.log("Authentication required.");
} else if (res.status === 499) {
const body = await res.json();
const code = body.type;
console.log(`Application error ${code}: ${body.errors[code][0]}`);
} else if (res.status === 500) {
console.log("Server error; try again later.");
}