Skip to main content

Developer resources

FOIA API

The FOIA request Portal is powered by an API. This API is available to the public. In order to use the API, you must signup for an API key.

Agency components

Agencies of the federal government submit information about their FOIA process in a machine-readable format to the Portal. This information is availble through the Agency component API. This API follows the JSON API standard and leverages the Drupal JSON API module. The documentation for the JSON API module is a great resource.

The endpoint for the Agency component API.

https://api.foia.gov/api/agency_components

An agency component payload might look like this.

Examples

Request a list of agency components names.

curl -g -v -H 'X-API-Key: <your-api-key>' 'https://api.foia.gov/api/agency_components?_format=api_json&fields[agency_component]=title'

Fetch a list of agency components with their parent agency.

curl -g -v -H 'X-API-Key: <your-api-key>' 'https://api.foia.gov/api/agency_components?_format=api_json&include=agency&fields[agency]=name,abbreviation&fields[agency_component]=title,abbreviation,agency'

Fetch the Office of Information Policy.

curl -g -v -H 'X-API-Key: <your-api-key>' 'https://api.foia.gov/api/agency_components/8216158f-8089-431d-b866-dc334e8d4758?_format=api_json'

Fetch the Office of Information Policy’s FOIA request form.

curl -g -v -H 'X-API-Key: <your-api-key>' https://api.foia.gov/api/agency_components/8216158f-8089-431d-b866-dc334e8d4758/request_form

Submission

You can submit a FOIA request using our API. The endpoint for the submission API:

https://api.foia.gov/api/webform/submit?_format=json

You’ll need to identify the request form you are submitting to using the Agency component API and provide any relevant data to Agency.

Get the Office of Information Policy’s form id.

$ curl -H 'X-API-Key: <your-api-key>' https://api.foia.gov/api/agency_components/8216158f-8089-431d-b866-dc334e8d4758/request_form | jq '.data.attributes.id'
"test_form"

Note that each agency may require different information based on their regulations. You can see what information is being requested by looking at their webform elements. Check the element’s properties to determine which fields are required.

$ curl -H 'X-API-Key: <your-api-key>' https://api.foia.gov/api/agency_components/8216158f-8089-431d-b866-dc334e8d4758/request_form | jq '.data.attributes.elements | keys'
[
  "address_city",
  "address_country",
  "address_line1",
  "address_line2",
  "address_state_province",
  "address_zip_postal_code",
  "attachments_supporting_documentation",
  "company_organization",
  "email",
  "expedited_processing",
  "expedited_processing_explanation",
  "fax_number",
  "fee_amount_willing",
  "fee_waiver",
  "fee_waiver_explanation",
  "name_first",
  "name_last",
  "phone_number",
  "request_category",
  "request_description"
]

Submit a request to the Office of Information Policy.

curl -v -H 'X-Api-Key: <your-api-key>' -H 'Content-Type: application/json' https://api.foia.gov/api/webform/submit?_format=json --data-binary @- <<EOF
{
    "id": "test_form",
    "email": "george@example.com",
    "name_first": "George",
    "name_last": "Washington",
    "request_description": "A very specific description of records."
}
EOF

The FOIA XML Schema

Federal agencies publish FOIA information in accordance with guidelines prepared by the U. S. Department of Justice Office of Information Policy. These guidelines, available here, describe the format and meaning of FOIA annual report information. In addition, a FOIA Annual Report XML schema has been developed allowing agency FOIA annual report information to be represented and exchanged in a standardized format. This XML schema closely follows the structure and terminology of the guidance document, and conforms to the NIEM standard (http://niem.gov). 

All agency data available through reports and graphs on the FOIA.gov website is also available for public download as XML documents conforming to the FOIA Annual Report XML schema at the link below. This enables any kind of offline processing, storage, comparison, or mashup which may be desired.  

The entire IEPD package may also be downloaded directly by clicking on the following link [Download IEPD].

FOIA Data Set Downloads

The following compressed files are complete archives of the FOIA Data sets for the years 2008 through 2017.

Agency resources

If your agency is interested in receiving requests from the Portal via an API, please check out our API spec and get in touch with us.

FOIA Contacts Download

The following file is the complete listing of all FOIA contacts across federal departments and agencies.

Return to Top