Sweat & Toil

Sweat & Toil

Open Data

Integrates information on child labor and forced labor taken from the reports “Findings on the Worst Forms of Child Labor,” “List of Goods Produced by Child Labor or Forced Labor,” and “List of Products Produced by Forced or Indentured Child Labor.”

Visit API

📚 Documentation & Examples

Everything you need to integrate with Sweat & Toil

🚀 Quick Start Examples

Sweat & Toil Javascript Examplejavascript
// Sweat & Toil API Example
const response = await fetch('https://developer.dol.gov/others/sweat-and-toil/', {
    method: 'GET',
    headers: {
        'Content-Type': 'application/json'
    }
});

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

Introducing the Sweat & Toil API

The Sweat & Toil API is a public API that provides access to data on workplace conditions, including hours worked, safety violations, and more. This API is maintained by the US Department of Labor.

In this blog, we will explore various examples of how you can use this API in your JavaScript applications. We will cover the basic structure of the API and provide example code for each API endpoint.

Getting Started

Before we can start using the Sweat & Toil API, we need to obtain an API key. You can get your API key by visiting the Sweat & Toil API website, and signing up for an account.

Once you have your API key, you can start making requests to the API endpoints.

Examples

Hourly Earnings by Occupation

This API endpoint returns the hourly earnings by occupation. Here's an example code snippet that demonstrates how you can use this API endpoint in your JavaScript code:

const apiKey = 'YOUR_API_KEY';
const url = `https://api.dol.gov/V1/sweatandtoil/statistics/earnings_by_occupation?apikey=${apiKey}`;

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

Work-Related Fatalities by Industry

This API endpoint returns data on work-related fatalities by industry. Here's an example code snippet that demonstrates how you can use this API endpoint in your JavaScript code:

const apiKey = 'YOUR_API_KEY';
const url = `https://api.dol.gov/V1/sweatandtoil/statistics/fatalities_by_industry?apikey=${apiKey}`;

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

Average Weekly Hours by Industry and Gender

This API endpoint returns data on the average weekly hours worked by industry and gender. Here's an example code snippet that demonstrates how you can use this API endpoint in your JavaScript code:

const apiKey = 'YOUR_API_KEY';
const url = `https://api.dol.gov/V1/sweatandtoil/statistics/hours_by_industry_gender?apikey=${apiKey}`;

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

Conclusion

In this blog, we have explored the Sweat & Toil API and provided examples of how you can use this API in your JavaScript applications. To learn more about the API, be sure to check out the documentation on the Sweat & Toil API website.

📊 30-Day Uptime History

Daily uptime tracking showing online vs offline minutes

Jul 6Jul 8Jul 10Jul 12Jul 14Jul 16Jul 18Jul 20Jul 22Jul 24Jul 26Jul 28Jul 30Aug 1Aug 404008001440Minutes
Online
Offline

Related APIs in Open Data