Virginia business leads for pennies
Tags: secretaryofstateapi, interestingbusinessd, secretaryofstate
Published: 2021-11-23 13:34:05

---
title: Virginia business leads for pennies
published: true
date: 2021-10-11 06:31:00 UTC
tags: SecretaryofStateAPI,interestingbusinessd,secretaryofstate
canonical_url: https://cobaltintelligence.com/blog/getting-interesting-business-data-va-and-sos-api/
---

<iframe loading="lazy" title="Virginia business leads for pennies" width="640" height="360" src="https://www.youtube.com/embed/b13nm20xtEA?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

[Demo code](https://github.com/cobalt-intelligence/va-sos-and-sos-api)

The goal is to get some great, targeted Virginia business leads for pennies.

Here we gooooooooooooooo!

## Virginia Secretary of State Search

[![Virginia secretary of state search](https://cobaltintelligence.com/blog/wp-content/uploads/2021/10/image-1024x767.png)](https://cobaltintelligence.com/blog/wp-content/uploads/2021/10/image.png)

The [Virginia Secretary of State search](https://cis.scc.virginia.gov/EntitySearch/Index#) is incredibly robust. Look at all of the awesome search options you have.

The options I tend to use are searching by “Contains”, changing the “Entity Status” to “Active”, and possibly changing the “Date of Formation” range.

Searching a large amount will bring up a prompt that asks if you want to few all results. You definitely want to say “yes” to this! It will take longer to load but you want all of the results.

[![](https://cobaltintelligence.com/blog/wp-content/uploads/2021/10/image-1.png)](https://cobaltintelligence.com/blog/wp-content/uploads/2021/10/image-1.png)

Once you see the results, you’ll want to go down to where the magic happens, **the export to CSV button.**

Click it and it will start working on your download. The bigger the list the longer it takes to process and download. But I have downloaded 10s of thousands of businesses without any problem.

## To the code!

This is the part where it’s going to take a little bit of code. You will need to download [git](https://git-scm.com/downloads) and [Nodejs](https://nodejs.org/en/download/) in order to make this work and not be too intimidated by code. It also would be helpful to have some kind of code editor, such as [VS Code](https://code.visualstudio.com/download).

Once you have those go sign up for a free API key [here](https://cobaltintelligence.com/secretary-of-state). Right now Cobalt Intelligence gives 100 free requests per month and after that it’s very inexpensive for additional requests.

Now, clone the code from the [github respository](https://github.com/cobalt-intelligence/va-sos-and-sos-api), install all dependencies with `npm i`, and open the code in VS code.

Once you’ve signed in you’ll have an API key. Copy it from here:

[![](https://cobaltintelligence.com/blog/wp-content/uploads/2021/10/image-2.png)](https://cobaltintelligence.com/blog/wp-content/uploads/2021/10/image-2.png)

With that API key, we’ll want to open `.sample.env` and replace the dummy API key in there with your actual API key.

[![](https://cobaltintelligence.com/blog/wp-content/uploads/2021/10/image-3.png)](https://cobaltintelligence.com/blog/wp-content/uploads/2021/10/image-3.png)

Now copy the file you downloaded from the Virginia Secretary of State into the base folder of the repository we cloned above. Change the file name in `src/index.ts` in this line (it’ll be towards the top) `const businesses = await csvtojson().fromFile('pizza businesses.csv');` to be whatever your file name is that you downloaded (probably something like “Search Results.csv”).

If you want to get fancy, you can also change the ouput file name towards the bottom where it says `fs.writeFileSync('Full pizza businesses found.csv', csv);` to whatever you want your csv file to be named.

Now…just run `npm start`. It’ll take some time to process the whole file depending on how many results you have. I wouldn’t be surprised if it was 7-10 seconds per business in that list. It will log out it’s progress as it goes with each business it finds.

## Conclusion

Once it’s complete you’ll have a newly created file full of emails and phone numbers.

What now?

Well, reach out to them! Make their lives better with your awesome product!

![](https://media.giphy.com/media/Q81NcsY6YxK7jxnr4v/giphy.gif)

Video Transcript:

All right. Good morning. Um, hello, how you doing? I’m Jordan Hanson. I’m from cobalt intelligence. Today. We are going to show some cool tricks of how to get some cool business data from the Virginia secretary of state. And if you combine it with the cobalt intelligence secretary of state API, you can get cool contact information.

Um, now again, this is where it is. You need API key I’m over here. You will need an API key to be able to do this today. Um, you can get a free API. It comes with a hundred requests per month. Um, so let’s go over here to Virginia and show how this works. Okay. So Virginia is a cool state that allows you to do cool things like their search is really good.

Um, you can search by all bunch of different things. And today I’m going to search by, let’s say, I’m going to search by contains. I’m going to search by, I would say, really have a product that’s really good for, uh, video games. Let’s see how many businesses have video. You’re gaming, maybe in the title, let’s see, it’s a C and I want them to be active.

I want these businesses that are active right here. So you can search, you can search word. I want, which by industry now they’re industry, most people it’s, whatever the individual selects. So a lot of times they just put general. Um, but they have other ones too. There’s insurance, other things like that. So that’s what that video gave me.

We’re going to look for one that has like 10, we’re looking for a small one just for it to show the sample. But like, I’ve done this with thousands before. You can do it without any problems. So it takes a little bit of time for, to search. But what we’re going to do, and I’m going to have the code. I have the code over here, what we’re going to do.

And, um, we’re going to, uh, this could be public. We’ll have the repository out there so you can really just clone it, put your API key in it and run it. Okay. Well, we have one. I wanted more than that. That’s go a little more. Let’s get more than that. What we’ll do is we’ll go like. Pizza and we’ll do it. We want him to have the word pizza and it’s going to be active and we’re going to formation data of in the last, um, since August 1st of this year.

So two months and see how big we get. We do have a fair amount. 26. Okay. 26. Now look at the bottom here. This is the cool part. And then here, you can see, you can see the export buttons right here. Now we want to export to a CSV. So this is cool. This will give us a list of all the businesses in a CSV, and you can download all of them.

Like it says it’s limited to 5,000 records export, obviously for PBS. So I’ve exported thousands. You can have 11,000 records, whatever. Any of that that’s put over here, we’re going to go like this. There’s our results. See. All the cool pizza companies right here. And then what we’re going to do

is we’re gonna come over here and we’re going to rename it to, um, pizza, pizza businesses

right there, and then we’re gonna call it what’d I call that yeah. Pizza businesses, all lower case. Uh, businesses. Okay. So then I got my list. So we’re going to come over here. We’re going to use this package called CSP. The J shot. Jason wants me to take the CSV. It’s going to convert it into an array of Jason objects, and then we’re going to come down.

It’s going to loop through the businesses. Uh, first we’re initialized the API, which we’ve, um, there’s going to be, I have loads of guides of how to use the API, but we’re going to import it from the cobalt and SDK. I’m a pass in my API key. I started here then loop through these businesses and each one I call the API key and I get to get details by SOS ID.

Now, inside that thing, you can see, we have a entity ID right here, uh, and to ID, right. So we’re looping through we’re passing business entity ID and a state, which is Virginia. Now the cool thing about Virginia, the secretary of state, we can get emails and phone numbers for these items, these places that are really good.

So let’s run it here and see what we get. So we have 26. It might take a little bit, um, we’ll run it right now. We’ll say, Hey for pizza businesses bound and we’ll go MPM start. Oh, we probably don’t have it. Hold on. Let me read my script here. Yeah, this is a brand new start and we’ll write about TSC and present ampersand node, this index just like that.

And then we’re going to run it. Now. This will start parsing through this data. Okay. Just kidding. All the time I get it spelled right. I literally spelled it with. How does pizza businesses? I should’ve just left it and we named it cause that style right there, busy misses. All right. So at 26, it’s going to go through a loop through them.

That’s a whole, we have, now there is some way for advanced people. You can go ahead and do some kind of asynchronous where you can fire up multiple ones, but band looks, you were already going by phone numbers, email addresses right here. There. Email justice. So we can call, you can contact these people and reach out.

Let’s say we have a really good product for them. Let’s say we want to order pizza from them. We want to check out all these different things with pizza, whatever. Right. So we’ll loop through each one I haven’t set up. So if it has an email and the email is not this N a um, then I’m going to go ahead and push it into my full businesses.

And then after that, I’m going to put it into this array, but I’m going to convert it to CSV and then put it right into a file. That’s it pretty simple, the very simple way to get in there, get some cool business data for me. What am I doing? Cool business data for Virginia, any industry you’re looking for, insurance, software financing, whatever, what accounting, any of those things, you can get a huge list of them.

Get email addresses. This is a cool way to do it. So that’s it. This will finish up. It’ll create the CSV. I kinda it’s gotta be close. How many things we’ve done.

Oh yeah. We’re close to the end. I think we have multiple of these. Oh, maybe let’s see. Sergeant Pepper’s pizza. Oh yeah. We’re close here. 16. So of those 26, we had 16 with good email addresses and now we could talk to them and we doubt and say, Hey, we’ve got this awesome thing we want to talk to you about.

And we go from there and that, and then we create Lexi right here. Bold pizza businesses. All creative with phone numbers, email addresses. We’re good to go. So that’s it. And this again, this is Jordan Hanson, cobalt intelligence. If you need an API key, go here to cobalt intelligence, get one and, um, uses data.

Hopefully you can find some really cool stuff. Thanks.

The post [Virginia business leads for pennies](https://cobaltintelligence.com/blog/getting-interesting-business-data-va-and-sos-api/) appeared first on [Cobalt Intelligence](https://cobaltintelligence.com/blog).