Before you start
Use a dedicated reporting key with responses:read and collection:read, scoped to the intended groups. Set DATUMFORMS_GROUP_ID from groups.list. Download the matching client beside the script.
Python: CSV
import csv, json, os
from client import get
group=int(os.environ['DATUMFORMS_GROUP_ID'])
after=0
with open('responses.csv','w',newline='',encoding='utf-8') as output:
writer=csv.writer(output)
writer.writerow(['response_id','group_id','version_id','revision','status','submitted_at','answers_json','collection_details_json'])
while True:
page=get('responses.list',group_id=group,after_id=after,include_collection_details=True)
for r in page['responses']:
writer.writerow([r['id'],r['collection_id'],r['version_id'],r['revision'],r['status'],r.get('submitted_at'),json.dumps(r['answers']),json.dumps(r.get('collection_details'))])
after=page['next_cursor']
if after is None: break
print('Saved responses.csv')
The answer and metadata objects remain JSON within quoted CSV cells, preserving matrices and version context. For human-readable wide Excel columns, use the application Excel export.
JavaScript: newline-delimited JSON
import {createWriteStream} from 'node:fs';
import {once} from 'node:events';
import {get} from './client.mjs';
const groupId=Number(process.env.DATUMFORMS_GROUP_ID);
if (!groupId) throw Error('Set DATUMFORMS_GROUP_ID');
const output=createWriteStream('responses.ndjson',{encoding:'utf8'});
let after=0;
do {
const page=await get('responses.list',{group_id:groupId,after_id:after,include_collection_details:true});
for(const r of page.responses) if(!output.write(JSON.stringify(r)+'\n')) await once(output,'drain');
after=page.next_cursor;
} while(after!==null);
output.end();await once(output,'finish');
console.log('Saved responses.ndjson');
cURL
Run the paginated cURL reader with jq installed and redirect standard output: sh read-responses.sh > responses.ndjson.
Check the result
Reconcile unique response IDs and retain version_id and revision. Open a sample record and confirm answer cells and collection context. Treat multi-page API reads as an evolving read; ordinary responses may be edited during collection. Files remain protected attachments, not embedded file bytes in this JSON.
Troubleshooting
For missing rows, check group restrictions, filters and submission. For a metadata 403, use the dedicated group-scoped key without question restrictions. Read schemas and handle pagination.