Skip to content

Error Handling

The API uses standard HTTP status codes and returns structured JSON error responses.

Error Response Format

json
{
  "error": {
    "code": "ERROR_CODE",
    "message": "Human-readable description",
    "fields": [
      { "field": "url", "message": "URL is required" }
    ]
  },
  "request_id": "550e8400-e29b-41d4-a716-446655440000"
}
FieldTypeDescription
error.codestringMachine-readable error code
error.messagestringHuman-readable explanation
error.fieldsarray?Per-field validation errors (when applicable)
request_idstringUnique ID for debugging / support

HTTP Status Codes

StatusMeaning
200Success
201Created
400Invalid request (validation errors)
401Authentication failed
404Resource not found
409Conflict (e.g., API key already exists)
429Rate limit exceeded
500Internal server error

Error Codes

CodeHTTP StatusDescription
UNAUTHORIZED401Missing or invalid API key
RATE_LIMITED429Rate limit exceeded
INVALID_JSON400Request body is not valid JSON
VALIDATION_ERROR400Input validation failed
NOT_FOUND404QR code not found or not owned by you
SERVER_ERROR500Internal error — contact support

Validation Errors

When code is VALIDATION_ERROR, the fields array provides per-field details:

json
{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Invalid input",
    "fields": [
      { "field": "url", "message": "URL is required" },
      { "field": "url", "message": "URL must start with http:// or https://" }
    ]
  },
  "request_id": "..."
}

Bulk Operation Errors

For bulk create, individual item errors are returned alongside successful results:

json
{
  "created": [ /* successfully created items */ ],
  "errors": [
    {
      "index": 2,
      "errors": [
        { "field": "url", "message": "URL is required" }
      ]
    }
  ],
  "summary": {
    "total_submitted": 5,
    "total_created": 4,
    "total_failed": 1
  },
  "request_id": "..."
}

The index field indicates the 0-based position in the submitted array.

QBar Scanner Developer API