How to solve long process rest API?

Let say we have a very long process API(it took more than 10s).

One solution was to make the process in background and return right away, and we also need to create anther API to get_status whether the process completed or still in progress.

I'm looking for a better solution.

I don't know if this will be better, and I'm just thinking out loud here, but:

If you use an AJAX request from the client (browser) to your application, it can launch the task and then, again client-side, you can resolve the promise when that task completes. If you don't want the user to move to a different page during that time, you could run a spinner while it completes.