Node.js example showing how to search the SEC EDGAR database
If you're new to Node.js, check out the beginner's guide here: https://nodejs.dev/learn
First, install our Node.js SDK by typing the following command in your terminal:
npm install sec-api
Copy/paste the example code below and replace YOUR_API_KEY
with your API key.
Node.js
1
//
2
// Query API Example
3
//
4
const { queryApi } = require('sec-api');
5
6
queryApi.setApiKey('YOUR_API_KEY');
7
8
const query = {
9
query: 'formType:"10-Q"', // get most recent 10-Q filings
10
from: '0', // start with first filing. used for pagination.
11
size: '10', // limit response to 10 filings
12
sort: [{ filedAt: { order: 'desc' } }], // sort result by filedAt
13
};
14
15
const filings = await queryApi.getFilings(query);
Next, execute the script by typing
node index.js