Standard Responses and Errors
Overview
The PulsePoint DSP API uses consistent response formats and error codes across all endpoints to provide predictable, actionable feedback for API integrations.Response StructureSuccessful ResponsesAll successful API responses return HTTP status codes in the 2xx range with a JSON payload containing the requested resource data.
Standard errors and responses were implemented in v2+ of the APIs. If you are still on v1, this page will not be consistent with what you see in your responses.
Example Successful Response From GET Campaign:
{
"success": true,
"requestId": 9384018-1038-0-3138490,
"data": {
"campaignId": 22605,
"name": "adchoices icon Test",
"budgetCap": 10
}
}Request ID Usage The requestId field is a unique identifier generated for each API request. Include this ID when:
- Reporting issues to support
- Debugging production problems
- Correlating errors across systems
Error Responses
All error responses follow a standardized structure with consistent HTTP status codes, machine-readable error codes, and detailed context for debugging.
Standard Error Format:
{
"success": false,
"error": {
"code": "ERROR_CODE",
"message": "Human-readable error description",
"details": [
{
"field": "path.to.field",
"message": "Specific issue description",
"code": "FIELD_LEVEL_ERROR_CODE",
"value": "actual_value_provided",
"expected": "description_of_expected_value"
}
]
},
"timestamp": "2025-10-08T14:30:00.000Z",
"path": "/api/v2/endpoint",
"request_id": "req_abc123"
}Standard Error Format Fields
| Field | Type | Description |
|---|---|---|
success | boolean | Always false for error responses |
error | object | Container for error information |
error.code | string | Machine-readable error type for programmatic handling |
error.message | string | Human-friendly summary of the error |
error.details | array | Optional array of specific validation or business rule violations |
timestamp | string | ISO-8601 timestamp of when the error occurred |
path | string | The API endpoint that was requested |
request_id | string | Unique identifier for support and debugging |
Detail Object Fields
| Field | Type | Description |
|---|---|---|
field | string | JSON path to the problematic field |
message | string | Specific description of what's wrong |
code | string | Field-level error code |
value | any | The value that was provided (optional) |
expected | string | Description of what was expected (optional) |
HTTP Status Codes
| Status Code | Meaning | When Used |
|---|---|---|
| 200 | OK | Request succeeded |
| 201 | Created | Resource successfully created |
| 400 | Bad Request | Validation error in request |
| 403 | Forbidden | Insufficient permissions |
| 404 | Not Found | Resource does not exist |
| 422 | Unprocessable Entity | Business rule violation |
| 429 | Too Many Requests | Rate limit exceeded |
| 500 | Internal Server Error | Unexpected server error |
HTTP status codes are returned in the response status line (e.g., HTTP/1.1 400 Bad Request) and are not repeated in the response body. Use the HTTP status code for top-level error classification, and use the error.code field in the JSON body for specific, programmatic error handling.
Note: The HTTP status code is accessible via your HTTP client (e.g., response.status in JavaScript, response.status_code in Python). It is not duplicated in the JSON body.
Standard Error Codes
Validation Errors (HTTP 400)
| Error Code | Description | Use Case |
|---|---|---|
VALIDATION_ERROR | General validation failure | Multiple validation issues |
REQUIRED_FIELD | Missing required field | Required field not provided |
INVALID_FORMAT | Wrong format | Date, email, or other format violation |
INVALID_ENUM | Value not in allowed list | Invalid enum value provided |
INVALID_TYPE | Wrong data type | String provided when number expected |
INVALID_RANGE | Value outside allowed range | Number outside min/max bounds |
INVALID_LENGTH | String too long/short | String length constraint violation |
INVALID_BOOLEAN | Not a valid boolean value | Invalid boolean string |
INVALID_PATTERN | Pattern mismatch | Regex pattern not matched |
Business Logic Errors (HTTP 422)
| Error Code | Description | Use Case |
|---|---|---|
BUSINESS_RULE_VIOLATION | General business rule failure | Unspecified business constraint |
DUPLICATE_RESOURCE | Resource already exists | Duplicate assignment or creation |
CONFLICTING_DATES | Date ranges overlap | Flight dates conflict |
BUDGET_EXCEEDED | Budget constraint violated | Flight budget exceeds campaign budget |
INVALID_STATE | Resource in wrong state | Operation not allowed in current state |
Not Found Errors (HTTP 404)
| Error Code | Description | Use Case |
|---|---|---|
RESOURCE_NOT_FOUND | Resource doesn't exist | Generic not found |
CAMPAIGN_NOT_FOUND | Campaign not found | Specific campaign missing |
LINE_ITEM_NOT_FOUND | Line item not found | Specific line item missing |
CREATIVE_NOT_FOUND | Creative not found | Specific creative missing |
Authorization Errors (HTTP 403)
| Error Code | Description | Use Case |
|---|---|---|
ACCESS_DENIED | No permission for resource | Insufficient access rights |
PROVIDER_ACCESS_DENIED | No access to data provider | Provider not enabled for account |
INSUFFICIENT_PERMISSIONS | Missing required permission | Specific permission missing |
Rate Limiting Errors (HTTP 429)
| Error Code | Description | Use Case |
|---|---|---|
RATE_LIMIT_EXCEEDED | Too many requests | Endpoint rate limit hit |
BULK_LIMIT_EXCEEDED | Too many items in bulk operation | Batch size exceeded |
Server Errors (HTTP 500)
| Error Code | Description | Use Case |
|---|---|---|
INTERNAL_SERVER_ERROR | Unexpected server error | System failure |
Error Response Examples
- Validation Error - Missing Required Fields
- Request: POST /api/v1/lineItems
- Response: HTTP 400
{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Line item validation failed",
"details": [
{
"field": "name",
"message": "Line item name is required",
"code": "REQUIRED_FIELD"
},
{
"field": "costModel",
"message": "Cost model is required",
"code": "REQUIRED_FIELD",
"expected": "One of: CPM, FIXED CPM"
}
]
},
"timestamp": "2025-10-08T22:32:02.000Z",
"path": "/api/v1/lineItems",
"request_id": "req_xyz789"
}- Validation Error - Invalid Format
- Request: POST /api/v1/lineItems
- Response: HTTP 400
{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Request validation failed",
"details": [
{
"field": "flights[0].startDate",
"message": "Date must be in format YYYY-MM-DD HH:MM",
"code": "INVALID_FORMAT",
"value": "2025/10/08 2:30pm",
"expected": "YYYY-MM-DD HH:MM (e.g., 2025-10-08 14:30)"
}
]
},
"timestamp": "2025-10-08T14:30:00.000Z",
"path": "/api/v1/lineItems",
"request_id": "req_ghi789"
}- Validation Error - Invalid Enum Value
- Request: POST /api/v1/lineItems
- Response: HTTP 400
{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Request validation failed",
"details": [
{
"field": "costModel",
"message": "Invalid cost model",
"code": "INVALID_ENUM",
"value": "CPV",
"expected": "One of: CPM, fixedCPM"
}
]
},
"timestamp": "2025-10-08T14:30:00.000Z",
"path": "/api/v1/lineItems",
"request_id": "req_jkl012"
}- Business Logic Error - Budget Exceeded
- Request: POST /api/v1/lineItems
- Response: HTTP 422
{
"success": false,
"error": {
"code": "BUSINESS_RULE_VIOLATION",
"message": "Campaign operation violates business rules",
"details": [
{
"field": "flights",
"message": "Total flight budget exceeds campaign budget",
"code": "BUDGET_EXCEEDED",
"value": {
"totalFlightBudget": 15000.00,
"campaignBudget": 10000.00
},
"expected": "Total flight budget must not exceed campaign budget cap"
}
]
},
"timestamp": "2025-10-08T14:30:00.000Z",
"path": "/api/v1/lineItems",
"request_id": "req_bcd890"
}Best Practices for Error Handling
For API Consumers
- Check HTTP Status Codes First: Use status codes to determine the category of error before parsing the response body.
- Use Error Codes for Logic: The error.code field is stable and should be used for programmatic error handling rather than parsing error messages.
- Display Error Messages: The error.message and details[].message fields are human-readable and can be displayed to end users.
- Include Request IDs in Support Emails: Always include the request_id when contacting support about API issues.
- Handle Multiple Validation Errors: The details array may contain multiple validation errors. Display all of them to help users correct their requests in one iteration.
- Implement Retry Logic: For 429 errors, use the retryAfter value to determine when to retry. For 500 errors, implement exponential backoff.
Updated 2 months ago
