How do I filter the case law APIs by court?
Filtering the case law APIs can be complicated. The main thing to know is that you can create filters that span objects in a similar way to how you can join tables together in relational databases via SQL.
In this instance, the trick is to understand the case law model, which has Opinion objects that are grouped into Cluster objects, which are joined to Docket objects, which, finally, join to Court objects.
Therefore, to filter Opinion objects by a particular court, you must span each of these objects with a filter like this:
cluster__docket__court=scotus
For example:
https://www.courtlistener.com/api/rest/v4/opinions/?cluster__docket__court=scotus
That query hits the Opinion API, filtered to the Supreme Court by spanning the cluster, docket, and court joins.
You can learn more about this in the API filtering documentation: