I build an app and I am would like to proactively inform the user they could not create shared link on a file/folder without them clicking the button and handling the error.
My question is, what API should I check to achieve that?
The errors returned by sharing/create_shared_link_with_settings give you a good sense of the primary cases to check for.
There are potentially rarer exceptions that may cause creating a link to fail that are less introspect-able; you will still want to error handle any 409's from the call.