API Reference

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.

Save text data

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.

FieldTypeDescription
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"
}

Save base64-encoded data

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.

FieldTypeDescription
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.

Get condition assignment

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, ...).

FieldTypeDescription
experimentID

string

Your experiment ID.

Example response

{
  "condition": 2
}

Responses

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 codeMeaning
MISSING_PARAMETEROne or more required fields are missing from the request body.
EXPERIMENT_NOT_FOUNDNo experiment matches the provided ID.
DATA_COLLECTION_NOT_ACTIVEData collection is not enabled for this experiment.
BASE64DATA_COLLECTION_NOT_ACTIVEBase64 data collection is not enabled for this experiment.
CONDITION_ASSIGNMENT_NOT_ACTIVECondition assignment is not enabled for this experiment.
SESSION_LIMIT_REACHEDThe experiment has reached its session limit. Increase the limit in the dashboard.
INVALID_DATAThe data did not pass the validation rules configured for this experiment.
INVALID_BASE64_DATAThe data is not valid base64.
OSF_FILE_EXISTSA file with this name already exists in the OSF project. Filenames must be unique.
OSF_UPLOAD_ERRORDataPipe could not upload the file to OSF. Try again later.
INVALID_OWNERThe experiment owner does not match a valid user account.
INVALID_OSF_TOKENThe OSF token for this account is invalid or expired. Reconnect your OSF account in settings.
INVALID_METADATA_ERRORThe metadata generated from the data is invalid.
OSF_METADATA_UPLOAD_ERRORDataPipe could not upload the metadata file to OSF.
METADATA_ERRORAn error occurred while processing metadata.
UNKNOWN_ERROR_GETTING_CONDITIONAn unexpected error occurred while assigning a condition.

Created by the developers of jsPsych ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,

Report an Issue

GitHub

Contact Us