Response Codes

The HTTP status codes the Surfact API returns, and what they mean.

When you make an HTTP request, the Surfact API returns standard HTTP status codes to indicate success or failure.

CodeMeaningWhat it means
200OKRequest successful.
201CreatedRequest successful and a resource (device or variable) was created.
202AcceptedRequest accepted for processing, but not yet completed.
204No ContentRequest successful and there is no response body to return.
400Bad RequestA field is incorrect and the request was not saved. The JSON body or a query-string parameter failed validation — body errors come back as {"code": 400001, "message": "Validation Error.", "detail": {...}} naming the offending fields, while query-string problems (such as a non-numeric start or a page_size below 1) come back as a detail or message string. Verify your JSON is valid, fields match the expected types (string, object, or float), and your query parameters are in range.
401UnauthorizedInvalid or missing API key. Check your token — see Authentication.
402Payment RequiredCheck your account balance.
403ForbiddenYour token is valid, but the account lacks permission for this resource ({"detail": "You do not have permission to perform this action."}), or the request violates an account limit such as data retention (code 403003). A missing or wrong token returns 401, not 403.
404Not FoundThe requested resource doesn't exist. Check for typos in device/variable labels, IDs, or the request URL.
405Method Not AllowedThis endpoint doesn't support the HTTP method used. See the reference for allowed methods.
415Unsupported Media TypeThe request payload format is not supported.
420Rate Limit ExceededYou've exceeded your API limits. Contact support to upgrade.
423LockedThe device is disabled and cannot receive data.
429Too Many RequestsRate limiting in effect. Reduce request frequency.
50xServer ErrorSurfact is experiencing server issues. Check the status page or try again later.

Error response format

Authentication errors return a code and message. Surfact returns a single authentication-failure code, 401002, whether the token is missing, empty, or wrong:

{
  "code": 401002,
  "message": "Incorrect authentication credentials."
}

Validation errors (such as malformed JSON) return a detail field:

{
  "detail": "JSON parse error - Expecting value: line 4 column 22 (char 121)"
}
📘

Still stuck on a non-200 response? Email [email protected].


Did this page help you?