14 ms·
Congress.gov API
- carapace 4y agoBlank page with JS disabled.
- nikodunk 4y agoThis is very cool. How long has this been around?
- smeyer 4y agoIt's pretty new https://blogs.loc.gov/law/2022/09/introducing-the-congress-gov-api/ https://blogs.loc.gov/law/2022/09/introducing-the-congress-g... https://github.com/LibraryOfCongress/api.congress.gov https://github.com/LibraryOfCongress/api.congress.gov
- deleted 4y ago[deleted]
- ratg13 4y agoFor anyone wondering, there is no e-mail validation to get an API key. You can enter whatever you want in the form.
- no-dr-onboard 4y agoExcellent note. benign use: love the fact that they are going to allow me to add a + address malicious use: consider testing for injection attacks :)
- cmeacham98 4y agoWhat injection attacks? It seems like the email just goes to /dev/null currently.
- obblekk 4y agoI 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).
- ElevenLathe 4y agoThis actually also exists in https://openstates.org/ https://openstates.org/, but it's a separate nonprofit, not a government service.
- dheera 4y agoNow if only we could have an API to vote ...
- cookie_monsta 4y agoCue the obligatory xkcd...
- Shared404 4y agoFor those unfamiliar: https://xkcd.com/2030/ https://xkcd.com/2030/
- ClumsyPilot 4y agosoftware 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
- deleted 4y ago[deleted]
- 4y ago
- ethbr0 4y agoWas not expecting Swagger... neat! https://en.m.wikipedia.org/wiki/Swagger_(software) https://en.m.wikipedia.org/wiki/Swagger_(software)
- djbusby 4y agoDon't they call it OpenAPI now?
- o_1 4y agoyes
- jzig 4y agoDepends on the version :P
- jamietanna 4y agoSwagger has been retrospectively renamed OpenAPI 2.0
- issung 4y agoI think now "OpenAPI" is the schema definition, swagger is the tool you actually use to display your OpenAPI specs in a nice interactive GUI.
- jamietanna 4y agoNot quite - Swagger has been retrospectively renamed OpenAPI 2.0. Swagger UI is the tool we're seeing here
- drstewart 4y agoThere's a joke somewhere about it desperately needing to support PATCH methods
- goatcode 4y agoThe delete verb would be preferable, imo.
- mindcrime 4y agoDELETE /congress HTTP/1.1 Host: api.congress.gov Accept-Language: en HTTP/1.1 200 OK Wouldn't that be something?
- deleted 4y ago[deleted]
- deleted 4y ago[deleted]
- ZeWaka 4y agoWouldn't it be a 204 Not Found? ;)
- dhritzkiv 4y ago204 would be No Content 404 would be Not Found
- trelane 4y agomore 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
- bierjunge 4y agoYou missed this -> 451 Unavailable For Legal Reasons
- showerst 4y agoIf 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 https://github.com/openstates/openstates-scrapers It uses the GPO’s api though, not this one.
- TheLocehiliosan 4y agoThis 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 :/
- alxlu 4y agoI 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.
- simonw 4y agoI 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.
- TheLocehiliosan 4y agoI 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.
- mixmastamyk 4y agoBrowser dev tools can add headers. It's not worth the key leakage.
- sand500 4y agoI 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.
- Cyberdog 4y ago
- cookie_monsta 4y agoHmmm. Suspiciously normal. You're on the list, buddy.
- simonw 4y agoI wonder why this has API keys at all? Maybe so they can keep logs of who is using the API and for what purpose.
- phantomread 4y agoIt 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.
- cmeacham98 4y agoThere 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.
- simonw 4y agoLooks 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
- fnordpiglet 4y agoI was looking at the control plane api but the campaign contribution metering rates are extraordinary and require lobbyist api key credentials.
- 11thEarlOfMar 4y agoMaybe I missed it while glancing through, but does this return the actual voting by congressperson for each bill?
- naikrovek 4y agodon’t see it. i would like to see a vote summary, similar to what you see on C-SPAN after a vote.
- sgammon 4y agoI don’t think so, but several other sources do provide structured roll call data, which is what this is called.
- acaloiar 4y agoRoll call vote data is available from ProPublica's Congress API: https://projects.propublica.org/api-docs/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-update-nonprofits-step-up-to-preserve-tools-for-transparency/ https://sunlightfoundation.com/2016/11/01/sunlight-labs-upda...
- efitz 4y agoCool idea. Some suggestions for missing interfaces: DELETE/Representative POST/Bill
- anigbrowl 4y agoWikiocracy > representative government
- pphysch 4y agoIf 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.
- princevegeta89 4y agoBTW, we are missing an API to delete congress people by name
- lapetitejort 4y agoWhy does it matter if a congress person can be deleted when party_affiliation seems to be a protected field?
- insane_dreamer 4y agocool; 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).
- gennarro 4y agoMost 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/ https://ofr.report/ or https://sec.report/ https://sec.report/
- devmunchies 4y agoSeems like a miss that this is using google fonts instead of the font made by the govt https://public-sans.digital.gov/ https://public-sans.digital.gov/
- flatline 4y agoIs this not just the default swagger output?
- joecool1029 4y agoIt's also using Cloudflare and set up to block Digitalocean ip's outright from browsing anything at congress.gov and its subdomains.
- CreepGin 4y agoSorry, why Digitalocean ip's? Anti-bots and DDOS? And, how do you even find out about this?
- joecool1029 4y agoI 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.
- deleted 4y ago[deleted]
- omginternets 4y agoHmm… all the useful endpoints are returning a 402 status.
- jonas-w 4y agoMaybe didn't pay your taxes? https://www.webfx.com/web-development/glossary/http-status-codes/what-is-a-402-status-code/ https://www.webfx.com/web-development/glossary/http-status-c...
- omginternets 4y ago;)
- adolph 4y agoI 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"
- AndreasHae 4y ago>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 https://en.wikipedia.org/wiki/HATEOAS
- adolph 4y agoYes, 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 https://www.hl7.org/fhir/http.html#mime-type
- smashah 4y agoI 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.
- bendur_ 4y agoNice start. Too bad there isn't a great way to filter data like members by status, state/district, congress number, etc
- OJFord 4y agoDisappointed (but not surprised!) there's no `POST /amendment` or `PATCH /bill/:id/:para` etc., with copious notes on auth.
- toddwprice 4y ago:-) I figured someone would beat me to this.
- lekevicius 4y agoNew API, and already mixes camelCase (committeeReport) and snake-case (house-communication).
- ianrahman 4y agoAnd already there's a discussion on the matter: https://github.com/LibraryOfCongress/api.congress.gov/issues/27 https://github.com/LibraryOfCongress/api.congress.gov/issues...
- spullara 4y agoThis would be way better in a database than as an API.
- aabhay 4y agoAPI can have predictable access patterns.
- hitpointdrew 4y agoThis is awesome! Now if we can just get congress to use git for actually writing the bills.
- dirtsoc 4y agothey tried that once. It was meme'd into oblivion... https://www.theverge.com/2022/6/23/23180813/cryptocurrency-bill-cynthia-lummis-kirsten-gillibrand-github-trolling https://www.theverge.com/2022/6/23/23180813/cryptocurrency-b...
- ratg13 4y ago“This bill would do far more to benefit everyday Americans if its text was replaced with the source code of Doom,”
- davidy123 4y agoI 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 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.
- maxmcd 4y agoIs 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
- logicallee 4y agoThis 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.
- mikrl 4y agoI see no endpoints use the POST verb
- hosh 4y agoI remember there used to be (still there?) of this data marked up with semantic web.
- deleted 4y ago[deleted]
- codelord 4y agoI wish /member/fire was implemented.
- sailplease 4y agoIf 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-XaVsrue29vaY4FxNgDRKhg1VT3FElc/edit#gid=0 https://docs.google.com/spreadsheets/d/1amnbqb_J9W2r-XaVsrue...
- smrtinsert 4y agoIncredible.
- todsacerdoti 4y agoThe Congress.gov API has been added to Pipedream - https://pipedream.com/apps/congress-gov/ https://pipedream.com/apps/congress-gov/. Please share what you build!
- BryLuc 4y ago
- mooreed 4y agoAt 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.
- mandeepj 4y agoThe root name is not plural, but final locations are, for e.g. - Bill vs Summaries or Titles
- hilyen 4y agoNot 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.
- b0afc375b5 4y agoMy 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.
- cheschire 4y agoMasks. 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.
- mike_d 4y agoThat is exactly how it works, they just don't use git. "New laws" have to quite literally be diffs of the existing law.
- supermdguy 4y agoThere was a bill that got published on Github a few months back: https://github.com/responsible-financial-innovation-act22/RFIA-bill 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
- karmelapple 4y agoI helped make an example of this in GitHub for the Declaration of Independence: https://github.com/usgov/forget-the-king/pull/1 https://github.com/usgov/forget-the-king/pull/1
- peanutz454 4y agoThis was on front page a few months ago https://news.ycombinator.com/item?id=18528365 https://news.ycombinator.com/item?id=18528365 Edit: 2018, so not a few months ago
- evo_9 4y agoIt 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.
- bb88 4y agoWell, 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.
- nodesocket 4y agoMaybe 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.
- seereadhack 4y agoPsyched 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-congress-gov-api/ https://congressionaldata.org/library-of-congress-launches-c... https://govtrack.us 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 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-many-friends-in-private-equity/ https://www.exposedbycmd.org/2022/08/15/kyrsten-sinema-has-m... https://www.ballotpedia.org 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/ 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/ https://free.law/ big changes are a foot with PACER for legal dockets: https://www.reuters.com/legal/government/fed-judiciary-says-yes-free-pacer-searches-here-are-details-so-far-2022-05-31/ 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/ https://www.federalregister.gov/ an API https://www.federalregister.gov/developers/documentation/api/v1 https://www.federalregister.gov/developers/documentation/api... and someone made this handy quick view as well https://ofr.report/ 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 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 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-role-in-alleged-tax-fraud-than-previously-known-documents-show-11646562600 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.
- dbxkcichhdfufu 4y agoNo /trades route? What's the point without that?
- Hippieblog 4y ago[dead]
- bozhark 4y agoThis is ridiculously broken on mobile platforms
- forgingahead 4y agoMissing a DELETE action for all incumbents, and a CREATE action with proper attributes tree to create new and improved representation.
- bickett 4y agoHello!
- breck 4y ago
- atl4s 4y agoIn a similar vein, here's the UK Parliament API directory: https://developer.parliament.uk https://developer.parliament.uk
- nilstycho 4y agoI 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?
- blackboxlogic 4y ago1) 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.