Beginner's Guide

To use the API you must register at https://devtools.dol.gov/developer and request an API key for each application that will access the API. Registration and API keys are free.

note: A separate API key is not necessary for each application, but if you reuse your key across multiple apps, your apps' metrics will be combined and of little value.

Registration process

  • Visit https://devtools.dol.gov/developer
  • Click the Register link.
  • Fill in the registration form and submit it.
  • A confirmation email will be sent to the address you provided during registration.
  • Click on the link in the email to activate your developer account.

API Key (Token) Creation Process

  • Visit https://devtools.dol.gov/developer
  • Go to the login page and enter your username and password
  • Click on the My Tokens link
  • Click "Create New Token"
  • Provide a Shared Secret, Application Name, and a Description
  • The token value will be auto-generated and added to your tokens list.

Accessing the API

The API is exposed as an OData producer, with the addition of request authorizations. We are providing SDK's for some platforms that abstract the OData and request signing process and provides you with an easy to use method call. Please visit the SDKs Page to learn more about the DOL Data SDKs.

Example Assume that you want to read data from the agencies table found in the dataset named DOLAgency. The request URL is:

http://api.dol.gov/V1/DOLAgency/Agencies

Your API Key (Token) is d9c6c290-da4c-424e-a378-fb4bd027b58z

note: This token is only an example. It is not usable.

Your direct link to Agency data using the input above is:

http://api.dol.gov/V1/DOLAgency/Agencies/?KEY=d9c6c290-da4c-424e-a378-fb4bd027b58z

Result Format

By default, the DOL V1 (api.dol.gov) API's responses are in XML format. To receive the data in JSON, send an "Accept" header with "application/json."

Accessing the API

The API is exposed as a RESTful interface. We require you to authenticate by placing your token in the header. We are providing SDK's for some platforms in order to provide you with an easy to use method call. Please visit the SDKs Page to learn more about the DOL Data SDKs.

Example Assume that you want to read data from the incidents table found in the OSHA Enforcement dataset. The request URL is:

https://data.dol.gov/get/inspection

Your API Key (Token) is d9c6c290-da4c-424e-a378-fb4bd027b58z

Your authentication header would contain the key/value of:

X-API-KEY: d9c6c290-da4c-424e-a378-fb4bd027b58z

Result Format

Data.dol.gov sends responses by default in JSON format. To customize the return format, simply add /format/xml or /format/json to the request URL. For example:

https://data.dol.gov/get/inspection/format/xml

Next Steps

Following the steps above will return the first 100 records. To retrieve more or to be more selective in the data that is returned, read on about accessing the API using HTTP requests.

How to Customize Your Request