BusinessUSA

BusinessUSA

Government

BusinessUSA gives developers access to authoritative information on U.S. programs, events, services and more. USA.gov uses GitHub repositories to maintain the documentation for most of our APIs and data feeds. Using GitHub, you can easily provide feedback to us and ask questions using each repository's issue tracker. You can also email us any questions you might have regarding our APIs. USA.gov offers a variety of APIs and data feeds to help developers access and expose quality government information and services from their own websites and applications.

Visit API

📚 Documentation & Examples

Everything you need to integrate with BusinessUSA

🚀 Quick Start Examples

BusinessUSA Javascript Examplejavascript
// BusinessUSA API Example
const response = await fetch('https://business.usa.gov/developer', {
    method: 'GET',
    headers: {
        'Content-Type': 'application/json'
    }
});

const data = await response.json();
console.log(data);

Using Public API Docs in JavaScript with https://business.usa.gov/developer

The https://business.usa.gov/developer API provides a range of business-related information to developers including industry data, government business opportunities, and finance information. In this blog, we will explore how to use this public API in JavaScript with examples.

Getting Started

To get started, you will need to request an API key. This key will allow you to access and use all of the APIs provided by https://business.usa.gov/developer. You can request a key by going to the API key request page and filling out the form. Once you have an API key, you can start making calls to the API.

Example API Calls

Getting Industry Data

Retrieving data from the Industry API endpoint is very straightforward. Here's how you can retrieve a list of industries:

const api_key = 'YOUR_API_KEY';
const api_url = 'https://api.data.gov/ed/industries/v1/industries/';
const api_params = { api_key: api_key };
const api_request_url = new URL(api_url);
api_request_url.search = new URLSearchParams(api_params);

fetch(api_request_url)
  .then(response => response.json())
  .then(data => console.log(data));

Getting Government Business Opportunities

Retrieving opportunities from the Government Business Opportunities API endpoint is also very straightforward. Here's how you can retrieve a list of opportunities:

const api_key = 'YOUR_API_KEY';
const api_url = 'https://api.sam.gov/prod/opportunities/v1/search/';
const api_params = { api_key: api_key };
const api_request_url = new URL(api_url);
api_request_url.search = new URLSearchParams(api_params);

fetch(api_request_url)
  .then(response => response.json())
  .then(data => console.log(data));

Getting Finance Information

Retrieving finance information from the Finance API endpoint is a bit more complicated. You will need to send a POST request to the API, along with a JSON payload containing your search criteria. Here's how you can retrieve a list of finance-related information:

const api_key = 'YOUR_API_KEY';
const api_url = 'https://api.usa.gov/business-finance/v2/finance/';
const api_params = { api_key: api_key };

const api_request = {
  api_endpoint: 'get_financial_statement_details',
  sic_seed: '5812',
  assets_range: {
    gt: 100000,
    lt: 500000
  },
  zip_seed: '94115'
};

const api_options = {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify(api_request)
};

fetch(api_url, api_options)
  .then(response => response.json())
  .then(data => console.log(data));

Conclusion

Using public API docs in JavaScript can be a lot of fun and it provides values to developers. In this blog, we've explored how you can use the https://business.usa.gov/developer API. With these examples, you can start building amazing applications that help businesses.

📊 30-Day Uptime History

Daily uptime tracking showing online vs offline minutes

Jul 9Jul 11Jul 13Jul 15Jul 17Jul 19Jul 21Jul 23Jul 25Jul 27Jul 29Jul 31Aug 2Aug 4Aug 704008001440Minutes
Online
Offline

Related APIs in Government