Skip to content

Quickstart

Data Endpoints

Endpoint Description Credit Cost
sourcestack-api.com/companies Get one or more companies 1 credit per company returned
sourcestack-api.com/jobs Get one or more job posts 1 credit per job post returned
sourcestack-api.com/skus Get one or more eCommerce SKUs 0.5 credits per SKU returned
sourcestack-api.com/products Get one or more SaaS products 1 credit per product returned
sourcestack-api.com/categories Get company, product, or SKU categories and metadata free
sourcestack-api.com/quota Get the number of remaining SourceStack credits free


Making Your First Query

Each Quickstart example requires your API key to be set as an environment variable first
export SOURCESTACK_KEY="YOURSPECIFICKEYVALUE12345"
curl -H "X-API-KEY: $SOURCESTACK_KEY" "https://sourcestack-api.com/companies?name=SourceStack" | json_pp
if requests is not yet installed
# (If necessary) Install the package manager pip
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && python get-pip.py
# Install requests via pip
pip install requests
import requests
import os

response = requests.get(
    "https://sourcestack-api.com/companies?name=SourceStack", 
    headers={"X-API-KEY": os.environ["SOURCESTACK_KEY"]}
)
print(response.json())
if axios is not yet installed
# (If necessary) Install NodeJS and the package manager npm
brew install node
# Install axios via npm
npm install axios
const axios = require('axios');

axios.get('https://sourcestack-api.com/companies?name=SourceStack', {
    headers: {'X-API-KEY': process.env.SOURCESTACK_KEY}
});
.then(response => {
    console.log(response.data);
});
.catch(error => {
    console.log(error);
});
if Go is not yet installed
# Check if it is installed with
go version
# (If necessary) Install Go
brew install golang
package main

import (
   "os"
   "log"
   "io/ioutil"
   "net/http"
)

func main() {
  req, err := http.NewRequest("GET", "https://sourcestack-api.com/companies?name=SourceStack", nil)
  if err != nil {
    log.Fatal("Error reading request. ", err)
  }
  req.Header.Set("X-API-KEY", os.Getenv("SOURCESTACK_KEY"))

  resp, err := http.DefaultClient.Do(req)
  if err != nil {
    log.Fatal("Error reading response. ", err)
  }

  defer resp.Body.Close()
  body, err := ioutil.ReadAll(resp.Body)
  if err != nil {
    log.Fatal("Error reading body. ", err)
  } else {
    log.Println(string(body))
  }
}
<?php
// Note: this implementation is slightly different than the other examples in that it uses Advanced Filtering and POST
function fetch_sourcestack_data() {
    $api_key = getenv("SOURCESTACK_KEY");
    $data = array(
        "limit" => 1,
        "fields" => ["url", "company_name", "categories"],
        "filters" => array(array("field" => "company_name", "operator" => "EQUALS", "value" => "SourceStack"))
    );
    $options = array(
        'http' => array(
            'header'  => "Content-type: application/json\r\n" . "X-API-KEY: $api_key\r\n",
            'method'  => 'POST',
            'content' => json_encode($data),
        ),
    );
    $context  = stream_context_create($options);
    $response = file_get_contents("https://sourcestack-api.com/companies", false, $context);
    return json_decode($response, true);
}


Access

You will need an active SourceStack account in good standing to use the API.

If you do not currently have one, please visit our Pricing page.


API Credits

Each SourceStack package includes a number of credits - 100,000, or 1,000,0000 - that correspond to the number of rows returned by users' queries.

To conserve API credits, you can modify the maximum number of rows returned by a given query with the limit= parameter. The default limit per query (if not specified) is 10.

Each API response will include the number of credits remaining in the X-SOURCESTACK-CREDITS-REMAINING header. You can also fetch the value at no cost from the /quota endpoint.

Similarly, Count_Only queries and queries that return 0 rows do not cost any credits.

Accounts that have exhausted their credits and have not turned on Auto Billing will receive 429 responses on every subsequent request.


Authentication

Authentication is via the X-API-KEY header. If you have a usecase that does not support API request headers, please share details of your needs with your account representative.

Each API key is a secret. Take care to not inadvertently commit it to GitHub, expose it clientside, or log it.


Versioning

Advanced notice will be given if backward-incompatible breaking changes are planned.

For minor API versions and release notes, consult the Updates page.