How to use API / Data Entry Trigger?

API (Application Programming Interface) 

REDCap API (Application Programming Interface) allows external applications to connect to REDCap remotely and is used for programmatically retrieving or modifying data or settings within REDCap, such as performing automated data imports/exports from a specified REDCap project.

REDCap's User Rights allows for individuals to have the ability to request an authentication token. This token is specific to the user and acts as a unique identifier for communication with an external source. An API token is the form of authentication similar to a username/password. User's with API rights can develop code to for an external source to communicate directly with a project. Content parameters are used to inform the type of request (Import or Export) you are making. The API can be used to move any type data, including files (i.e. import files to specific record).  Finally, a format field tells the API in what format you want the response.  The default format is a CSV string.  

*Note:  NEVER publicize your Project token. This is similar to a password for the project.

API tokens can be set 3 different directions:

  1. REDCap to external source
  2. External source to REDCap
  3. Both REDCap & external source have 2-way communication

To use the REDCap API, you must know the following:

  • The API URL for your site's REDCap installation.

  • The API token for your Project. A token is generated by the REDCap administrators and connects your user account to a particular REDCap Project.

To request an API token for your project. 

  1. Authorize People: To adjust user rights, access the User Rights tool via the menu on the left side of the REDCap screen.  In the Basic User Rights section, click API Export or API Import.




2. User with API rights logs in to generate API option under "Applications".  Request API token.


Data Entry Trigger

The Data Entry Trigger is an advanced feature. It provides a way for REDCap to trigger a call to a remote web address (URL), in which it will send a HTTP Post request to the specified URL whenever *any* record or survey response has been created or modified on *any* data collection instrument or survey in this project (it is *not* triggered by data imports but only by normal data entry on surveys and data entry forms). Its main purpose is for notifying other remote systems outside REDCap at the very moment a record/response is created or modified, whose purpose may be to trigger some kind of action by the remote website, such as making a call to the REDCap API.

Examples of data entry trigger use:

  • Log the activity of records being modified over time by a remote system outside REDCap.
  • Using the API data export to keep another system's data in sync with data in a REDCap project, in which the Data Entry Trigger would allow you to keep them exactly in sync by notifying your triggered script to pull any new data from at the moment it is saved in REDCap.