All endpoints accept JSON request bodies with Content-Type: application/json. You will need an experiment ID, which you get when you create an experiment on DataPipe. Code examples for jsPsych and JavaScript are available on each experiment's dashboard.
POSThttps://pipe.jspsych.org/api/data/
Save a text file (CSV, JSON, etc.) to your OSF project. If you have validation rules configured, the data will be checked before it is sent to the OSF.
| Field | Type | Description |
|---|---|---|
experimentID | string | Your experiment ID, found on the experiment dashboard. |
filename | string | Name for the file on OSF (e.g., subject01.csv). Must be unique ā the request will fail if a file with this name already exists. |
data | string | The file contents as a string. |
Example request body
{
"experimentID": "abc123",
"filename": "subject01.csv",
"data": "rt,response\n204,1\n389,0"
}POSThttps://pipe.jspsych.org/api/base64/
Save a binary file (audio, video, images) encoded as a base64 string. DataPipe decodes the string and stores the resulting file in your OSF project.
| Field | Type | Description |
|---|---|---|
experimentID | string | Your experiment ID. |
filename | string | Name for the decoded file on OSF (e.g., recording_01.webm). Must be unique. |
data | string | The base64-encoded file contents. |
POSThttps://pipe.jspsych.org/api/condition/
Get the next condition number for balanced assignment. Returns a value from 0 to nā1, cycling sequentially (0, 1, 2, ..., 0, 1, 2, ...).
| Field | Type | Description |
|---|---|---|
experimentID | string | Your experiment ID. |
Example response
{
"condition": 2
}All responses are JSON. A successful request returns { "message": "Success" }. The condition endpoint also includes a condition field. On failure, the response contains an error code and a message describing the problem.
| Error code | Meaning |
|---|---|
MISSING_PARAMETER | One or more required fields are missing from the request body. |
EXPERIMENT_NOT_FOUND | No experiment matches the provided ID. |
DATA_COLLECTION_NOT_ACTIVE | Data collection is not enabled for this experiment. |
BASE64DATA_COLLECTION_NOT_ACTIVE | Base64 data collection is not enabled for this experiment. |
CONDITION_ASSIGNMENT_NOT_ACTIVE | Condition assignment is not enabled for this experiment. |
SESSION_LIMIT_REACHED | The experiment has reached its session limit. Increase the limit in the dashboard. |
INVALID_DATA | The data did not pass the validation rules configured for this experiment. |
INVALID_BASE64_DATA | The data is not valid base64. |
OSF_FILE_EXISTS | A file with this name already exists in the OSF project. Filenames must be unique. |
OSF_UPLOAD_ERROR | DataPipe could not upload the file to OSF. Try again later. |
INVALID_OWNER | The experiment owner does not match a valid user account. |
INVALID_OSF_TOKEN | The OSF token for this account is invalid or expired. Reconnect your OSF account in settings. |
INVALID_METADATA_ERROR | The metadata generated from the data is invalid. |
OSF_METADATA_UPLOAD_ERROR | DataPipe could not upload the metadata file to OSF. |
METADATA_ERROR | An error occurred while processing metadata. |
UNKNOWN_ERROR_GETTING_CONDITION | An unexpected error occurred while assigning a condition. |