URL rewrite with external JSON query

You can try URL rewriting like that

add_action("wp_loaded", function () {


    add_rewrite_tag("%id%", "([^&]+)");

    add_rewrite_rule(
        '^details/[^&]+/([0-9]+)/?',
        'index.php?id=$matches[1]&pagename=details',
        'top'
    );


});

And then flush rewrite rules cache one time in Settings -> Permalinks.

With this rewriting, the identifier is no more in $_GET but you can get it with https://codex.wordpress.org/Function_Reference/get_query_var.