U.S. flag

미국 정부 공식 웹사이트입니다

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..

alert - warning

이 페이지는한국어로(으로) 번역되지 않았습니다. 해당 언어의 리소스는 한국어 페이지를 방문해 주십시오.

OpenFEMA API Documentation

As part of the OpenFEMA initiative, FEMA is providing read-only API based access to data sets (Entities). The data is exposed using a RESTful interface that uses query string parameters to manage the query. This document provides information on how to use the API including command examples. The examples shown are HTTP requests. Other methods such as CURL or accessing with a programming language can also be used. See the Developer Resources page for additional information.

A full list of Entities/endpoints supported by the API can be found at Data Feeds.

Major and minor version features (including the addition or deprecation of datasets) can be found on the Changelog page.

Basics

The base path for the API endpoints is https://www.fema.gov/api/open.

To use the API, you will need to build a query string path in the following format:

[base path]/[version]/[entity]

  • version:  To support future enhancements we are using a versioning system for the APIs. To use the APIs you must indicate which version you need. The API version format is v1, v2, v3, etc.
  • entity: This corresponds to the name of the entity set you are requesting. The entity names can be found in the list of released data sets.

Example: https://www.fema.gov/api/open/v1/DisasterDeclarationsSummaries

Query strings including the data set/endpoint name are case sensitive.

A successful response will include a both a metadata object (described below) and an array of entity objects (records). By default, only 1,000 records are returned. See the URI commands below for information on how to page through all found records.

URI Quick Reference

CommandDescriptionDefault
$callbackTo specify the call back function name for retrieving data in JSONP format. 
$filenameTo specify the download filename. 
$filterTo filter or limit the results returned.All records up to $top returned
$formatTo specify the format of the returned data.JSON
$inlinecountOption to specify if a total entity count should be returned with the query.none (the count is not returned)
$metadataControls the presence of the metadata object in data set returns.on (metadata is returned)
$orderbySort the returned data. 
$selectTo specify the fields to return.All fields returned
$skipNumber of records to skip from the dataset.0
$topLimit the number of records returned.1,000

URI Commands Reference

A Uniform Resource Identifier (URI) is a string of characters identifying an abstract or physical resource on the web. This can be a URL to a website; it can also be identify a specific resource as well as a location. The following URI commands can be used to alter your request of OpenFEMA endpoint data – filtering the result, specifying a return type, or including additional metadata.

Search

Performs a search of the entity using specified query string parameters.

Query String Parameters

$callback

DEPRECATED. Allows you to specify the call back function name for retrieving data in JSONP format.

Example

$filename

Allows for the specification of a download filename. The data downloaded will be limited to fields specified using $select (all fields if none specified), will contain records limited by $filter, and will be sorted according to the $orderby parameter. Note, all of the $filter, $orderby, and $select parameters will work with $filename. The filename should not be surrounded by quotation marks even if the filename contains spaces. If no $format parameter is specified, JSON will be the result.

Example

$filter

Used to "filter" the results returned. The API provides a number of operations that can be used to build your request. The API provides as subset of the available options in the OData specification. Please note that dates should be represented in an ISO-8601 format.

Logical Operators:

OperatorDescriptionExample
eqEqual/DisasterDeclarationsSummaries?$filter=state eq 'VA'
neNot equal/DisasterDeclarationsSummaries?$filter=state ne 'VA'
gtGreater than/DisasterDeclarationsSummaries?$filter=declarationDate gt '1969-04-18T04:00:00.000z'
geGreater than or equal/DisasterDeclarationsSummaries?$filter=disasterNumber ge 4000
ltLess than/DisasterDeclarationsSummaries?$filter=declarationDate lt '2013-01-01T04:00:00.000z'
leLess than or equal/DisasterDeclarationsSummaries?$filter=disasterNumber le 100
andLogical and/DisasterDeclarationsSummaries?$filter=declarationDate ge '2010-01-01T04:00:00.000z' and state eq 'VA'
orLogical or/DisasterDeclarationsSummaries?$filter=state eq 'VA' or state eq 'NY'
notLogical negation/DisasterDeclarationsSummaries?$filter=not substringof(title,'OO')

Grouping Operators:

This represents logical operator grouping, not data aggregation.

OperatorDescriptionExample
( )Precedence grouping/DisasterDeclarationsSummaries?$filter=(state eq 'VA' and declaredCountyArea eq 'Alleghany (County)') or disasterNumber eq 1570

String Functions:

To enable filtering on partial strings.

FunctionExample
bool substringof(string searchString, string searchInString)/DisasterDeclarationsSummaries?$filter=substringof('OO',title)
bool endswith(string string, string suffixString)/DisasterDeclarationsSummaries?$filter=endswith(title,'ING')
bool startswith(string string, string prefixString)/DisasterDeclarationsSummaries?$filter=startswith(title,'FLO')

Special Functions:

To permit searching within objects, including geospatial operations.

FunctionExample
containsOnly applies to searchable objects and arrays. Use the string functions for identifying fields that contain a string being sought. /IpawsArchivedAlerts?$filter=contains(info/eventCode,'{"SAME": "CAE"}')
geo.intersectsPermits querying against a geospatial enabled dataset. The entity/field/object to be searched is passed along with a bounding polygon or a point. The syntax for the polygon must be in the format of the example. Replace the coordinates with your own polygon coordinates in WKT (Well Known Text) format. /IpawsArchivedAlerts?$filter=geo.intersects(searchGeometry, geography 'POLYGON((34.38 -86.65,34.2 -86.72,34.31 -86.99,34.4 -86.94,34.38 -86.65))')

$format

Controls the format of the returned data.

Supported values include:

  • json - Returns data in the JavaScript Object Notation format (default)
  • csv - Returns data in a Comma-Separated Value format * Metadata is not returned when using CSV format

Example

$inlinecount

Query options that controls if a total count of all entities matching the request MUST be returned as part of the result.  Note, if the $inlinecount parameter is not supplied, no count will be returned; it will appear as “0”.

Valid values are:

  • allpages - Returns the count
  • none - Does not return the count (default)

Example

$metadata

Controls the presence of the data set metadata object with a returned data set. Note, only applies if the format is JSON.

Supported values include:

  • on – Returns the metadata object for data returned in a JSON format (default)
  • off – Suppresses the metadata object for data returned in a JSON format

Example

$orderby

Allows for the sorting of data on the server. By providing a comma separated list of fields and a sort direction you can control the order that data is returned. Available sort directions are “asc” and “desc” for ascending or descending respectively. If no direction is provided, ascending is the default.

Example

$select

Used to specify which fields you would like returned in your dataset. Providing a comma separated list of case sensitive field names will return just those fields with the addition of _id. This field is returned for all records and is the unique ID for that record. If no value is specified, all of the fields are returned.

Example

$skip

Number of records to skip from the dataset. Used in conjunction with $top to allow you to page through the dataset. If no value is specified, $skip defaults to 0 and starts at the beginning of the results set.

Example

$top

Limits the number of records returned. Currently the default and maximum value is 1,000 records.

Example

Get By ID

Retrieves a specific record identified by its ID field (_id).

Query string format is:

/api/open/[version]/[entity]/[_id]

  • version:  To support future enhancements we are using a versioning system for the APIs. To use the APIs you must indicate which version you need. The API version format is v1, v2, v3, etc.
  • entity: This corresponds to the name of the entity set you are requesting. The entity names can be found in the list of released data sets.
  • _id - This is a _id value of a previously identified record in an entity.

Query String Parameters

$callback

DEPRECATED. Allows you to specify the callback function name for retrieving data in JSONP format.

Example

$format

Controls the format of the returned data.

Supported values include

  • json - Returns data in the JavaScript Object Notation format (default)
  • csv - Returns data in a Comma-Separated Value format

Example

Metadata

A successful response will include a metadata object along with the array of entity objects. Most of the metadata corresponds to the URI commands and parameters specified above. The metadata object can be suppressed by using the $metadata parameter.

MetadataDescription
skipNumber of records skipped as specified by the $skip parameter. If the $skip parameter was not used, this value will be 0.
topMax number of records returned as specified by the $top parameter. If the $top parameter was not used, this value will be 1,000.
countCount of all possible records found matching any provided criteria. If the $inlinecount parameter was not used, or “none” was specified, this value will be 0. If the count returned is greater than 1,000, you will need to implement a paging strategy to return all the records that match the criteria specified.
filterFilter values applied as specified by the $filter parameter.
formatFormat of the data as specified by the $format parameter. If none specified, the format will default to JSON.
metadataIndicates if the metadata object suppression parameter has been specified.
orderbySort order for the data as specified by the $orderby parameter.
selectFields specified for return as specified by the $select parameter.
entitynameName of the entity or endpoint for which data was queried.
versionThe API endpoint version used to return the data.
urlThe fully composed URL used to return the data.
rundateThe date and time when the API call was executed.
depDate(optional) Only appears when the data set has been deprecated. Indicates that the data set has been deprecated and will be removed by this date.
depApiMessage(optional) Only appears when the data set has been deprecated. Provides additional information about the deprecation of the data set.
depNewURL(optional) Only appears when the data set has been deprecated. Provides a link to an API endpoint that will supersede this dataset (if one exists).

See Also