Which API do you plan to use ?
With the rest API, you can not filter inside a line_items. You need to pull data first and iterate with specific filters you want to apply inside your script.
But with GraphQl it seems to be ok.
Here is a forum's post where you can find information about the syntax to query in GraphQl and apply filters.
Hope it will help !
In Shopify API, pagination is not based on passing an argument page=x.
By default, you 'll have orders sorted by created_at fields.
If you want to have a pagination, you can use those fields Shopify documentation ->
Tips : inside of you request, always add status=any -> /admin/api/2021-07/orders.json?status=any&limit=25
Or you 'll have discrepancies.
Hope it helps !