Retrieve Your Results Via API

This guide explains how to access your Phantom results in CSV or JSON format directly via PhantomBuster's API.

Generating your PhantomBuster API key

If your Phantom has already been launched, you can proceed to the next section. Otherwise, make sure to launch the Phantom to generate the data you wish to retrieve.

To retrieve your data via the API, you’ll need an API key. Here’s how to create one:

1. Hover over your name in the top-right corner of your PhantomBuster workspace
2. If you have more than one workspace, ensure the correct workspace is selected from the drop-down menu next to your currently active workspace.Look for the ✔️ symbol next to the active workspace name.
3. Under your Technical section, select API Keys: 
user-menu-workspace-menu-and-API-keys.jpeg

4. Click on Add API key:
workspace-add-API-keys.jpeg

5. Copy your API key and save it somewhere secure for future use.
workspace-copy-API-key.jpeg

Accessing Phantom results via API Endpoint

Once your Phantom has launched, use the following API endpoint to fetch your results:

https://api.phantombuster.com/api/v2/agents/fetch?id=ID_OF_YOUR_PHANTOM

Replace `ID_OF_YOUR_PHANTOM` with the actual ID of your Phantom which you can find in your Phantom’s URL.

Key information in the API response

After calling the endpoint, look for the following fields in the response:

  • s3Folder: This folder path links to the Phantom’s file browser and remains constant within the Phantom, even if you change the results file name.
  • orgS3Folder: This folder path is unique to your workspace and is consistent across all Phantoms in your account.

These fields are essential for constructing direct download links for your data.

API results Petra 1 (1).png

Constructing your download links

Using the values for `s3Folder` and `orgS3Folder`, you can generate direct download links for either JSON or CSV files.

Make sure to replace `s3Folder`, `orgS3Folder`, and NAME_OF_YOUR_RESULT_FILE with the actual values from your API data.

  • To download in JSON format:
    https://phantombuster.s3.amazonaws.com/orgS3Folder/s3Folder/NAME_OF_YOUR_RESULT_FILE.json
  • To download in CSV format:
    https://phantombuster.s3.amazonaws.com/orgS3Folder/s3Folder/NAME_OF_YOUR_RESULT_FILE.csv

Check out our Developer hub for more detailed API information and advanced features.

Related guides

Launching Phantoms via API call

Using PhantomBuster's API 

Developer hub

Was this article helpful?

0 out of 1 found this helpful