Skip to main content

API Errors

The CDP Payments API uses conventional HTTP response codes to indicate the success or failure of an API request. In general:
  • Codes in the 2xx range indicate success
  • Codes in the 4xx range indicate an error that failed given the information provided (e.g., a required parameter was omitted)
  • Codes in the 5xx range indicate an error on CDP’s backend servers.
    5xx errors are not a guarantee of failure; there’s always the chance that the operation may have succeeded in our back-end. Therefore, your application should treat the operation’s status as unknown.
Each error response includes:
  • errorType: A machine-readable error code
  • errorMessage: A human-readable message providing more detail
  • correlationId: A unique identifier for the request that can help with debugging
  • errorLink: A link to detailed documentation about the specific error type

HTTP 400

invalid_request

This error occurs when the request is malformed or contains invalid data, including issues with the request body, query parameters, path parameters, or headers. Steps to resolve:
  1. Check all required fields and parameters are present
  2. Ensure request body (if applicable) follows the correct schema
  3. Verify all parameter formats match the API specification:
    • Query parameters
    • Path parameters
    • Request headers
  4. Validate any addresses, IDs, or other formatted strings meet requirements
Common validation issues:
  • Missing required parameters
  • Invalid parameter types or formats
  • Malformed JSON in request body
  • Invalid enum values
Example 1:
{
  "errorType": "invalid_request",
  "errorMessage": "Invalid query parameters.",
  "correlationId": "41deb8d59a9dc9a7-IAD",
  "errorLink": "https://docs.cdp.coinbase.com/api-reference/v2/errors#invalid_request"
}
Example 2:
{
  "errorType": "invalid_request",
  "errorMessage": "Invalid account creation request.",
  "correlationId": "41deb8d59a9dc9a7-IAD",
  "errorLink": "https://docs.cdp.coinbase.com/api-reference/v2/errors#invalid_request"
}
Example 3:
{
  "errorType": "invalid_request",
  "errorMessage": "Invalid pagination parameters.",
  "correlationId": "41deb8d59a9dc9a7-IAD",
  "errorLink": "https://docs.cdp.coinbase.com/api-reference/v2/errors#invalid_request"
}

request_canceled

This error occurs when the client cancels an in-progress request before it completes. Steps to resolve:
  1. Check client-side timeout configurations
  2. Review request cancellation logic in your code
  3. Consider increasing timeout thresholds for long-running operations
  4. Implement request tracking to identify premature cancellations
Best practices:
async function withTimeout<T>(promise: Promise<T>, timeoutMs: number): Promise<T> {
  const timeout = new Promise((_, reject) => {
    setTimeout(() => {
      reject(new Error("Operation timed out"));
    }, timeoutMs);
  });

  try {
    return await Promise.race([promise, timeout]);
  } catch (error) {
    // Handle timeout or cancellation
    throw error;
  }
}
Example error response:
{
  "errorType": "request_canceled",
  "errorMessage": "Request Canceled.",
  "correlationId": "41deb8d59a9dc9a7-IAD",
  "errorLink": "https://docs.cdp.coinbase.com/api-reference/v2/errors#request_canceled"
}

timed_out

This error occurs when a request exceeds the maximum allowed processing time. Steps to resolve:
  1. Break down large requests into smaller chunks (if applicable)
  2. Implement retry logic with exponential backoff
  3. Use streaming endpoints for large data sets
Example retry implementation:
async function withRetryAndTimeout<T>(
  operation: () => Promise<T>,
  maxRetries = 3,
  timeout = 30000,
): Promise<T> {
  let attempts = 0;
  while (attempts < maxRetries) {
    try {
      return await Promise.race([
        operation(),
        new Promise((_, reject) =>
          setTimeout(() => reject(new Error("Timeout")), timeout)
        ),
      ]);
    } catch (error) {
      attempts++;
      if (attempts === maxRetries) throw error;
      // Exponential backoff
      await new Promise(resolve =>
        setTimeout(resolve, Math.pow(2, attempts) * 1000)
      );
    }
  }
  throw new Error("Max retries exceeded");
}
Example error response:
{
  "errorType": "timed_out",
  "errorMessage": "Timed Out.",
  "correlationId": "41deb8d59a9dc9a7-IAD",
  "errorLink": "https://docs.cdp.coinbase.com/api-reference/v2/errors#timed_out"
}

recipient_allowlist_violation

This error occurs when the user is not allowed to receive funds at this address, according to their coinbase account allowlist. Steps to resolve:
  1. Either disable the allowlist or add the wallet address at https://www.coinbase.com/settings/allowlist
  2. Wait approximately 2 days for updates to take effect.
Example error response:
{
  "errorType": "recipient_allowlist_violation",
  "errorMessage": "Recipient Allowlist Violation.",
  "correlationId": "41deb8d59a9dc9a7-IAD",
  "errorLink": "https://docs.cdp.coinbase.com/api-reference/v2/errors#recipient_allowlist_violation"
}

recipient_allowlist_pending

This error occurs when the user is not allowed to receive funds at this address, because changes to their coinbase account allowlist are pending. Steps to resolve:
  1. Wait approximately 2 days for updates to take effect.
Example error response:
{
  "errorType": "recipient_allowlist_pending",
  "errorMessage": "Recipient Allowlist Pending.",
  "correlationId": "41deb8d59a9dc9a7-IAD",
  "errorLink": "https://docs.cdp.coinbase.com/api-reference/v2/errors#recipient_allowlist_pending"
}

travel_rules_recipient_violation

This error occurs when the user is not allowed to receive funds at this address, because it violates travel rules. Steps to resolve:
  1. Ensure your desired transfer is not blocked by local travel regulations.
Example error response:
{
  "errorType": "travel_rules_recipient_violation",
  "errorMessage": "Travel Rules Recipient Violation.",
  "correlationId": "41deb8d59a9dc9a7-IAD",
  "errorLink": "https://docs.cdp.coinbase.com/api-reference/v2/errors#travel_rules_recipient_violation"
}

source_account_invalid

This error occurs when the source account specified in the transfer request is invalid or malformed. Steps to resolve:
  1. Verify the account ID format is correct (e.g., account_xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)
  2. Ensure the account ID belongs to your CDP entity
  3. Verify the account ID exists by calling GET /v2/accounts/{accountId} or GET /v2/accounts
Common causes:
  • Malformed account ID
  • Typo in the account ID
Example error response:
{
  "errorType": "source_account_invalid",
  "errorMessage": "Source Account Invalid.",
  "correlationId": "41deb8d59a9dc9a7-IAD",
  "errorLink": "https://docs.cdp.coinbase.com/api-reference/v2/errors#source_account_invalid"
}

target_account_invalid

This error occurs when the target account specified in the transfer request is invalid or malformed. Steps to resolve:
  1. Verify the account ID format is correct (e.g., account_xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)
  2. Ensure the account exists and can receive funds
  3. Verify the account ID exists by calling GET /v2/accounts/{accountId} or GET /v2/accounts
Common causes:
  • Malformed account ID
  • Typo in the account ID
Example error response:
{
  "errorType": "target_account_invalid",
  "errorMessage": "Target Account Invalid.",
  "correlationId": "41deb8d59a9dc9a7-IAD",
  "errorLink": "https://docs.cdp.coinbase.com/api-reference/v2/errors#target_account_invalid"
}

source_account_not_found

This error occurs when the source account specified in the transfer does not exist. Steps to resolve:
  1. Verify the account ID exists by calling GET /v2/accounts/{accountId} or GET /v2/accounts
Example error response:
{
  "errorType": "source_account_not_found",
  "errorMessage": "Source Account Not Found.",
  "correlationId": "41deb8d59a9dc9a7-IAD",
  "errorLink": "https://docs.cdp.coinbase.com/api-reference/v2/errors#source_account_not_found"
}

target_account_not_found

This error occurs when the target account specified in the transfer does not exist. Steps to resolve:
  1. Verify the account ID exists by calling GET /v2/accounts/{accountId} or GET /v2/accounts
Example error response:
{
  "errorType": "target_account_not_found",
  "errorMessage": "Target Account Not Found.",
  "correlationId": "41deb8d59a9dc9a7-IAD",
  "errorLink": "https://docs.cdp.coinbase.com/api-reference/v2/errors#target_account_not_found"
}

source_asset_not_supported

This error occurs when the asset specified in the transfer source is not supported for this transfer type. Steps to resolve:
  1. Check the list of supported assets for the source account type
  2. Verify the asset symbol is correctly specified (e.g., usdc, usdt)
Common causes:
  • Unsupported asset for the transfer route
  • Incorrect asset symbol
Example error response:
{
  "errorType": "source_asset_not_supported",
  "errorMessage": "Source Asset Not Supported.",
  "correlationId": "41deb8d59a9dc9a7-IAD",
  "errorLink": "https://docs.cdp.coinbase.com/api-reference/v2/errors#source_asset_not_supported"
}

target_asset_not_supported

This error occurs when the asset specified in the transfer target is not supported for this transfer type. Steps to resolve:
  1. Check the list of supported assets for the target
  2. Verify the asset symbol is correctly specified (e.g., usdc, usdt)
  3. Ensure the target can receive this asset type
Common causes:
  • Asset not supported by the target
  • Unsupported conversion between source and target assets
Example error response:
{
  "errorType": "target_asset_not_supported",
  "errorMessage": "Target Asset Not Supported.",
  "correlationId": "41deb8d59a9dc9a7-IAD",
  "errorLink": "https://docs.cdp.coinbase.com/api-reference/v2/errors#target_asset_not_supported"
}

target_email_invalid

This error occurs when the email address specified as the transfer target is invalid. Steps to resolve:
  1. Verify the email address format is valid (e.g., user@example.com)
  2. Check for typos in the email address
  3. Ensure the email domain is valid
Common causes:
  • Invalid email format
  • Missing @ symbol or domain
  • Typo in the email address
Example error response:
{
  "errorType": "target_email_invalid",
  "errorMessage": "Target Email Invalid.",
  "correlationId": "41deb8d59a9dc9a7-IAD",
  "errorLink": "https://docs.cdp.coinbase.com/api-reference/v2/errors#target_email_invalid"
}

target_onchain_address_invalid

This error occurs when the onchain address specified as the transfer target is invalid for the specified network. Steps to resolve:
  1. Ensure the network is supported for the transfer type
  2. Verify the address format matches the target network
  3. Ensure you haven’t mixed up addresses from different networks
Common causes:
  • Network not supported for the transfer type
  • Address format doesn’t match network
  • Address from a different blockchain network
Example error response:
{
  "errorType": "target_onchain_address_invalid",
  "errorMessage": "Target Onchain Address Invalid.",
  "correlationId": "41deb8d59a9dc9a7-IAD",
  "errorLink": "https://docs.cdp.coinbase.com/api-reference/v2/errors#target_onchain_address_invalid"
}

transfer_amount_invalid

This error occurs when the transfer amount is invalid. Steps to resolve:
  1. Ensure the amount is a positive number and greater than $1 USD equivalent amount
  2. Verify the amount format is a valid decimal string (e.g., "100.50")
  3. Check the number of decimal places for the asset
Common causes:
  • Zero or negative amount
  • Too many decimal places for the asset
  • Amount below minimum threshold ($1 USD equivalent amount)
Example error response:
{
  "errorType": "transfer_amount_invalid",
  "errorMessage": "Transfer Amount Invalid.",
  "correlationId": "41deb8d59a9dc9a7-IAD",
  "errorLink": "https://docs.cdp.coinbase.com/api-reference/v2/errors#transfer_amount_invalid"
}

transfer_asset_not_supported

This error occurs when the asset specified for the transfer is not supported. Steps to resolve:
  1. Check the list of supported assets for transfers
  2. Verify the asset symbol is correctly specified
  3. Ensure the asset is supported for the transfer route (source → target)
Common causes:
  • Asset not supported for transfers
  • Incorrect asset symbol
Example error response:
{
  "errorType": "transfer_asset_not_supported",
  "errorMessage": "Transfer Asset Not Supported.",
  "correlationId": "41deb8d59a9dc9a7-IAD",
  "errorLink": "https://docs.cdp.coinbase.com/api-reference/v2/errors#transfer_asset_not_supported"
}

insufficient_balance

This error occurs when the source account does not have enough funds to complete the transfer including fees. Steps to resolve:
  1. Check the source account balance
  2. Ensure the balance covers both the transfer amount and any fees
  3. Consider using amountType: "source" to transfer the maximum available amount minus fees
  4. Add funds to the source account if needed
Common causes:
  • Transfer amount exceeds available balance
  • Not accounting for transfer fees
  • Pending transactions reducing available balance
Example error response:
{
  "errorType": "insufficient_balance",
  "errorMessage": "Insufficient Balance.",
  "correlationId": "41deb8d59a9dc9a7-IAD",
  "errorLink": "https://docs.cdp.coinbase.com/api-reference/v2/errors#insufficient_balance"
}

metadata_too_many_entries

This error occurs when the transfer metadata contains more entries than allowed. Steps to resolve:
  1. Reduce the number of metadata entries (maximum 10 allowed)
  2. Consolidate related data into fewer keys
  3. Store additional data externally and reference it with a single metadata entry
Limits:
  • Maximum entries: 10
Example error response:
{
  "errorType": "metadata_too_many_entries",
  "errorMessage": "Metadata Too Many Entries.",
  "correlationId": "41deb8d59a9dc9a7-IAD",
  "errorLink": "https://docs.cdp.coinbase.com/api-reference/v2/errors#metadata_too_many_entries"
}

metadata_key_too_long

This error occurs when a metadata key exceeds the maximum allowed length. Steps to resolve:
  1. Shorten the metadata key to 40 characters or less
  2. Use abbreviations or shorter naming conventions
  3. Consider using a key-value structure where the value contains the longer identifier
Limits:
  • Maximum key length: 40 characters
Example error response:
{
  "errorType": "metadata_key_too_long",
  "errorMessage": "Metadata Key Too Long.",
  "correlationId": "41deb8d59a9dc9a7-IAD",
  "errorLink": "https://docs.cdp.coinbase.com/api-reference/v2/errors#metadata_key_too_long"
}

metadata_value_too_long

This error occurs when a metadata value exceeds the maximum allowed length. Steps to resolve:
  1. Shorten the metadata value to 500 characters or less
  2. Store longer data externally and reference it with a shorter identifier
  3. Consider compressing or encoding the data if appropriate
Limits:
  • Maximum value length: 500 characters
Example error response:
{
  "errorType": "metadata_value_too_long",
  "errorMessage": "Metadata Value Too Long.",
  "correlationId": "41deb8d59a9dc9a7-IAD",
  "errorLink": "https://docs.cdp.coinbase.com/api-reference/v2/errors#metadata_value_too_long"
}

travel_rules_field_missing

This error occurs when required travel rule fields are missing from the transfer request. Steps to resolve:
  1. Include the travelRule object in your transfer request
  2. Supply the required missing fields prompted by the error message
  3. Review the travel rule requirements for your jurisdiction
Note: Required fields may vary by region. Example error response:
{
  "errorType": "travel_rules_field_missing",
  "errorMessage": "Travel Rules Field Missing.",
  "correlationId": "41deb8d59a9dc9a7-IAD",
  "errorLink": "https://docs.cdp.coinbase.com/api-reference/v2/errors#travel_rules_field_missing"
}

asset_mismatch

This error occurs when the assets specified in the transfer are incompatible or don’t match expected values. Steps to resolve:
  1. Ensure the asset field matches either the source or target asset
  2. Verify that the source and target assets are compatible for conversion (if different)
  3. Check that the asset symbols are correctly specified
Common causes:
  • Transfer asset doesn’t match source or target
  • Attempting an unsupported asset conversion
  • Typo in asset symbols
Example error response:
{
  "errorType": "asset_mismatch",
  "errorMessage": "Asset Mismatch.",
  "correlationId": "41deb8d59a9dc9a7-IAD",
  "errorLink": "https://docs.cdp.coinbase.com/api-reference/v2/errors#asset_mismatch"
}

HTTP 401

unauthorized

This error occurs when authentication fails. Steps to resolve:
  1. Verify your CDP API credentials:
    • Check that your API key is valid
    • Check that your Wallet Secret is properly configured
  2. Validate JWT token:
    • Not expired
    • Properly signed
    • Contains required claims
  3. Check request headers:
    • Authorization header present
    • X-Wallet-Auth header included when required
Security note: Never share your Wallet Secret or API keys. Example 1:
{
  "errorType": "unauthorized",
  "errorMessage": "Session authentication required.",
  "correlationId": "41deb8d59a9dc9a7-IAD",
  "errorLink": "https://docs.cdp.coinbase.com/api-reference/v2/errors#unauthorized"
}
Example 2:
{
  "errorType": "unauthorized",
  "errorMessage": "Authentication required.",
  "correlationId": "41deb8d59a9dc9a7-IAD",
  "errorLink": "https://docs.cdp.coinbase.com/api-reference/v2/errors#unauthorized"
}
Example 3:
{
  "errorType": "unauthorized",
  "errorMessage": "Authentication error.",
  "correlationId": "41deb8d59a9dc9a7-IAD",
  "errorLink": "https://docs.cdp.coinbase.com/api-reference/v2/errors#unauthorized"
}

HTTP 403

forbidden

This error occurs when you don’t have permission to access the resource. Steps to resolve:
  1. Verify your permissions to access the resource
  2. Ensure that you are the owner of the requested resource
Example error response:
{
  "errorType": "forbidden",
  "errorMessage": "You do not have permission to link this account.",
  "correlationId": "41deb8d59a9dc9a7-IAD",
  "errorLink": "https://docs.cdp.coinbase.com/api-reference/v2/errors#forbidden"
}

HTTP 404

not_found

This error occurs when the resource specified in your request doesn’t exist or you don’t have access to it. Steps to resolve:
  1. Verify the resource ID/address/account exists
  2. Check your permissions to access the resource
  3. Ensure you’re using the correct network/environment
  4. Confirm the resource hasn’t been deleted
Common causes:
  • Mistyped addresses
  • Accessing resources from the wrong CDP project
  • Resource was deleted or hasn’t been created yet
Example 1:
{
  "errorType": "not_found",
  "errorMessage": "Account not found.",
  "correlationId": "41deb8d59a9dc9a7-IAD",
  "errorLink": "https://docs.cdp.coinbase.com/api-reference/v2/errors#not_found"
}
Example 2:
{
  "errorType": "not_found",
  "errorMessage": "Account or asset not found.",
  "correlationId": "41deb8d59a9dc9a7-IAD",
  "errorLink": "https://docs.cdp.coinbase.com/api-reference/v2/errors#not_found"
}
Example 3:
{
  "errorType": "not_found",
  "errorMessage": "Deposit address not found.",
  "correlationId": "41deb8d59a9dc9a7-IAD",
  "errorLink": "https://docs.cdp.coinbase.com/api-reference/v2/errors#not_found"
}

HTTP 409

already_exists

This error occurs when trying to create a resource that already exists. Steps to resolve:
  1. Check if the resource exists before creation
  2. Use GET endpoints to verify resource state
  3. Use unique identifiers/names for resources
Example error response:
{
  "errorType": "already_exists",
  "errorMessage": "Already Exists.",
  "correlationId": "41deb8d59a9dc9a7-IAD",
  "errorLink": "https://docs.cdp.coinbase.com/api-reference/v2/errors#already_exists"
}

HTTP 422

idempotency_error

This error occurs when an idempotency key is reused with different parameters. Steps to resolve:
  1. Generate a new UUID v4 for each unique request
  2. Only reuse idempotency keys for exact request duplicates
  3. Track used keys within your application
Example idempotency key implementation:
import { v4 as uuidv4 } from 'uuid';

function createIdempotencyKey() {
  return uuidv4();
}
Example error response:
{
  "errorType": "idempotency_error",
  "errorMessage": "Idempotency key '8e03978e-40d5-43e8-bc93-6894a57f9324' was already used with a different request payload. Please try again with a new idempotency key.",
  "correlationId": "41deb8d59a9dc9a7-IAD",
  "errorLink": "https://docs.cdp.coinbase.com/api-reference/v2/errors#idempotency_error"
}

HTTP 429

rate_limit_exceeded

This error occurs when you’ve exceeded the API rate limits. Steps to resolve:
  1. Implement exponential backoff
  2. Cache responses where possible
  3. Wait for rate limit window to reset
Best practices:
async function withRetry(fn: () => Promise<any>) {
  let delay = 1000;
  while (true) {
    try {
      return await fn();
    } catch (e) {
      if (e.errorType === "rate_limit_exceeded") {
        await sleep(delay);
        delay *= 2;
        continue;
      }
      throw e;
    }
  }
}
Example 1:
{
  "errorType": "rate_limit_exceeded",
  "errorMessage": "Rate limit exceeded.",
  "correlationId": "41deb8d59a9dc9a7-IAD",
  "errorLink": "https://docs.cdp.coinbase.com/api-reference/v2/errors#rate_limit_exceeded"
}
Example 2:
{
  "errorType": "rate_limit_exceeded",
  "errorMessage": "Too many requests. Please try again later.",
  "correlationId": "41deb8d59a9dc9a7-IAD",
  "errorLink": "https://docs.cdp.coinbase.com/api-reference/v2/errors#rate_limit_exceeded"
}

HTTP 500

internal_server_error

This indicates an unexpected error that occurred on the CDP servers. Important: If you encounter this error, please note that your operation’s status should be treated as unknown by your application, as it could have been a success within the CDP back-end. Steps to resolve:
  1. Retry your request after a short delay
  2. If persistent, contact CDP support with:
    • Your correlation ID
    • Timestamp of the error
    • Request details
  3. Consider implementing retry logic with an exponential backoff
Note: These errors are automatically logged and monitored by CDP. Example 1:
{
  "errorType": "internal_server_error",
  "errorMessage": "An internal server error occurred.",
  "correlationId": "41deb8d59a9dc9a7-IAD",
  "errorLink": "https://docs.cdp.coinbase.com/api-reference/v2/errors#internal_server_error"
}
Example 2:
{
  "errorType": "internal_server_error",
  "errorMessage": "An internal server error occurred. Please try again later.",
  "correlationId": "41deb8d59a9dc9a7-IAD",
  "errorLink": "https://docs.cdp.coinbase.com/api-reference/v2/errors#internal_server_error"
}

HTTP 502

bad_gateway

This error occurs when the CDP API is unable to connect to the backend service. Steps to resolve:
  1. Retry your request after a short delay
  2. If persistent, contact CDP support with:
    • The timestamp of the error
    • Request details
  3. Consider implementing retry logic with an exponential backoff
Note: These errors are automatically logged and monitored by CDP. Example error response:
{
  "errorType": "bad_gateway",
  "errorMessage": "Bad gateway. Please try again later.",
  "correlationId": "41deb8d59a9dc9a7-IAD",
  "errorLink": "https://docs.cdp.coinbase.com/api-reference/v2/errors#bad_gateway"
}

HTTP 503

service_unavailable

This error occurs when the CDP API is temporarily unable to handle requests due to maintenance or high load. Steps to resolve:
  1. Retry your request after a short delay
  2. If persistent, contact CDP support with:
    • The timestamp of the error
    • Request details
  3. Consider implementing retry logic with an exponential backoff
Note: These errors are automatically logged and monitored by CDP. Example error response:
{
  "errorType": "service_unavailable",
  "errorMessage": "Service unavailable. Please try again later.",
  "correlationId": "41deb8d59a9dc9a7-IAD",
  "errorLink": "https://docs.cdp.coinbase.com/api-reference/v2/errors#service_unavailable"
}

Network Errors

Network errors occur when there is a problem establishing or maintaining a connection to the CDP API at the network layer. These errors are distinct from API service errors - they indicate that your request never reached the CDP API or was blocked before it could be processed.

Understanding Network Errors

When you encounter a network error via the CDP SDK, you’ll receive a NetworkError object with:
  • statusCode: Always 0 (indicating no HTTP response was received)
  • errorType: Specific type of network error
  • errorMessage: Human-readable description
  • networkDetails: Additional information including:
    • code: Technical error code
    • message: Original error message
    • retryable: Whether the operation should be retried

Types of Network Errors

1. IP Blocked (network_ip_blocked)

Your IP address has been blocked at the gateway level. Common causes:
  • Geographic restrictions.
  • Rate limiting at infrastructure level.
  • Security policies or DDoS protection.
  • Corporate firewall/proxy restrictions.
What to do:
  • Verify you’re not accessing from a restricted region.
  • Check if you’re behind a VPN or proxy that might be blocked.
  • Contact CDP support on Discord if you believe this is in error.
  • This error is not retryable.

2. Connection Failed (network_connection_failed)

Unable to establish a connection to the CDP API. Common causes:
  • CDP API is temporarily unavailable. Check the CDP Status Page for any ongoing issues.
  • Network connectivity issues.
  • Firewall blocking outbound HTTPS connections.
  • Incorrect API endpoint configuration.
What to do:
  • Check your internet connection.
  • Verify firewall settings allow HTTPS traffic to api.cdp.coinbase.com.
  • Ensure you’re using the correct API endpoint.
  • This error is retryable. Retry the request with exponential backoff.

3. Timeout (network_timeout)

The request took too long and was terminated. Common causes:
  • Network congestion.
  • Slow internet connection.
What to do:
  • Increase timeout settings if consistently timing out.
  • This error is retryable. Retry the request with exponential backoff.

4. DNS Failure (network_dns_failure)

Unable to resolve the CDP API domain name. Common causes:
  • DNS configuration issues.
  • Network connectivity problems.
  • DNS server unavailable.
  • Incorrect API endpoint URL.
What to do:
  • Check your DNS settings.
  • Verify network connectivity with nslookup api.cdp.coinbase.com.
  • Try using a different DNS server (e.g., 8.8.8.8).
  • Ensure the API URL is correct.
  • This error is not retryable until DNS is fixed.

Handling Network Errors in Code

import { NetworkError } from '@coinbase/cdp-sdk';

try {
  const account = await cdp.evm.getAccount({ address: '0x...' });
} catch (error) {
  if (error instanceof NetworkError) {
    console.error(`Network error: ` + error.errorMessage);
    console.error(`Type: ` + error.errorType);
    console.error(`Details:` + error.networkDetails);
    
    // Check if the error is retryable
    if (error.networkDetails?.retryable) {
      // Implement retry logic with exponential backoff
      await retryWithBackoff(async () => {
        return await cdp.evm.getAccount({ address: '0x...' });
      });
    } else {
      // Handle non-retryable errors
      if (error.errorType === "network_ip_blocked") {
        console.error('Your IP appears to be blocked. Please check your network configuration.');
      }
    }
  }
}

Best Practices

  1. Implement Retry Logic: For retryable errors, use exponential backoff:
async function retryWithBackoff<T>(
  fn: () => Promise<T>,
  maxRetries = 3,
  baseDelay = 1000
): Promise<T> {
  for (let i = 0; i < maxRetries; i++) {
    try {
      return await fn();
    } catch (error) {
      if (error instanceof NetworkError && error.networkDetails?.retryable && i < maxRetries - 1) {
        await new Promise(resolve => setTimeout(resolve, baseDelay * Math.pow(2, i)));
        continue;
      }
      throw error;
    }
  }
  throw new Error('Max retries exceeded');
}
  1. Log Network Errors: Always log network errors with full details for debugging.
  2. Monitor Patterns: Track network errors to identify patterns (time of day, specific operations, etc.).
  3. Have Fallback Strategies: Consider implementing fallback mechanisms for critical operations.

Troubleshooting Checklist

  • Verify internet connectivity.
  • Check if you’re behind a proxy or VPN.
  • Ensure firewall allows HTTPS traffic to api.cdp.coinbase.com.
  • Verify you’re not in a restricted geographic region.
  • Check DNS resolution: nslookup api.cdp.coinbase.com.
  • Test with curl or similar: curl -I https://api.cdp.coinbase.com/platform.
  • Check if the issue is consistent or intermittent.

Getting Help

If you continue to experience network errors after following this guide:
  1. Collect error details including:
    • Full error message and type.
    • Network details from the error.
    • Time and frequency of occurrence.
    • Your network configuration (proxy, VPN, region).
  2. Contact CDP support on Discord with this information.
  3. Check the CDP Status Page for any ongoing issues.
Remember: Network errors are typically environmental issues rather than code problems. Focus on network configuration and connectivity when troubleshooting.