Skip to content
Kirill Ponomarev edited this page May 4, 2023 · 13 revisions

Response types

The server can only reply with a success message and success status code or with an error message and error status code. There are only 3 possible error response structures, all of them described in core.py file by custom error handlers:

Validation or parsing error response structure

{   "message": {       "field_name": "Validation or parsing error message",       "another_field_name": "Another validation or parsing error message"   } }

Ordinary error response structure

{   "message": {     "error": "Error type. Error message"   } }

Unknown error response structure

{   "message": {     "error": "Unknown Error. Sorry, that error is on us, please contact support if this wasn't an accident"   } }

P.S Create an issue with a description of the circumstances under which the unknown error occurred to help us fix it.

Successful response structure

{   "message": {     "success": "Message"   } }

Token authentication

Some API requests require token recieved after login procedure, the token should be included in x-access-token header.

Token authentication error responses

HTTP Status Code Response Body
400 { "message": {"error": "Missing Request Header. Token is missing in x-access-token header" }}
401 { "message": { "error": "Authentication Error. Token already expired" }}
404 { "message": { "error": "Resource Already Exists. Current user does not exist" }}
401 { "message": { "error": "Authentication Error. Token is invalid" }}

Encrypted parameters

Some request body parameters should be in encrypted form. You can check it in specific endpoint's request structure section, the parameter will be marked as "encrypted". So if parameter has the marker, you should provide it's value in the following format: Data:IV.

Endpoint documentation

Database

SnailPass repositories

SnailPass-Server SnailPass-Windows-Clent SnailPass-Android-Clent