API aproach is only GET dashboard (not “export” dashboard) = it will provide model, which is used by app itself (so you can see internal ids/uids there) - “internal” model = this model can be used only in that particular Grafana instance.
UI is a real dashboard export, which will transform internal model (e.g. replace internal ids/uids, remove sensitive details) so this output can be imported into another Grafana instance without any issue.
It will be nice to have API for dashboard export, but that API still doesn’t exist. Export feature is still implemented only in the UI - frontend.
BTW: @amotl made a feature for programatic dashboard export.