Documentation

Error Handling

Understand API error responses and implement robust error handling in your integrations.

Error Response Format

When a request fails, the API returns a structured error response:

{
    "success": false,
    "error": {
        "code": "PRODUCT_NOT_FOUND",
        "message": "Product with ID 999 was not found",
        "details": "The specified product does not exist or belongs to another organization"
    },
    "timestamp": "2024-12-25T12:00:00Z"
}
Field Type Description
success boolean Always false for error responses
error.code string Machine-readable error code for programmatic handling
error.message string Human-readable error message
error.details string Additional context (may be null)

HTTP Status Codes

Status Meaning When It Occurs
200 OK Request succeeded
201 Created Resource successfully created
400 Bad Request Invalid request format or parameters
401 Unauthorized Missing, invalid, or expired authentication
404 Not Found Resource does not exist
500 Internal Server Error Unexpected server-side error

Error Codes Reference

This table provides a quick reference of all error codes used across the API:

Code HTTP Status Description
INVALID_CREDENTIALS 401 Email or password is incorrect
TOKEN_EXPIRED 401 JWT token has expired, refresh or re-login required
INVALID_TOKEN 401 JWT token is missing or malformed
UNAUTHORIZED 401 No valid authentication provided
ACCOUNT_LOCKED 401 Account locked after too many failed attempts
FORBIDDEN 403 User lacks permission for this action
FEATURE_LOCKED 403 The feature is not included in your company's plan
NOT_FOUND 404 Generic resource does not exist
PRODUCT_NOT_FOUND 404 Product with specified ID does not exist
PROJECT_NOT_FOUND 404 Project with specified ID does not exist
ROOM_NOT_FOUND 404 Room with specified ID does not exist
VENDOR_NOT_FOUND 404 Vendor with specified ID does not exist
CUSTOMER_NOT_FOUND 404 Customer with specified ID does not exist
BUNDLE_NOT_FOUND 404 Bundle with specified ID does not exist
VARIANT_GROUP_NOT_FOUND 404 Variant group with specified ID does not exist
VARIANT_GROUP_MEMBER_NOT_FOUND 404 Product is not a member of the specified variant group, or the group does not exist
TEMPLATE_NOT_FOUND 404 Proposal template with specified ID does not exist
LINE_ITEM_NOT_FOUND 404 Line item with specified ID does not exist
INVOICE_NOT_FOUND 404 Invoice with specified ID does not exist
SCHEMATICS_NOT_FOUND 404 Schematics with specified ID does not exist
DRAWING_NOT_FOUND 404 Drawing with specified ID does not exist
VALIDATION_ERROR 400 Request data failed validation (check details for specific fields)
INVALID_DATA 400 Request body is malformed or missing required fields
INVALID_TENANT 400 User is not assigned to any organization
VARIANT_GROUP_RULE 400 A variant group rule was broken and nothing was written. The body also carries error.problems, an array with one sentence for each broken rule. It has no details and no timestamp. See the Variant Groups API.
DUPLICATE_ENTRY 409 Resource with same identifier already exists
DUPLICATE_CATEGORY 409 Two device categories in a list share a name or an abbreviation. See the Device Tags API.
DUPLICATE_SYSTEM 409 Two systems in a list share a name or an abbreviation. See the Device Tags API.
INVALID_DEVICE_TAG 400 A unit's new device tag breaks the character rule
DEVICE_TAG_IN_USE 400 Another unit in the project already has the device tag; the message names it
UNIT_NOT_FOUND 404 The unit is not a unit of the project in the path
BLOCK_NOT_FOUND 404 No CAD block of yours has the ID
BLOCK_ARCHIVED 400 A product or category is given an archived CAD block
VIEW_MISMATCH 400 A product or category is given a CAD block for a view the block does not list
INVALID_VISIBILITY_STATE 400 A CAD block is given a visibility state it does not have
INVALID_FILE 400 An uploaded CAD block file is empty, over 5 MB, not as long as sent, or not a DWG
INVALID_TAG 400 A CAD block attribute tag is over 255 characters or has a control character
NAME_IN_USE 409 A live CAD block already has the display name
BLOCK_NAME_IN_USE 409 A CAD block, archived or not, already has the AutoCAD block name
VIEW_IN_USE 409 A CAD block update removes a view that products or categories use it for. See the CAD Blocks API.
DRAWING_NOT_FOUND 404 The project has no linked CAD drawing with the ID
PLACEMENT_NOT_FOUND 404 The CAD drawing has no placement with the ID
TOO_MANY_BLOCKS 400 A drawing submit carries more than 10,000 blocks, or an apply more than 10,000 decisions
FIELD_PROJECT_OWNED 409 A live edit from a drawing writes an attribute the project owns; error.details.projectValue holds the project's value. See the CAD Drawings API.
INVALID_SYNC_DIRECTION 400 An attribute key's sync direction does not fit it: none on a key with a CAD tag, or a direction on a key without one
INVOICE_GENERATION_FAILED 400 Could not generate invoice (no rooms or project not found)
EMBEDDINGS_NOT_READY 400 Product embeddings must be generated before semantic search
INSUFFICIENT_CREDITS 402 Not enough AI credits for this operation
RATE_LIMITED 429 Too many requests, slow down
SERVICE_UNAVAILABLE 503 External service (AI, vendor API) is unavailable
CREATE_FAILED 500 Failed to create resource
UPDATE_FAILED 500 Failed to update resource
DELETE_FAILED 500 Failed to delete resource
INTERNAL_ERROR 500 Unexpected server error

Authentication Errors (401)

Code Description Resolution
INVALID_CREDENTIALS Email or password is incorrect Verify login credentials
INVALID_TOKEN JWT token is missing, malformed, or expired Obtain a new token via login or refresh
ACCOUNT_LOCKED Account locked after failed login attempts Wait for lockout to expire or contact support

Validation Errors (400)

Code Description Resolution
VALIDATION_ERROR Request body contains invalid data Check required fields and data formats
INVALID_TENANT User is not assigned to an organization Contact administrator to assign tenant

Resource Errors (404)

Code Description
PRODUCT_NOT_FOUND Product with specified ID does not exist
PROJECT_NOT_FOUND Project with specified ID does not exist
ROOM_NOT_FOUND Room with specified ID does not exist
VENDOR_NOT_FOUND Vendor with specified ID does not exist

Server Errors (500)

Code Description Resolution
CREATE_FAILED Failed to create resource Retry request or contact support
UPDATE_FAILED Failed to update resource Retry request or contact support
DELETE_FAILED Failed to delete resource Retry request or contact support
INTERNAL_ERROR Unexpected server error Retry with exponential backoff

Best Practices

Error Handling

  • Always check the success field before processing response data
  • Use error codes (not messages) for programmatic error handling
  • Log error responses for debugging, including the timestamp
  • Display user-friendly messages based on error codes

Token Management

  • Store tokens securely (never in localStorage for sensitive apps)
  • Set a timer to refresh tokens 2-3 minutes before expiration
  • Handle INVALID_TOKEN by redirecting to login

Retry Logic

  • Implement exponential backoff for 500 errors
  • Do not retry 400/401/404 errors automatically
  • Set a maximum retry count (3-5 attempts)
Need Help?

If you encounter persistent errors, contact support with the error code, timestamp, and request details for faster resolution.