Filter bills with sponsor name (or id?) in v2?


I’m now moving my voter engagement app from v1 to v2. In v1 I was able to get bills where a given legislator was either the primary or cosponsor. That basic functionality seems to be lost in v2. With v2, I will have to run multiple batch queries to get through the hundreds of possible bills, and then sort those client-side. Which will work, but it’s insanely inefficient.

Or am I missing something. I tried…

     bills(first:100, sponsor:"Hornstein" jurisdiction:"ocd-jurisdiction/country:us/state:mn/government", chamber:"lower")

and that gave me the error: “Argument “sponsor” has invalid value “Hornstein”.\nExpected “SponsorInput”, found not an object.”

Is there something I can do here with “SponsorInput” so I can only get bills that involve a member (or even better personID)? Or if there’s no way to do this now, is this functionality in the works?

Thanks for the help :slight_smile:


Hornstein doesn’t seem to have any sponsorships, but this worked for Poston:

  bills(first:100, sponsor:{name:"Poston"}, jurisdiction:"ocd-jurisdiction/country:us/state:mn/government", chamber:"lower")
    edges {
      node {
        sponsorships {
          person {

As you can see, the sponsor parameter is expecting an object of type SponsorInput. This threw me for a minute, too - I didn’t know you could pass an object as a parameter!

When you run this, note that the “person” is null for all sponsorships, which means that they aren’t “resolved” - the raw name provided by the state isn’t matched up with known legislators. I don’t know the status of support for this; it may be state- or chamber-specific.


Oh, beauty!!! Yeah, that worked like a charm. I did a mix of the name and primary = true and boom! It filters as expected.

bills(first: 80, sponsor:{name:"Hornstein", primary:true}, jurisdiction:"Minnesota") {}

Thanks a million!! And nice work with the posts on Medium. I read a few of those last night. I’ll do the same for people trying to access this database from native apis from iOS in Objective C. Still not much out there on this in terms of external documentation. But the data here is amazing. As is the ecosystem and the support given. Love it!


This topic was automatically closed 70 days after the last reply. New replies are no longer allowed.