How to get API Authentication to work

I am trying to access the ProPublic API> I have the API key. I am trying to get authorization to work. The documentation says to use -H “X-API-Key: PROPUBLICA_API_KEY” for authentication. Which authorization do I use?

The lines below are from the ProPublica documentation:

Authentication

To use the Congress API, you must sign up for an API key. Usage is limited to 5000 requests per day (rate limits are subject to change). The API key must be included in all API requests to the server, as a header:

X-API-Key: PROPUBLICA_API_KEY

To authorize, use this code:

With shell, you can just pass the correct header with each request
curl "api_endpoint_here"
  -H "X-API-Key: PROPUBLICA_API_KEY"

Make sure to replace PROPUBLICA_API_KEY with your API key.

Hi @Tom_Wikle :wave:

Welcome to the Parabola community! You can pass an API key as a request header by following these steps:

  1. Drag in a Pull from API step
  2. Expand the Request Headers section in the left-hand sidebar
  3. Set your “Header Key” to X-API-KEY
  4. Set your “Header Value” to your PROPUBLICA_API_KEY.

Note:

  1. After selecting the drop-down menu, you can manually type in a custom Header Key
  2. Replace the PROPUBLICA_API_KEY with your actual API key
  3. Under the Authentication section, leave your “Authentication Type” set to None

Here’s a screenshot of what that looks like in Parabola:

Hope that helps!

I tried your suggestion and I got an error message: Missing Authentication Token". This is the message I have been getting. I think it needs something for the Authentication section.

Thanks for sharing! Can you ensure that your header is set to X-API-KEY using caps?

You can manually type your value and press enter to add headers not already included in the drop-down menu.

If you’re still running into this error, feel free to reach out to help@parabola.io with a link to your flow and we can investigate this further.

Hi @Tom_Wikle

Following up to let you know I was able to successfully connect to their API:

The 403 error they sent was misleading. The issue stemmed from your API endpoint URL. It needs to be configured with the correct parameters.

https://api.propublica.org/congress/v1/117/senate/members.json

This includes the following:

  1. Setting the API version to v1
  2. Entering the correct session number (current congress session is 117)
  3. Entering the correct group (house or senate)
  4. Adding /members.json at the end of the URL

To use the settings used in the screenshot, feel free to copy and paste the snippet below into your flow.
parabola:cb:db335a08-8721-494d-8a66-66b7a6277ba7

Note: The step might show a 500 error once you paste in the step. Adding in your API key as the “Header Value” again should resolve the error.

For more info on constructing endpoints, check out the docs below:
https://projects.propublica.org/api-docs/congress-api/members/

Hope that helps!