Import records into a REDCap longitudinal project via the API with instrument-event mapping validation

domain: project-redcap.org (REDCap API documentation) · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. First export the project's instrument-event mappings via action=export, content=formEventMapping to confirm which instruments are assigned to which events in each arm
  2. Structure the import payload as a JSON array where each object contains record (record ID), redcap_event_name (unique event name), and field values; include redcap_repeat_instance for repeating instruments
  3. POST with content=record, action=import, format=json, type=flat, overwriteBehavior=normal (or overwrite to replace existing values) and data containing the serialized JSON array
  4. Check the API response for the count of records imported and inspect any errors array for field-level validation failures before committing downstream processes
  5. For branching-logic fields, ensure dependent fields are included only when their branching condition is met; the API does not enforce branching logic but mismatched data may cause discrepancies in reports
  6. After import, call content=generateNextRecordName to auto-generate the next record ID if the project uses auto-numbering, ensuring sequential record IDs

Known gotchas

Related routes

Export records from a REDCap project via the REDCap API including longitudinal event data
project-redcap.org (REDCap API documentation) · 6 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans