Orders that fail due to low balance don't return an error status code

When placing orders with insufficient balance, I’m getting back a 200 OK status code but with an error object in the response body that looks something like this

  success: false,
  failure_reason: 'UNKNOWN_FAILURE_REASON',
  order_id: '',
  error_response: {
    message: 'Insufficient balance in source account',
    error_details: '',
    preview_failure_reason: 'PREVIEW_INSUFFICIENT_FUND',

This seems like a textbook case for returning error status code like a 400 bad request so that it can be caught and handled appropriately.

I’ll assume I don’t need to explain why returning error responses with 200 OK status codes is bad API design.

Hi there @Chauvinm818 , welcome to the Forum!

Thank you for taking time to letting us know that the create order API doesn’t return proper error codes when placing orders with insufficient balance.

We’ve referred this feedback along with the details with our internal teams so we can continue improving our user experience. Most new features and improvements to our products come directly from feedback like yours, so it’s very valuable to us. While we can’t offer any specific timeline for adding features, we are constantly working to build products our customers will love.
If you want to stay up to date on the latest from Coinbase Cloud, you can also bookmark the following webpage and subscribe to email updates at the bottom of the page: https://www.coinbase.com/cloud/discover
We hope this is helpful, and please let us know if you have any other questions.

Have a great day ahead!

1 Like