The CardClan Integration API uses standard HTTP status codes and provides detailed error messages to help you troubleshoot issues quickly. This guide covers common errors, their causes, and how to handle them effectively in your applications.
The API uses standard HTTP status codes to indicate the success or failure of requests:
2xx Success Codes
200 OK - Request successful, data returned - 201 Created - Resource created successfully (e.g., card sent, configuration created)
4xx Client Error Codes
400 Bad Request - Invalid request parameters or missing required fields - 401 Unauthorized - Invalid or missing authentication credentials -
404 Not Found - Requested resource doesn’t exist or user doesn’t have access - 409 Conflict - Resource conflict (e.g., integration
configuration already exists)
5xx Server Error Codes
500 Internal Server Error - Unexpected server error - 502 Bad Gateway - Temporary server issue - 503 Service Unavailable - Service
temporarily unavailable
404 - Card not found or you do not have access to this card
Cause: Card ID doesn’t exist or user doesn’t have permission to access itSolution: Verify the card exists and belongs to your workspace
// First, get available cards for your workspaceconst cardsResponse = await fetch(`/api/integration/cards?workspace=${workspaceId}`, { method: 'POST', headers: { 'Authorization': `Bearer ${apiKey}` }});const cards = await cardsResponse.json();const availableCardIds = cards[0].choices.map(card => card.id);if (!availableCardIds.includes(cardId)) { throw new Error(`Card ${cardId} not found in workspace`);}
409 - Integration configuration already exists
Cause: Trying to create an integration configuration for a card that already has oneSolution: Get the existing configuration instead
try { // Try to create new configuration const config = await createIntegrationConfig(cardId, workspaceId, userId); return config.data._id;} catch (error) { if (error.status === 409) { // Configuration exists, get it instead const existingConfig = await getIntegrationConfigByCardId(cardId); return existingConfig._id; } throw error;}
409 - Integration configuration doesn't exist
Cause: Trying to use an integration ID that doesn’t existSolution: Create the integration configuration first
async function ensureIntegrationConfig(cardId, workspaceId, userId) { try { // Try to get existing configuration return await getIntegrationConfigByCardId(cardId); } catch (error) { if (error.status === 409) { // Doesn't exist, create it const config = await createIntegrationConfig(cardId, workspaceId, userId); return config.data; } throw error; }}