Hacker News new | past | comments | ask | show | jobs | submit login
Congress.gov API (congress.gov)
766 points by ElevenLathe on Sept 8, 2022 | hide | past | favorite | 205 comments



I have to say, this is cool and surreal in some way.

It's just surreal to think of international treaties as being objects with a "last updated time."

Given the massive human apparatus constantly parsing this information from Capitol Hill, I'm not sure what the use-case is for an app, but nonetheless, it's cool.

Now... if we could get this for every state and county legislature, that would enable some interesting use cases to track parallel legislative initiatives (usually advocated by corporations / non-profits).


GREAT, BUT! We need an API on who wrote which parts of the bill. Find lobbyists who wrote parts. Find when there is an evil part (where lobbyists get congress to sell out), and we need to find out WHICH congress person put it in there.

We need to track the evil parts of bills to the congress person who is the sell out for lobbyists (and the corporations beind them)


It's a common misconception that increasing transparency reduces the power of lobbyists, when it actually does the opposite. [0] In short, the average voter doesn't care enough to find out who added a specific line to a bill, but lobbyists care a lot and they use the additional access to monitor and influence legislators. Legislator accountability is increased with more transparency, but they become more accountable to lobbyists than to their constituents.

There needs to be a balance. A democracy that operates completely in the dark isn't much of a democracy, but Congress currently has the problem off too much rather than too little transparency.

[0] https://congressionalresearch.org/TransparencyProblem.html


That's not my reading.

It sounds to me like transparency does always increase accountability full stop. It just turns out that accountability to lobbyists is a greater driver of legislator behavior than accountability to voters.

The problem is therefore neither accountability nor transparency, but the disproportionate influence of lobbyists.


At the root of that problem is this:

1. If you organize a team behind a goal and persist in focusing on it, you are more likely to succeed than someone who does not allocate their attention thusly.

2. If you do the above, you need a way to pay for rent and groceries.


You might also find this academic paper interesting: https://philpapers.org/go.pl?id=NGUTIS&aid=NGUTISv1

The title is a bit click-bait-y, but the argument is sound, I think. Forcing transparency changes how people do their work, especially what indicators of success they choose to focus on (which may be easy to relate, but bad indicators of success - like GPA).

Transparency does not automatically grant accountability.

I don't think we have a good handle on this problem, and we make the situation worse by assuming that transparency will solve the problems of corruption and government accountability.


> lobbyists care a lot and they use the additional access to monitor and influence legislators

This is ad tracking for lobbyists. If a lobbyist could prove they got a line into legislation, they’re worth an order of magnitude more than they are today, when one is left guessing if they did anything at all.


Just because the reckoning from citizens hasn't come yet, doesn't mean it isn't coming at all. The transparency is needed for citizens to find the bad actors in congress.


You're not addressing the problem proposed in the parent's argument - that lobbyists will be the ones who will use this, to ensure that the politicians they bought and paid for are doing what they want.

It seems like a pretty persuasive argument to me.


Not all lobbyists are out to do evil, and not all politicians who do their job are doing evil. The alternative to listening to lobbyists and legislating is politicians who don't do legislation at all and instead spend their time fund-raising and running culture wars. That's not the better-world alternative I'm here for.


> You're not addressing the problem proposed in the parent's argument - that lobbyists will be the ones who will use this, to ensure that the politicians they bought and paid for are doing what they want.

That's not a problem, despite the characterization. That's a helpful side-effect. Now you have more definitive traceability.


> that lobbyists will be the ones who will use this, to ensure that the politicians they bought and paid for are doing what they want.

I don't know that lobbyist depends on an API for that!


I think GP is talking about creating an incentive system that doesn't encourage or require a reckoning. There are plenty of systems which were designed by people in good faith who were unable to understand that the incentives they thought they were creating were not in fact that actual incentives. Creating line by line attribution sounds like one such case.


It is not coming because citizens do not have time.


Would also wager a lot of us don't care. Government can do incredibly fucked up things, but as long as quality of life of is high and the money train keeps flowing, I'm not going to do anything.

You'd really have to fuck some stuff up real bad for me to wake up and give a shit.


Transparency is a logical necessity for accountability. If we don't know who wrote a law, then we can't hold somebody accountable for it. Even if we take for granted the truthfulness of the "transparency problem", the solution doesn't lie in finding the right "balance" of secrecy and transparency.

Law is backed by threat of violence; what separates legitimate Law from the law of the jungle is its _justification_. Everyone who the Law applies to (that is to say, everyone) has a legitimate interest in knowing the justification, so that they can determine whether such Law is justified or whether their government has morphed into a violent gang. Ergo transparency is fundamental to legitimate law and governance.


The existence of lobbying isn’t a foregone conclusion. We can have transparency without the problem you’ve adeptly described if we eliminate or at least significantly diminish lobbying.


Lobbying is explicitly protected by the 1st amendment to the constitution.

The validity of a contract where a company, person, or community action group pays someone to lobby on their behalf is not.


That reveals another problem: treating the Constitution (and its many edits) as a foregone conclusion.

Enshrining corruption in what’s practically holy law. What a coup.


How are you defining corruption here?


Good thing that only requires eliminating the influence of money on politics.


I am skeptical, this sounds like 'trickle-down economics' where the theory is internally cohesive but the conclusions don't actually line up with reality.

Seems like the page you linked is an anti-trasparency advocacy org, what makes you trust them? Is there any data to back up this assertion?


If we went with its original name of 'chicken-shit economics' I doubt there would have been as much confusion about theory vs reality.


I'd love to see a git history for our current US legislation


You're in luck, someone recreated the constitution in git with the history of edits

https://github.com/jessekphillips/usa-constitution

Edit: just noticed the dates aren't accurate, but still interesting and the authors are accurate


Can git do pre-1970 dates?


The file/wire format can, but the official implementation doesn't handle it well. There is some work in progress to make it work, for this kind of historical work.


There is a project doing exactly this for German law.[1] I also once cobbled together a rather primitive Python script which commits Swiss federal law as MD-file into a repo through GitHub actions.[2]

[1] https://github.com/bundestag/gesetze

[2] https://github.com/quadratecode/ch-law-tracker


Yes. We need git-blame here.


For pieces that were added as amendments, it is at least possible to determine who proposed the amendment. Instances where the as-written initial bill is written on K Street will probably always be impossible unless Congress pass absurdly strict sunlight laws with teeth (i.e. make it illegal for congresspeople to have substantive meetings without livestreaming them) that inconvenience themselves.


yah, for that, we'd need complete social graphs for public servants, which would quickly run afoul the congressional staffs' civil liberties, because they'd try to hide as much as possible behind other people. you'd need that to appropriately apportion attributions back to the public servant.

i'd be ok pushing for a legal carve-out for this social graph however, as i'd posit that greater governmental transparency overrides the potential encroachments of the ~tens/hundreds of thousands of partisans and lobbyists (<0.1% of population; though slippery slope could be invoked here). you'd start with staffers and move out to anyone paid directly by the office and their affiliated political organizations, then move to large donors and their PACs. obviously the current supreme court would try to block this as an antecedent to the citizen's united case.


Oh yeah it would definitely be in the interests of the ruled class. Unfortunately, since it is bad for the ruling class, we won't get it.


Not exactly what you are looking for, but Open Secrets gets you almost there: https://www.opensecrets.org/federal-lobbying

Their API leaves a lot to be desired, but the data is much easier to access and analyze than the raw data from the US House or Senate websites.


I've thought about this (as an outsider who doesn't know anything) and wondered if plain old git would do the job. I've heard Germany already does this, but when I looked at https://github.com/bundestag/gesetze it didn't look like this was representative of what I would assume to be the full extent of German legislation.

In theory, you probably wouldn't find lobbyists contributing directly, but you could find representatives and then link them to lobbyists they've associated with.


Until you define a method/definition of "Evil" you're out of luck. What you can do, is use this to track changes, and then match it to a corpus of other data to get a better fidelity on what may influence legislation; financial transactions, public statements and where they were made, state visits, litigation, etc. Much of it in the public eye, hence scrapable and able to be put into a data lake/warehouse/cabana/dilapidated shack, and analytics applied to it. From there you may find emergent phenomena.


Isn’t this what opensecrets.org does?


Find lobbyists who wrote parts Is this usually noted on the document?


unfortunately, no. but other records can and do illuminate such behavior.


Just need a github for legislation. Want to see who added what subsection? Check the commit history.


We do have this in the US! All laws should show who wrote them, when, who approved it, etc, we just don't have a great API for programs, and moreso we don't have the public appetite to consume it


No. The request is to show who wrote individual lines or sections. Currently the bill shows as being 'written' by legislators Smith & Johnson but lacks crediting/blaming who actually provided the wording for each section. The goal would be to see who slipped in which pieces of the bill.


Ah ok that makes a lot more sense. To be fair though that is the same as git, I might push up the code but that doesn't mean I "created" it - I'm just the one taking responsibility for it by introducing it into the system


True, but signing the commits with a key for a specific subsection would mean you attach responsibility for whatever was in that commit. Right now the system is, a bill is listed with who "sponsors it." That can mean they wrote it, it could mean a lobbyists gave it to them or that several people spread across the staff of different representatives wrote it. Sure, we could say who sponsors it bears full responsibility, but its not practical, especially when a bill grows to become a tome. Using a VCS system like git isn't full proof, a senator could just pass out their keys like candy, but I think it would mean a whole lot more if voters could go, "well here is your commit to this bill on X day at Y time, signed by your keys." It may also help correlate the wheeling and dealing that goes on and more importantly, how a bill changes as it goes through committees.

Edit: Actually it could have several other benefits. A senator could tag a "release" of the bill prior to the bill going to committee so the Senator could say, "look, this is the state of the bill now after going through committees, but here is a diff from when I tagged it before it going to committees. So no, my opponents are wrong when they say I put a provision in this bill to stock my favorite fishing hole, just check the difference."


I think even before that we need an API to tell us who voted for or against each bill, and their party affiliation.

Also an easy way to find all votes of each elected representative.

Then maybe an app that allows me to pick a few bills and a few representatives and produce a matrix of how they voted on those bills, also which proportion of each party voted yes or no on those bills.

And finally for each proposed bill who voted for or against to bring it onto the floor to be discussed and voted on, or not.


Everybody has lobbyists, there's no public cause that lacks lobbyists in the USA and if you think it's only corporations with effective lobbyists it's probably because you're discounting a slew of causes and groups.


"We need to track the evil parts of bills to the congress person who is the sell out for lobbyists (and the corporations beind them)"

This would require a lot of changes to how bills are literally shuffled around the building :)


git grep -n 'healthcare' | perl -F':' -anpe '$_=`git blame -L$F[1],+1 $F[0]`'


I use to work in Congress. 100% of it is written by lobbyists.


No, 100% is not written, but yes some bills are written by lobbyists.

A good story my professor told me is when he took a trip to Congress, met his Congressperson, suggested a law that would help entrepreneurs, then sat down with him and they both drafted it in about 2 hours, then he took it to Congress to table it for a vote. It didn't pass, but that's how laws get written.

But then again, is lobbying bad? I mean, it's not stacks of money passed under a table, it's literally arguing your case. I mean isn't that what Congresspeople are there for? To hear their constituents concerns and desires?

Would anyone on HN argue that EFF shouldn't be allowed to spend donations they receive to do work that helps them lobby congress for say, privacy laws?

That's a good thing to me.


This is categorically false. If you want an understanding of what life in Congress is like, I highly recommend Mark Strand's "Surviving Inside Congress"


It's not categorically false, just false. Some phrases written by lobbyists survive in some bills.


But then wouldn't the phrase I was referring to, "100% of it is written by lobbyists" be categorically false because it specifically emphasizes the percentage and therefore the claim is false? If they had said that sometimes phrases or even whole bills from lobbyists get introduced I wouldn't have quibbled with it.


While the phrase has become used more loosely, I believe (could be wrong, of course) that it is best used to explain that the cause of being false is a category error. It's like the distinction between a type error and a value error. In this case, I'd say it's a value error. The value 100 is false, not the type, because we know that a nonzero amount of prose in legislation is indeed written by lobbyists.


Ah okay, this was really helpful, thanks! Not quite as bad of a language faux pas as when I was a kid and thought 'per se' was persay but I'm glad to know the difference


We need WHICH congress-person approved it getting into the bill. We have to VOTE OUT the congress-person linked to the evil riders to bills (Budget bills, Defence bills, etc.)


We need the ability to understand exactly who profits from any act/law/bill and excruiciating detail of the finances of anyone in congress, coupled with max age limit for any seat, including the Supreme Court.


Who wants to be the first to teach congress to use git?


All of this is somewhere, all of this information.


lots of this data exists. campaign finance and lobbying reports help shine a light on this behavior.


i’d be happy with voting information for each bill that was voted on by either house or senate.


Git blame for bills, I love it! :D


Version track the bills.

That would be very cool.


you are arguing for Git for legislation. not an api.


I want a webhook for Nancy Pelosi’s trades


This actually also exists in https://openstates.org/, but it's a separate nonprofit, not a government service.


There's all sorts of cool data analysis that can be done with this data. I lead engineering for a company that ingests these open APIs and sells a service that enhances the metadata on these records and allows users to follow new changes in bills/legislation (think: following a PR). You'd be surprised how many organizations want it, and I don't just mean large corps (yeah, I know...but see the discussion around transparency below in the comments!). We have a lot of very cool institutions as well. If you're a Rails dev or like Data Science, we have some openings: https://careers.fiscalnote.com/


Hah I was hoping this idea wasn’t out there yet in production. Cool company! What’s the funding model?


We’re newly public (NYSE:NOTE), so customers and ARR :)


That’s very cool, I think ideas that bring tablestakes tech (elasisearch or whatever) to non-tech areas will start to take off.


> if we could get this for every state and county legislature

Not an official source but someone took the pain of creating a GitHub repo of Indian constitution with amendments as commits[1]. Here's one commit[2] for example that's about modifying some affirmative action details.

[1] https://github.com/prince-mishra/the-constitution-of-india/c...

[2] https://github.com/prince-mishra/the-constitution-of-india/c...


fiscalnote.com govtrack.us opensecrets.org openstates.org


Now if only we could have an API to vote ...


The fact of the matter is: paper is still basically the most advanced voting technology around (from the perspective of auditability, which is crucial)


Just release make everyone's vote semi-public. You can look up what you voted for with a combination of your name + position/ballot-measure + password that's passed through a one-way hash, which generates anonymous voter ID. You can file a complaint what was counted doesn't match who you remember voting for.


Problem is you are incentivizing people to sell their vote or to threaten others to vote a specific way (abusive spouse wants to verify their SO voted a certain way).

The only info we should provide electronically is that your vote was counted at all. Direct value verification would have to be done in person and under supervision.


With widespread mail-in voting an abusive spouse could just fill in the ballot and drop it in the mailbox. No need to verify your spouse’s actions if you can just do it yourself.


This is clearly clueless

In Russia all state employees, say school teachers, are told to vote the right way under no uncertain terms. But come the election day, and it is not physically possible to inspect what everyone is doing with paper ballots. If it was possible to digitally check voting, the regime would be even more repressive.

If you have an abusive spouse, voting is your last problem.


The relevant threat model isn't the abusive spouse who has physical access to your ballot, the relevant threat model is someone without physical access to your ballot being able to verify that you voted the way they wanted you to.


An interesting side-effect of universal mail-in ballots is the detection of fraudulent voter registrations. If ballots addressed to Tinker, Evers, and Chance arrive at 123 Elm Street, which is only occupied by the Smith family, one should reasonably assume shenanigans, if not felonies.


Not really. My friend who just recently moved got 4 mail in ballots sent to his place this last election, in addition to his own.

Just people who never bothered to update their voter registration.

Completed ballots are supposed to be verified by signature (at least in CA), but I have no idea how thorough this is.

And I imagine if they are mail in, could they even find people who completed all 4 ballots, then dropped them in some random mail box? From what I gather they just reject a vote if they can't match signatures.


Yeah I took a class that talked about this - most people agree that what you'd end up with is companies or individuals forcing you to disclose a hash to prove you voted the way they wanted. Votes kinda need to be unrecoverable at an individual level for this. There's some cool research on "homomorphic encryption" if you want to learn more - it basically opens up the data in aggregate for analysis without being able to disclose information about any individual record in the data, but it's hard to pull off in practice


> Yeah I took a class that talked about this - most people agree that what you'd end up with is companies or individuals forcing you to disclose a hash to prove you voted the way they wanted.

That's what the one-way hash is for. If you're forced to provide a password beforehand, you can provide extra bogus passwords that cast ballots for both sides. The system can allow you to do this an arbitrary number of times.

As far as paper ballots go, nothing stops someone from bullying you into taking a video of you voting and dropping it into the ballot box.


> nothing stops someone from bullying you into taking a video of you voting and dropping it into the ballot box.

And yet this doesn't happen in real life, so it's not a real problem.

Maybe because it's unmanageable and impractical to transfer, store anf watch 50 million videos of voting. But checking a hash is easy and automateable.


You can file a complaint what was counted doesn't match who you remember voting for.

Impossible to prove. You don't want people changing their votes. People wouldn't accept results if they change after the fact.


votes and voter registration is already semi public. campaigns get access to voter rolls for outreach, for instance.


Voter registration, not votes. They can tell if you’re registered Democrat or Republican, not if you actually voted for Biden or Trump (even if it could safely be inferred).


the secret ballot is sacrosanct in the US, yes.

nevertheless, you can tell that a voter is a registered D, I, or R. you can tell if they turned in a ballot in a given election.

in jurisdictions where registered voters cannot vote for candidates of the other party (many), then yes, you can then reasonably infer their vote, with a margin of error equal to rates of write-ins for that party in that election.


Way too complicated to implement securely, anonymously and transparently. Going physically somewhere to click on a button after a human identification is probably as technologically advanced as we're going to get in the near future.

I mean sure, with the EU's NFC chips in passports and ID cards there can be an app that compares that to a 3D selfie (there are already apps that do that for lesser government services), but the risks associated in getting it wrong are still too great. Not to mention the lack of transparency which is paramount for a healthy democracy.


It'd be interesting to explore transparent/public voting combined with an in person way to correct/lock_in your vote. Instead of having a voting day let people vote over a month and be able to lock in their vote in person at any time.

Maybe not use it for elections but maybe for polling on issues or a replacement for petitions and/or referendums. Enabling some aspects of direct democracy especially at local levels. But i think this would need to be public or overly transparent to enable people to trust the outcome or become aware of any attacks on the system.


The closest we have to that is paper ballots. You can get your ballot a few weeks in advance and vote then. Then, until the “postmarked no later than” date, you can change your vote if so desired.


But at some point we're going to need to build an interplanetary civilization, so we might as well get started on governance experiments for that future now.

Maybe this is why US can't keep up its space program but China can.


Estonia manages it


If Estonia had the GDP, political influence, or military of the USA it might not hold up to the same level of attacks.

It also helps that their population and schooling system prioritizes coding and technical literacy.


There's a pretty big difference in scale between Estonia and USA.


Seriously?


let's all make an bot to read bills and vote on our behalf.


Cue the obligatory xkcd...


For those unfamiliar: https://xkcd.com/2030/


software engineering is like steam engines were in their first 50 years - they could explode at any time, and had multiple spinning parts that will rip off your arm if you are in the wrong place


If you’re interested in bill data, open states maintains a federal scraper that outputs into a common format with our scrapers for all 50 states as well.

https://github.com/openstates/openstates-scrapers

It uses the GPO’s api though, not this one.


If anyone is interested I setup the bills and committee endpoints in a google sheet, makes it easy to get the data in one spot, manage pagination, etc.. You can simply copy the spreadsheet and it will copy the api connectors, just enter your api key, you can easily add other endpoints, change query params, etc.

Pagination seems to be limited to 250 on the endpoints and some of the data sets are quite large so I set a limit on pagination of 10 pages, if you want all the bills from all time, prepare to wait.

Full disclosure it uses a free addon myself and my cofounders created to easily push any api data into a google sheet. I just find it useful to play around in a spreadsheet very quickly vs setting up a db.

spreadsheet is here: https://docs.google.com/spreadsheets/d/1amnbqb_J9W2r-XaVsrue...


Not directly related, but I dream of a future where laws are published on GIT. New laws, or updates get pull requested, approval is voted on, then merged to master.


My dream is that the world would adapt a system of law so simple that any one person would be a able to understand the totality of it, removing the need for lawyers.


Masks.

That one issue alone is a perfect example of why law is complex and experts in law are needed. Morals are subjective. Countries are large.


This was on front page a few months ago https://news.ycombinator.com/item?id=18528365

Edit: 2018, so not a few months ago


There was a bill that got published on Github a few months back: https://github.com/responsible-financial-innovation-act22/RF...

Not sure if any suggested changes got incorporated or even addressed, but it's a really interesting concept


I helped make an example of this in GitHub for the Declaration of Independence: https://github.com/usgov/forget-the-king/pull/1


Or if laws were executable descriptions of how to make certain changes to world state.

There could be some sort of VM (state machine?) which executes these laws (programs). A queue accepts change requests from the edges, e.g. citizen1 wants to sell her car to citizen2 would generate a change request. The queue processor validates the change request, finds the appropriate reducer (= law) for it, applies the reducer to current world state + change request and derive the new world state.

The programs (laws) themselves could also be objects of the world state. Changing the law is then another change request (self-modifying code).

One big issue with this is that the reducers should probably also work at the edges. Paying with a credit card in a shop should work even if the Internet is down. Diverging state histories should be the norm not an exception. We should figure out how to ensure we can always resolve the merge conflicts.


Bitcoin.


This is, to some extent, the same original line of thinking that spawned out things like Ethereum. A lot of people hate on crypto, but at its core I think it's a very hopeful and interesting idea.


I don't see much value in this beyond diffing? The hard part in making laws is reaching concensus, not the actual edits.


Understanding amendments would be a very good use case. Often changes to the law are not new laws, but changes in other laws. Any time I've tried to actually parse the law, I've found getting a good picture of the current state of the law, and a snapshot of the law in the past is tricky.

To take this example I found off the NYS assembly website legalizing adultery (it was the first one I found, I swear)

https://nyassembly.gov/leg/?default_fld=&leg_video=&bn=A0010...

It's phrased as "Section 255.17 of the penal law is REPEALED", but if you try to find "the penal law", but if you look up a a copy of the penal code do you see 255.17 in it? If so, how can you find out what was actually repealed. If not, do you need to hunt through every possible amendment to figure out the state of the law is at the time of reading?


That is exactly how it works, they just don't use git.

"New laws" have to quite literally be diffs of the existing law.


Was not expecting Swagger... neat!

https://en.m.wikipedia.org/wiki/Swagger_(software)


Don't they call it OpenAPI now?


I think now "OpenAPI" is the schema definition, swagger is the tool you actually use to display your OpenAPI specs in a nice interactive GUI.


Not quite - Swagger has been retrospectively renamed OpenAPI 2.0. Swagger UI is the tool we're seeing here


yes


Depends on the version :P


Swagger has been retrospectively renamed OpenAPI 2.0


There's a joke somewhere about it desperately needing to support PATCH methods


The delete verb would be preferable, imo.


  DELETE /congress HTTP/1.1
  Host: api.congress.gov
  Accept-Language: en

  HTTP/1.1 200 OK

Wouldn't that be something?


more likely response codes:

506 Variant Also Negotiates (you get pawned off on a staffer)

409 Conflict

And, of course, the most relevant: 402 Payment Required


You missed this -> 451 Unavailable For Legal Reasons


And, of course, the most relevant: 402 Payment Required

Good point!


Wouldn't it be a 204 Not Found? ;)


204 would be No Content

404 would be Not Found


That would be the the real life equivalent of a GTA V mod menu.


Disappointed (but not surprised!) there's no `POST /amendment` or `PATCH /bill/:id/:para` etc., with copious notes on auth.


:-) I figured someone would beat me to this.


Looks like the page size limit is 250 so you can fetch records like this:

    https://api.congress.gov/v3/bill?format=json&api_key=...&limit=250


At first I was amused to consider what a ‘POST, PUT, DELETE’ means for this API. Then I realized that the conceptual meanings are straight forward. Then I realized that democracy is a fancy authorization regime for doling out ‘write access’.

(Added edit) I too agree with the sentiments that a v2 should have a finer grain resolution where the data model would recognize a bill as a collection of clauses or statements. And attribution and intent of those clauses would be transformative (I think) for regular citizens.

Because then the internet would be able to track unintended consequences by author. This is arguably what the internet does best.


New API, and already mixes camelCase (committeeReport) and snake-case (house-communication).


And already there's a discussion on the matter: https://github.com/LibraryOfCongress/api.congress.gov/issues...


I hope they soon provides schemas rather than just separate human-only markdown description of fields. Both XML and JSON have methods for this using Linked Data.

For JSON-LD, this would basically look like this (from https://json-ld.org/spec/latest/json-ld/#the-context):

  {
    "@context": {
      "name": "http://schema.org/name",  ← This means that 'name' is shorthand for 'http://schema.org/name' 
      "homepage": {
        "@id": "http://schema.org/url",  ← This means that 'homepage' is shorthand for 'http://schema.org/url' 
      }
      …
    },
    … data part using name, homepage, etc
  }
Once you have stable places for information (identifiers), you can start building a real web as described by the semantic web, by bundling schemas with the data you can freely use information with human and machine understanding, until then you've got a muddle.


I havn't seen this before but the .pagination.next url value is a great convenience. On the other hand, the OpenAPI documentation doesn't explicitly mention offset and limit for paginated services even though it lists format for each service.

  jq '.pagination.next ' member.json 
  "https://api.data.gov/congress/v3/member?offset=20&limit=20&format=json"


>I havn't seen this before but the .pagination.next url value is a great convenience

Reminds me of HATEOAS [0]. Definitely makes it easier to browse using a REST client.

>On the other hand, the OpenAPI documentation doesn't explicitly mention offset and limit for paginated services even though it lists format for each service

I could imagine that they use some kind of middleware for pagination which leads to it not being explicitly included in the OpenAPI spec, especially if they generate it from their DTO classes instead of going API first.

Also, am I the only one who thinks specifying the expected response format via query param is weird and they should just use the Accept header instead? Eh, I guess it’s better supported by OpenAPI.

[0] https://en.wikipedia.org/wiki/HATEOAS


Yes, I see format in the query string here and there. It is in the medical web service spec FHIR.

* In order to support various implementation limitations, servers SHOULD support the optional _format parameter to specify alternative response formats by their MIME-types. This parameter allows a client to override the accept header value when it is unable to set it correctly due to internal limitations (e.g. XSLT usage).*

https://www.hl7.org/fhir/http.html#mime-type


This is a very good start! What would close the loop is an endpoint to serve legally binding notices.

Consider someone with a legally recognized special need necessary for some bodily function.

For example, someone in a wheelchair wants to use a bathroom. Or two people who can't speak want to get a condom by communicating it non-verbally, by pointing at it or writing their request down on a piece of paper, but whose requests are ignored whereas speaking customers have their needs met.

In code you can just try:

   try usebathroom()
  
   catch
      cant
or

   try buycondomnonverbally()

   catch
      cant
The exact function call that makes it fail becomes obvious.

With an endpoint, you could apply the legal API to it and demand that the proprietor provide legally mandated accommodations until the failing function succeeds for the special case.

It's hard to deny you exist if there is a parking lot full of employees and you can serve them a notice by GPS lookup.

If someone made that service it would be an "oh shit, they actually mean it" moment for every unaccountable black box Establishment that skirts its accessibility obligations.

It would instantly improve the world for everyone.


I hope one day we move government policy and legislation onto a git-like version control system so we can see the history of law itself.


For anyone wondering, there is no e-mail validation to get an API key.

You can enter whatever you want in the form.


Excellent note.

benign use: love the fact that they are going to allow me to add a + address

malicious use: consider testing for injection attacks :)


What injection attacks? It seems like the email just goes to /dev/null currently.


This is awesome! Now if we can just get congress to use git for actually writing the bills.


they tried that once. It was meme'd into oblivion...

https://www.theverge.com/2022/6/23/23180813/cryptocurrency-b...


“This bill would do far more to benefit everyday Americans if its text was replaced with the source code of Doom,”


This is very cool. How long has this been around?



Most government departments have some form of api. Many use openapi (swagger) and have design decisions like this one, excepting the major APIs, like FDA. They enable projects like https://ofr.report/ or https://sec.report/


Psyched to to see this! For those who are interested, there's some background here via Daniel Schuman and the Congressional Data Coalition: https://congressionaldata.org/library-of-congress-launches-c...

https://govtrack.us – mentioned there – is an amazing resource for federal legislative data and continues to evolve.

There are a number of sites for tracking donations if you are concerned about money and politics. https://www.opensecrets.org is the one I check the most often – but I find that the journalists tend to make it more sensible. e.g. https://www.exposedbycmd.org/2022/08/15/kyrsten-sinema-has-m...

https://www.ballotpedia.org has great election related information as well as a bit of analysis around state trifectas in particular.

Likewise https://openstates.org/ has a ton of well indexed state legislative data as mentioned in a separate comment.

And after years of effort by the Free Law Project https://free.law/ big changes are a foot with PACER for legal dockets: https://www.reuters.com/legal/government/fed-judiciary-says-...

As for the Federal Register, where the federal executive rules live, they have a decent site: https://www.federalregister.gov/ an API https://www.federalregister.gov/developers/documentation/api... and someone made this handy quick view as well https://ofr.report/

Now, regarding municipal legislative data, many municipalities use a tool called Legistar which is a bit of pain for regular users – bad layouts, unintuitive search, many clicks to view the matters, links in PDFs – but lucky for us there's an API for read access. https://www.documenters.org out of Chicago has been scraping it and crowd-sourcing meeting coverage – pretty awesome to see, though I'm concerned about how they are managing their infrastructure tbh. A repo per city seems like it'll be a pain to manage.

So I've been working on a tool for browsing recent agenda and matters that makes it much easier to keep tabs on what's happening at council. I'm making weekly updates – not sure where it will lead but we've got 17 cities on it so far... https://www.legigram.com and if you have an in at the SF or Phila city clerk's office, please reach out to me. No donations so far but some very happy users. TBD whether there will be paid product on top of the free view or we will win any grant support.

From what I've learned, the SaaS ecosystem for municipalities is screwy. There's the lock-in, absurd upcharges, widening attack surfaces, stakeholder decay, etc – and now private equity entities like Vista Equity seem to be milking our cities without much of a fight. And it just feels a bit rich that their CEO in particular has been written up for some pretty intense tax fraud. https://www.wsj.com/articles/vistas-robert-smith-had-bigger-...

I saw a comment here about transparency enabling lobbyists over citizens, and I have given some thought to that concern recently as I have been building Legigram.

Maybe part of the challenge is that people outside of professional politics tend to be idealists – the better ideas are what should matter and I have them – whereas those in politics hew to a more realist perspective – that government is a matter of compromise between vested groups - whether lobbyists, donors, voting blocks, or interest groups - brokered by individual politicians and media. Meanwhile, scandal, crime, pandering, gross simplification, and heroicism make for better headlines, soundbites, and news segments – but we need to support budget balancing, zoning compromise, and school board recommendations, too.

There's certainly lots of room for skepticism around civic tech efforts generally – not to mention about how more engagement with politics should de facto lead to better outcomes. One would hope that the last few years would be proof enough to put that idea to bed. Consider further that the majority of FOIA requests are by gov't contractors seeking competitor research.

But if we can set our design goals past mere transparency, then we might see actually start to see better engagement and more agreeable outcomes. What sort of engagement might lead to better outcomes?

When civic duty, like trade work and social work, has been so devalued relative to financialization, tech, real estate – that makes it less and less rational to engage in until the problems are truly acute. But we are getting there: besides income inequality, the widening housing crisis, climate change, and the demographic shift, we need to keep the power on California, the water clean in Jackson, and the schools safe and effective in Texas – and that means in part supporting the people keeping the lights on when the mob with pitchforks show up – while also pushing towards progress.

I recently learned about Richard S. Childs, a widely forgotten 20th century reformer who successfully advocated for the council-manager municipal government format (aka the "weak" mayor format) and also helped usher in the "short ballot" based on the thinking that most people couldn't be bothered to make an informed decision about so many obscure administrative offices.

Along those lines, I think we can achieve better civic engagement by encouraging better decisions and more informed discourse. And while that doesn't just mean better end user dashboards, if I can make it so that literally millions of people can keep tabs on their city hall agenda because it'll take a minute a week instead of half an hour, that's a win enough for me.


I have a pet project I'd like to make with this, but one piece of data I'd be missing is a measure/identifier for "important"/"newsworthy" bills. Clearly this is subjective, but I'd be open to most interpretations. Any suggestions for where I might find this?


1) Scrape a news source and check how many times the bill is mentioned? 2) How many results on a search engine for the bill's title? 3) Train something similar to sentiment analysis model based on the text content of the bill. You'd need historical data for that but see options 1 and 2.


It would be highly useful if this could be used to generate corruption index.

Seems like almost all politicians - regardless of isle side - have plenty of questionable choices around there voting with donations/pacts, selling shares for monetary gain, etc.


Well, we've never really needed this.

Political contributions are open, as well as voting records. With a little work you could do this on your own.


The Congress.gov API has been added to Pipedream - https://pipedream.com/apps/congress-gov/.

Please share what you build!


cool; had no idea this existed. Would be great to have each bill available as a git repo so that you can see the bill's draft history as it goes through revisions (with annotations as to the authors of the changes).


I think there was a post on here where a city's laws were hosted on git or some other version control.

It's a intriguing hypothetical to think about. Imagine if all the discussion around a bill had to be as code review comments.



Thanks!


Is the OpenAPI json/yaml spec not available? Seems clear from the UI that this is likely using the API, but I can't find an endpoint that returns the spec.

edit: oh, it's just inline within the html source, strange


In a similar vein, here's the UK Parliament API directory: https://developer.parliament.uk


I was looking at the control plane api but the campaign contribution metering rates are extraordinary and require lobbyist api key credentials.


Nice start. Too bad there isn't a great way to filter data like members by status, state/district, congress number, etc


Maybe I missed it while glancing through, but does this return the actual voting by congressperson for each bill?


Roll call vote data is available from ProPublica's Congress API: https://projects.propublica.org/api-docs/congress-api/

ProPublica took over a number of the Sunlight Foundation (Sunlight Labs') API projects: https://sunlightfoundation.com/2016/11/01/sunlight-labs-upda...


I don’t think so, but several other sources do provide structured roll call data, which is what this is called.


don’t see it.

i would like to see a vote summary, similar to what you see on C-SPAN after a vote.


I wonder why this has API keys at all? Maybe so they can keep logs of who is using the API and for what purpose.


It also helps when trying to put limits on greedy users or maintain a ban-list. Attribution is also important, like you said. Granted, an abusive user could just keep creating new keys, but if they require something like email verification then it's a little bit costlier to circumvent than nothing.

EDIT: Based on other comments, there's no email verification.


There isn't currently, but they could add whatever requirements to generate new keys in the future they want. If they didn't have keys that would break every existing client.


Wikiocracy > representative government


If a "wikiocracy" is where shadowy, unaccountable hierarchies manipulate policy to their will while pretending to be democratic about it, then yeah we live in one but I'm not sure it's better than a representative system.


The root name is not plural, but final locations are, for e.g. - Bill vs Summaries or Titles


I remember there used to be (still there?) of this data marked up with semantic web.


Hmm… all the useful endpoints are returning a 402 status.



;)


This would be way better in a database than as an API.


API can have predictable access patterns.


Missing a DELETE action for all incumbents, and a CREATE action with proper attributes tree to create new and improved representation.


Blank page with JS disabled.


Try enabling JavaScript. Fixed it for me


Thanks!


This is ridiculously broken on mobile platforms


Incredible.


Hello!


I see no endpoints use the POST verb


Maybe we can POST to file SEC claim against Nancy Pelosi and her husbands rampant insider trading. Meanwhile, democrats continue to hypocritically call out republicans on insider trading during covid.


Seems like a miss that this is using google fonts instead of the font made by the govt https://public-sans.digital.gov/


It's also using Cloudflare and set up to block Digitalocean ip's outright from browsing anything at congress.gov and its subdomains.


Sorry, why Digitalocean ip's? Anti-bots and DDOS? And, how do you even find out about this?


I don't know why, probably because DO is known to be cheap and originates a lot of spam. It's just super annoying because I use it as a cheap fairly reliable wireguard VPN since my ISP's seem to reset/kill my ssh connections otherwise.


Is this not just the default swagger output?


No /trades route?

What's the point without that?


[flagged]


Hmmm. Suspiciously normal. You're on the list, buddy.


I wish /member/fire was implemented.


BTW, we are missing an API to delete congress people by name


Why does it matter if a congress person can be deleted when party_affiliation seems to be a protected field?


This is pretty cool, but...

Authentication seems to be done with a query string ?api_key=KEY instead of some kind of standard header.

Also, there is a query string "format" for changing the output, ?format=json. Instead of using the Accept header :/


I think these are reasonable design decisions.

Headers are harder to use than query string parameters. You can't start poking around in an API as easily using just a web browser if the API requires authentication and accept headers.

The downside of query strings for API keys is that they can inadvertently be exposed by log files. For this API, where the API key appears to be there purely for analytics reasons, I don't think that risk is particularly bad.


I feel like there's all sorts of disappointing design decisions.

* All of the endpoints are singular, but then /summaries is plural for some reason

* You can enumerate the congresses, but non of the congress representations have a value which represents the numeric ID that should be used on other requests. Unless you request the congress data using that number, and then it does include it.

Oh well, hopefully it improves and becomes more consistent over time.


Browser dev tools can add headers. It's not worth the key leakage.


I was able to get it working with the 'X-Api-Key' header and it seemed to give back JSON by default without adding anything to the query string.


Cool idea.

Some suggestions for missing interfaces:

DELETE/Representative POST/Bill




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: