U.S. flag

An official website of the United States government

Dot gov

Official websites use .gov
A .gov website belongs to an official government organization in the United States.

Https

Secure .gov websites use HTTPS
A lock () or https:// means you’ve safely connected to the .gov website. Share sensitive information only on official, secure websites.

Was this page helpful?

Commerce.gov API

As "America's Data Agency," the Department of Commerce is prepared and well-positioned to foster the next phase in the open data revolution. But we cannot do it alone. We need your help. We invite you to use our content API to enhance the value, accessibility and usability of Commerce data for government, business and the public.

Below you will find the documentation for how to access and use our content API. For a prompt response to any question, request or idea for improvement related to this API, please submit an issue to our Github repository. Alternatively, you can email [email protected] and we'll get back to you within 5 working days.

Get Started

API key

API key is provided by api.data.gov. For full documentation on using your API key visit https://api.data.gov/docs/api-key/.

Loading signup form...

API basics

Commerce.gov content is exposed via a GET API available at https://api.commerce.gov/api/

Resources
Endpoint What it does
/api/blogs Provides blog content entries and fields
/api/news Provides newsroom content entries and fields
/api/image Provides image content with fields

The data results are stored in the data property of the JSON response, while jsonapi, self, next, first, and prev objects contain supporting information about the result set.

API Details

Returning documentation about the resource

This can be handled via a HTTP request with cURL or via a browser

  • cURL: Using an HTTP OPTIONS request, you can return machine structured documentation about a resource. To do so, send an OPTIONS request to the resource's root URL. The resource will respond with a JSON object that contains documentation for each field in the resource. Example below:
  • Browser: https://api.commerce.gov/api/blogs?api_key=DEMO_KEY

Field reference for all APIs
Field name Resource Description Type Cardinality
audience all Deprecated. Audience targeted by the entry null 1
admin_officials all Administrative Officials associated with the entry. Either an array of objects or null. Objects contain the fields id, label, href array unlimited
categories all Categories associated with the entry. Either an array of objects or null. Objects contain the fields id, label, href array unlimited
created all Date the entry was created in unix time (e.g. 1511376420) date 1
documents all Documents associated with the entry. Either an array of objects or null. Objects contain the fields id, label, href array unlimited
galleries all Deprecated. Galleries associated with the entry null 1
href all Canonical URI for single entry (content page or full size image) on website string 1
id all Deprecated. ID that matches either nid or mid depending on API type. Unique identifier for the entry. string 1
orgs all Organizations and Groups associated with the entry. Either an array of objects or null. Objects contain the fields id, label, href array unlimited
tags all Tags associated with the entry. Either an array of objects or null. Objects contain the fields id, label, href array unlimited
type all API method name (blog, image, news) string 1
updated all Date the entry was last updated in unix time (e.g. 1511376420) date 1
uuid all Unique identifier for the entry, stands for Unique Universal Identifier. string 1
Fields specific to Blogs API - https://api.commerce.gov/api/blogs?api_key=DEMO_KEY
Field name Resource Description Type Cardinality
body blog, news Main content body for the entry string 1
field_speaker blogs, image Speaker related to the entry. Either an array of objects or null. Objects contain the fields id, label, href array unlimited
image blog, news Image(s) associated with the entry. Either an array of objects or null. Objects contain the fields id, label, alt, height, filemime, width, copyright, title, created, href, filesize, styles, and caption. See image specific fields for more information. array unlimited
label blogs, news Title text for the entry (e.g. "Sample Entry"). string 1
nid blogs, news Unique identifier for the entry, stands for node ID. integer 1
post_date blogs, news Official post date for the entry in unix time (e.g. 1511376420) date 1
post_date_formatted blogs, news Official post date for the entry in YYYY-MM-DDThh:mm:ssP format. (e.g. 2017-11-22T13:47:00-05:00) date 1
related blog, news Other content related to the entry. Either an array of objects or null. Objects contain the fields id, label, href array unlimited
self blogs, news Self-referencing absolute URI to the entry string 1
teaser blog, news Deprecated. Short snippet about the entry string 1
video blog, news Video(s) associated with the entry. Either an array of objects or null. Objects contain the fields id, label, href array unlimited
Fields specific to Image API - https://api.commerce.gov/api/image?api_key=DEMO_KEY
Field name Resource Description Type Cardinality
alt image Alternate text for the image string 1
caption image Caption associated with the image string 1
copyright image Copyright info: USGW - U.S. government work; PDW - Public domain work; CCL - Creative Commons license; LSI - Licensed stock image; CW - Copyrighted work; INS - I'm not sure string 1
credit_line image Identifies the photographer, illustrator, or copyright holder for the image string 1
field_speaker blogs, image Speaker related to the entry. Either an array of objects or null. Objects contain the fields id, label, href array unlimited
filemime image Mime type of image, such as "image/jpeg" string 1
filesize image File size of image in bytes integer 1
height image How tall the original image size is in pixels. integer 1
image_perm_creator image Permission from image creator: WPO - Written permission obtained; INS - I'm not sure string 1
image_perm_individual image Permission from individuals in photo: WPO - Written permission obtained; VPO - Verbal permission obtained; INS - I'm not sure string 1
mid image Unique identifier for the entry, stands for media ID. integer 1
name image Title text for the image (e.g. "Sample File"). string 1
news_type image, news Deprecated. Classification of newsroom entry by type. Eg. "Press releases", "Reports", "Speeches", "Op-eds (Opinion editorials)" and "Fact sheets". null 1
styles image The three different styles that the image comes in including thumbnail, medium, and large. object 1
teaser image, news Deprecated. Short snippet about the entry null 1
title image The name of the file that was uploaded (e.g. "SampleFile.jpg"). string 1
width image How wide the original image size is in pixels. integer 1
Fields specific to News API - https://api.commerce.gov/api/news?api_key=DEMO_KEY
Field name Resource Description Type Cardinality
body blog, news Main content body for the entry string 1
image blog, news Image(s) associated with the entry. Either an array of objects or null. Objects contain the fields id, label, alt, height, filemime, width, copyright, title, created, href, filesize, styles, and caption. See image specific fields for more information. image unlimited
label blogs, news Title text for the entry (e.g. "Sample Entry"). string 1
news_type image, news Classification of newsroom entry by type. Eg. "Press releases", "Reports", "Speeches", "Op-eds (Opinion editorials)" and "Fact sheets". Each array contains 1 object with the following attributes: id, label, href array 1
nid blogs, news Unique identifier for the entry, stands for node ID. integer 1
post_date blogs, news Official post date for the entry in unix time (e.g. 1511376420) date 1
post_date_formatted blogs, news Official post date for the entry in YYYY-MM-DDThh:mm:ssP format. (e.g. 2017-11-22T13:47:00-05:00) date 1
publication news For Opinion Editorials only. Title and URL for original article published on external site. string unlimited
related blog, news Other content related to the entry. Either an array of objects or null. Objects contain the fields id, label, href array unlimited
release_status news One of three options indicating how a newsroom type - press release, report, speech, opinion editorial/fact sheet was released. FOR IMMEDIATE RELEASE, AS PREPARED FOR DELIVERY, AS DELIVERED. string 1
self blogs, news Self-referencing absolute URI to the entry string 1
speaker news For Speeches only. Speaker(s) associated with the entry. Either an array of objects or null. Objects contain the fields id, label, href array unlimited
subtitle news Sub-title for the newsroom entry. string 1
teaser image, news Deprecated. Short snippet about the entry. null 1
video blog, news Video(s) associated with the entry. Either an array of objects or null. Objects contain the fields id, label, href array unlimited

Changelog

  • 10/4/2019 - News v2.1, Blogs v2.1, Image v2.1: Reworked each API as an update was required to the underlying JSON API module. Several fields were updated to follow JSON best practices, such as changing the string "null" to null. Full details can be found here.
  • 11/9/2018 - News v2.0, Blogs v2.0, Image v2.0: Complete rewrite of the API to reflect the redesign of the Commerce.gov D8 website. API endpoints - news, blogs and image and their response fields preserved for backward compatibility. Advanced features such as returning specific fields, returning specific content, applying a query filter, applying a query sort, API versioning, and change request formatter are not available for this version. Fields with null values are returned as string with null value. Example "null".
  • 9/23/2016 - Image v1.0: Initial release of API resource endpoint for Images/Photos. Added image specific fields to field reference and updated resource column.
  • 12/5/2015 - News v1.0: Initial release of API resource endpoint for Newsroom content. Added newsroom specific fields to field reference and new column to show which fields are available for which content types.
  • 10/07/2015 - Documentation updated for additional query filter operators.
  • 10/05/2015 - Documentation updated to reflect query filter operator limitations and working example for simple filter on label field.
  • 09/29/2015 - Blog v1.0: Initial release includes API resource endpoint for Blog content only.
Bureaus and Offices
Tags