How do I show error in alert from the API when it fails?

On Appsmith, can I show an error in the alert from the API when it fails?

You can do that with:

{{ Api1.run(
    () => {}, 
    (errorResponse) => showAlert(errorResponse.message, "error")
) }}

This will work assuming that error response has a object having a message property.