Launching Phantoms via API call

Attention all developers! You can use the PhantomBuster API to have control over your account. It is composed of HTTPS endpoints returning JSON data. The API allows you to launch and abort agents, get console output, status, progress, and messages from an agent, and more. 

You can also check out our Developer hub and Developer guides & tutorials if you need more information.

Enabling developer mode 

To use the PhantomBuster API, you need to enable developer mode. If you signed up as a developer on PhantomBuster, the developer mode is enabled by default. If not, head to your User settings page and click "Enable developer mode."

Screenshot_2022-06-22_at_15.18.25.png

PhantomBuster's developer mode adds developer-specific advanced options across the website.

The developer mode will unlock features such as "Edit code" for your custom scripts or code snippets to easily use our API. To see all developer features, check out Developers: Enable developer features.

Check out this Developer quick start for a step-by-step guide on important PhantomBuster terms, what agents (aka Phantoms) are made of, how to create and code your own custom script, and other useful things. 

API Key 

Your API key can be found in your Workspace settings. Access these settings by clicking your name in the upper right corner of the Navigation Bar:

Screenshot 2023-12-21 at 14.57.45.png

You will find more information on how our API endpoints URLs are formatted and other information regarding the version, how to manage and secure your API key, authentication, and errors in this guide. To launch a Phantom via API call, see this documentation.

You can see the argument to send in the Phantom's Setup by clicking on the three dots in the top right, then "Switch to JSON."

This is how it looks after switching to JSON:

By adding your settings in the Phantom UI beforehand and conducting a test, you can ensure that your settings are correct. After a successful launch, copy the data from the JSON to your API processor, and your automation is ready! 

Webhooks

If you want to perform some actions after the execution of your Phantom, you can look into the webhook system. 

Get your Phantom's results via API call

In order to get the CSV/JSON file link through the API, you will need to launch a Phantom and use the endpoint

This second step will give you some data, where you'll find two things that will interest you:
- s3Folder
- orgS3Folder 

Then you will just have to recreate the link. For example:
- JSON > https://phantombuster.s3.amazonaws.com/orgS3Folder/s3Folder/NAME_OF_YOUR_RESULT_FILE.json
- CSV > https://phantombuster.s3.amazonaws.com/orgS3Folder/s3Folder/NAME_OF_YOUR_RESULT_FILE.csv

 

If you think this article does not address your issue, please contact Support directly. We are continuously improving, so your feedback means the world to us!

Was this article helpful?
6 out of 19 found this helpful