HTTP status and error codes

Bigin APIs use standard HTTP response status codes and error descriptions when informing users/applications about the status and error of an API call. The HTTP status code in the response header separates the errors of the request, while the response body contains additional details providing information about the error codes.

Error and status codes

The HTTP status codes categorize the errors of the request and indicate whether the response server executes the request or not.

Bigin API categorizes the status codes into the following types:

  • 2xx - This code returns when the request is successful.
  • 3xx - This code returns when the client needs to take further action to serve their request.
  • 4xx - This code returns when the request throws an error.
  • 5xx - This code returns when there is an issue with the server.

The following table contains the possible status codes that return when you make an API request to Bigin:

Status CodeTitleHTTP MethodDescription
200OKGET/PUT/DELETEThis code is used when an entire response is successful.
201CreatedPOSTThis code is used when the requested API inserts a record.
202AcceptedPOST/PUT/DELETEThis code is used when the requested API inserts multiple records.
204No ContentGETThis code is used when the resource does not exist.
304Not ModifiedPUT/GETThis code is used when there is no update in the requested resource since the last time you accessed it.
400Invalid Data (or) Bad RequestGET/POST/PUT/DELETEThis code is used when the requested API or authentication is invalid or the given request data is invalid.
401Unauthorized ErrorGET/POST/PUT/DELETEThis code is used when the authentication tokens are invalid.
401Unauthorized ErrorGET/POST/PUT/DELETEThis code is used when the authentication tokens are invalid.
403ForbiddenGET/POST/PUT/DELETEThis code is used when there is no permission for the requested resource.
404Not FoundGET/POST/PUT/DELETEThis code is used when the requested resource is not found.
405Method Not AllowedPUTThis code is used when the requested method is not supported by the target resource.
413Request Entity Too LargePOST/PUTThis code is used when a request has a file to upload and the size of the file is larger than the server is able to process.
415Unsupported Media TypePOST/PUTThis code is used when the server does not support the media/file type the request is trying to upload.
429Too Many RequestsGET/POST/PUT/DELETEThis code is used when the client exceeds the number of API calls in 24 hour period or the number of users for an app.
500Internal Server ErrorGET/POST/PUT/DELETEThis code is used when the server throws an internal error.

Representation of error response

The error response can be viewed in two formats such as HTTP response and JSON response. The HTTP response contains the header details of the response such as HTTP status codes, metadata of the response, and so on. On the other hand, the JSON response contains details about the error in the human-readable format.

For example, the error format for HTTP status code 400 looks like this:

HTTP response

HTTP/1.1 400
Server: ZGS
Date: Mon, 12 Dec 2022 13:17:56 GMT
Content-Type: application/json;charset=UTF-8
Content-Length: 204
Connection: keep-alive
Set-Cookie: 3d223cf300=6cd7d9b17e6c6d0feaf53c99d1891ab5; Path=/
X-XSS-Protection: 1
X-Frame-Options: sameorigin
X-Content-Type-Options: nosniff
Set-Cookie: JSESSIONID=FC7042CB324F8FB882F9D0C21FCECD2A; Path=/; Secure; HttpOnly
Content-Language: en-US

JSON response

{
"code": "INVALID_REQUEST",
"details": {},
"message": "Unable to process your request. please verify whether you have entered proper method name, parameter and parameter values.",
"status": "error"
}

The JSON format of the error response contains the following details:

NameData typeDescription
statusstringIndicates the state of the response object. Can be success or error.
codestringIndicates the error code such as INVALID_DATA, NO_PERMISSION, INVALID_MODULE and so on.
messagestringDisplays human-readable message that explains about the error to users.
detailsstringAdditional information about the error. For example, when the NO_PERMISSION error occurs, this section includes permissions that are required to avoid this error.

Also, Bigin APIs use the generic status codes for several different errors. In such cases, the error response in JSON format contains the machine-parsable code parameter that separates the failure of the requests and provides the respective error details. This allows you to understand the errors better and take necessary steps to avoid them.

The following table provides the information about API error codes and respective descriptions:

codeDescription
INVALID_DATA

This error occurs when:

  • the request body has the invalid input data
  • the id specified is incorrect
  • the request body isn't in JSON format
  • the data type is incompatible in the request body
  • the data key has the incorrect data type in the request body
INVALID_MODULE

This error occurs when:

  • the given module name seems to be invalid
  • the specified module isn't supported or not available in Bigin
NO_PERMISSION

This error occurs when the client does not have permission to the following:

  • create or update records
  • read resources
  • upload or download attachments
INVALID_REQUEST_METHODThis error occurs when the request has an invalid HTTP method type.
INVALID_URL_PATTERNThis error occurs when the specified request URL is invalid.
OAUTH_SCOPE_MISMATCHThis error occurs when the request scope doesn't match the authorized scope.
REQUIRED_PARAM_MISSINGThis error occurs when the request doesn't have the mandatory parameter.
MANDATORY_NOT_FOUNDThis error occurs when the mandatory fields aren't specified in the input data of the request.
DUPLICATE_DATAThis error occurs when the request adds the duplicate values for unique fields of a record.
NOT_SUPPORTEDThis error occurs when the requested APIs support just administrators.
MEDIA_TYPE_NOT_SUPPORTEDThis error occurs when the 'Content-Type' header isn't shared along with the request.
INTERNAL_ERRORThis error occurs when the server raises an unexpected or unhandled exception.
AUTHORIZATION_FAILED

This error occurs when the trial gets expired or when the client doesn't have sufficient privileges to the following:

  • update profile and role of another user
  • delete users
  • read resources
  • create, update or delete records
  • upload, download or delete attachments or images
INVALID_FILE_FORMATThis error occurs when the request tries to upload the invalid file format.
FILE_TOO_LARGEThis error occurs when the request tries to upload a file which is larger than the server is able to process.
MANDATORY_FIELDS_NOT_MAPPEDThis error occurs when all the mandatory fields in the module aren't mapped.
INVALID_FIELDThis error occurs when the field API name is incorrect.
INVALID_FORMATThis error occurs when the specified field format is incorrect.
INVALID_FILE_IDThis error occurs when the specified field ID is incorrect.
HEADER_LIMIT_EXCEEDEDThis error occurs when the number of fields mapped exceeds the maximum limit of 200.
COLUMN_INDEX_NOT_FOUNDThis error occurs when the column index maps with negative values.
MODULE_NOT_AVAILABLEThis error occurs when the API name of a module is incorrect or the API request doesn't support the module.
RESOURCE_NOT_FOUNDThis error occurs when the requested resource isn't available.
FILE_SIZE_MORE_THAN_ALLOWED_SIZEThis error occurs when the request tries to upload the image file which exceeds the allowed size of up to 1 MB and 10 MP.
LICENSE_LIMIT_EXCEEDEDThis error occurs when the request to add users exceeds the maximum number of allowed users in the subscribed Bigin plan.
CANNOT_UPDATE_DELETED_USERThis error occurs when the request tries to update the deleted user.
INVALID_REQUESTThis error occurs when the request tries to re-invite the confirmed user or deactivate the primary contact.
EMAIL_UPDATE_NOT_ALLOWEDThis error occurs when the request tries to update the email of the confirmed user.
ID_ALREADY_DEACTIVATEDThis error occurs when the request tries to deactivate the user who is already in deactivate state.
ID_ALREADY_ACTIVEThis error occurs when the request tries to activate the user who is already in active.
FEATURE_PERMISSIONThis error occurs when the share among the subordinates feature isn't available for the Bigin account.
ID_ALREADY_DELETEDThis error occurs when the request tries to delete the user who is already removed from the account.
PATTERN_NOT_MATCHEDThis error occurs when the request has the incorrect parameter value.
UNABLE_TO_PARSE_DATA_TYPEThis error occurs when the request body or parameter values are in the wrong format.