How to use The Stack API


In this post we’ll show how to use The Stack API. We’ll make it accessible for non-developers.

Registration

First of all you need to create an account on The Stack. For this, you should go to the register and create an account. After that, you’ll be redirected to the login page, where you should add the same username and password.

This will take you to The Stack Dashboard, where you can see your subscription status and some extra info.

Confirming email and starting a trial period

If you’ve just registered, you should received an email from us with a link to verify your account. If you don’t see it on your inbox, make sure you check your spam folder.

After clicking the link, your account is verified and you can start your trial period for the API! You’ll see the number of requests you have to play around with the API in your dashboard:

Trial Active

Obtaining an API Key

Once you’ve registered, you can got to the API Keys section of the web (you’ll see it in the drawer after clicking on the “hambuger” on the top left):

API Keys section

After clicking on there, you’ll see the list of your API keys (if you’re new, you’ll see it empty). Click on the Create Key button:

Create Key

and you’ll get your key:

New API Key

Save the value of you Key Secret as for security reasons this cannot be recovered and we’ll only show this to you once (we don’t have access to your keys). For convenience, you can copy it to the clipboard with the button on the right. And that’s it, you got your key, let’s put it now to use.

Example usages

We’ll show you here some example usages on how you can use our API, but you can use any tool that allows you to send authenticated requests. We’ll show examples with the investors endpoint, but other endpoints will similarly.

cURL

This is a command line utility available to most Unix-like computers, such as Mac or Linux. If you’re on those systems, you probably have it installed. Here’s how you can get the latest investor data (latest updated).

1
2
curl https://thestack.es/api/v1/search/investors?page=1&sort_by=updated_at&order=desc 
    -H 'X-API-KEY: {your_api_key}'

You need to pass two things:

  • The arguments in the URL:
    • page: 1, 2, 3…
    • sort_by: column to sort
    • order: asc (ascending) or desc(descending)
  • API key: This is the API key you obtained above. You pass this on a Header

Then, you’ll get a JSON response with the data, that you can consume as you want.

Automation tools or Excel or Google Sheet Extensions

There are many extensions you can use to run a script and export data from an API to Excel, here are some videos for Excel or Google Sheets, for example.

If you want to a more robust tool, you could use Postman, or if you want to go for a more Marketing / Outbound automation flavor, you could go for Retool or Clay.