Responses and status codes
All API responses are returned in JSON format and follow a consistent structure to indicate the outcome of each request. This section outlines how to interpret success and error responses, including HTTP status codes and response body formats.
Common HTTP Status Codes
The following table shows the HTTP status codes used in the BoldSales API.
| Status Code | Message |
| 200 | OK |
| 201 | Created |
| 400 | Client or Validation Error |
| 401 | Authentication Failure |
| 403 | Access Denied |
| 404 | API or Item Not Found |
| 405 | Method Not Allowed |
| 415 | Unsupported Media Type |
| 429 | Rate Limit Exceeded |
| 500 | Unexpected Server Error |
Success Responses
When a request is successful, the API returns a data object containing relevant information. For write operations such as POST, PUT, PATCH, and DELETE, a message field may also be included to provide a human-readable description of the outcome.
Example
{
"message": "Contact created successfully.",
"data": {
"id": 202730
}
}
Error Responses
When a request fails, the API returns an error response with details about what went wrong. This includes a general message, a list of errors, and a statusCode.
Client or Validation error
This error indicates that the server cannot process the request because of a client error, such as invalid request message framing or deceptive request routing.
| Error Type | Description |
| DuplicateValue | The requested update in the field or entry already exists |
| FieldRequired | One or more required fields are missing from the request. |
| InvalidValue | The value provided for the field is not valid |
| LengthExceeded | The value provided for the field exceeds the prescribed limit |
| NotFound | The requested details for updating/fetching a metric/log/entry/detail are not found |
| APICallQuotaExceeded | The request has been restricted due to the subscription limit of the organization |
| MethodNotAllowed | The request or value for the field is not allowed due to client validation or authorization restrictions |
{
"errors": [
{
"field": "EmailAddress",
"errorMessage": "[email protected] already exists.",
"errorType": "DuplicateValue"
}
],
"message": "Validation failed.",
"statusCode": 400
}
Authentication failure
As indicated by the status code, either the Authorization header is missing or incorrect.
{
"errors": [
{
"field": "userId",
"errorMessage": "Current user does not have permission to perform this action.",
"errorType": "Unauthorized"
}
],
"message": "Unauthorized",
"statusCode": 401
}
Access denied
This error indicates that the server received the request but denied it because the user does not have the required permissions.
{
"errors": [
{
"field": "userId",
"errorMessage": "Current user does not have permission to perform this action.",
"errorType": "AccessDenied"
}
],
"message": "Access Denied",
"statusCode": 403
}
API or Item not found
Either the API URL or the object ID in the request is invalid.
{
"errors": [
{
"field": "fieldId",
"errorMessage": "Field does not exist.",
"errorType": "NotFound"
}
],
"message": "Not found",
"statusCode": 404
}
Method not allowed
This error indicates that the HTTP method used in the request is not allowed for this endpoint.
{
"errors": [
{
"field": "",
"errorMessage": "Method not allowed",
"errorType": "MethodNotAllowed"
}
],
"message": "Method not allowed",
"statusCode": 405
}
Unsupported media type
This errorCode value appears if the server refuses the request as a result of receiving the input in an unsupported format.
{
"errors": [
{
"field": "",
"errorMessage": "Unsupported Media Type",
"errorType": "UnsupportedMediaType"
}
],
"message": "Unsupported Media Type",
"statusCode": 415
}
Rate limit exceeded
It indicates that the maximum number of requests has been reached. A rate limit is established based on the organization's plan.
{
"errors": [
{
"field": "",
"errorMessage": "Rate limit exceeded! Maximum allowed token cost is 10000 per hour.",
"errorType": "APICallQuotaExceeded"
}
],
"message": "Rate limit exceeded! Maximum allowed token cost is 10000 per hour.",
"statusCode": 429
}