To perform your own custom analysis on data stored in Pluto, or to integrate Pluto data into your own apps or scripts, you can use the Pluto API token to fetch data programmatically.

To fetch data, you'll typically need 3 pieces of information:

  1. Pluto API token

  2. Pluto experiment or project ID (e.g. PLX000327, PLXP00286)

  3. Analysis ID (if fetching results produced from a specific analysis)

Creating your API token

If you are accessing data programmatically for the first time, you'll need to generate a new API token. Navigate to your Account page and click the "+ API token" button.

A new API token will be generated, and can then be copied or viewed.

This API token can be used to fetch data programmatically using a curl request or Pluto's R package.

Using your API token to fetch data

1. Set the PLUTO_API_TOKEN environment variable

Copy the API token that you created on your Account page and store it in an environment variable called PLUTO_API_TOKEN.

2. Fetch all experiments in a project

my_sample_data = pluto_get_project(project_id = 'PLXP00286')

3. Fetch sample data for an experiment

my_sample_data = pluto_read(experiment_id = 'PLX003737',
data_type = 'sample')

4. Fetch assay data for an experiment

my_assay_data = pluto_read(experiment_id = 'PLX003737',
data_type = 'assay')

5. Fetch the DEG table for a specific experiment & analysis

my_assay_data = pluto_read(
experiment_id = 'PLX003737',
data_type = 'deg',
analysis_id = "2f6d71dd-c5b0-478c-a8bc-013179bfbbf4"
)

Deleting your API token

You can delete your API token by clicking the "Delete token" button. Caution: deleting your API token will immediately remove any access associated with that token. This means that any apps or scripts that were using this token will no longer be able to fetch data.

Did this answer your question?