HomeGuidesSamplesAPI
API

Data Feeds

Retrieve all of your SafetyCulture data in a flat format.

General request format

Most of the data feeds contain date and time fields in their output, such as modified_at, modified_after, and modified_before.

When working with date and time in your requests, please ensure you're using the Internet Date-Time format: {year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z. For example, 2014-01-28T23:14:23.000Z.
More information here

General response format

All data feed APIs provide data in the following wrapper format:

{
  "metadata": {
    "next_page": "/feed/inspections?limit=20&completed=both&archived=both&modified_after=2014-12-06T00%3A37%3A02.837Z",
    "remaining_records": 114642
  },
  "data": [
     {
      "id": "audit_8E2B1F3CB9C94D8792957F9F99E2E4BD",
      "name": "",
      "archived": true,
      "owner_name": "Joe Bloggs",
      "owner_id": "user_38336063a03611e3aaf5001b1118ce11",
      "author_name": "Joe Bloggs",
      "author_id": "user_38336063a03611e3aaf5001b1118ce11",
      "score": null,
      "max_score": 107,
      "score_percentage": null,
      "duration": 61,
      "template_id": "template_3FF54D8127644FE699C2914981E11BEF",
      "template_name": "General Workplace Inspection",
      "template_author": "Anonymous",
      "date_started": "2014-01-28T23:14:23.000Z",
      "date_completed": null,
      "date_modified": "2014-01-28T23:15:24.000Z",
      "created_at": "2014-01-28T23:14:23.000Z",
      "modified_at": "2014-01-28T23:14:23.000Z",
      "document_no": null,
      "prepared_by": null,
      "location": null,
      "conducted_on": "2014-01-28T23:14:23.000Z",
      "personnel": null,
      "client_site": null,
      "web_report_link": "https://app.safetyculture.io/report/audit/audit_8E2B1F3CB9C94D8792957F9F99E2E4BD"
    },
    {},
    {}
  ]
}

The next_page path MUST be used to fetch the next page of data. Do not construct this yourself as it's subject to change and may result in your exports failing in the future.

If next_page returns null, that means there are no more records to fetch.

See the following API usage example:

async fetchInspections() {
  // Only fetch inspections that have been updated
  const lastModifiedAt = await store.getLastModifiedAt('inspections');

  let path = `/feed/inspections?modified_after=${lastModifiedAt.toISOString()}`

  while(url) {
    const response = await get(`https://api.safetyculture.io${path}`);
    await store.saveRows(response.data);

    // next_page will be null when there is no more data to be fetched
    path = response.metadata.next_page;
  }
}