How do I use PhantomBuster with Claude Code via the API?

Salim sraj This badge shows you’re hearing straight from the source! Team members are here to share insider tips, answer questions, and guide you through PhantomBuster with expert knowledge. They’re dedicated to helping you succeed and making sure your automation journey feels easy and exciting. PhantomBuster Official
  • Edited

Launch Phantoms, qualify leads and send outreach, directly from Claude Code, in plain English.

> Launch my LinkedIn Search Export phantom

The idea in one line

PhantomBuster's API gives full programmatic access to your Phantoms. Wire it to Claude Code once, then run your entire lead-gen workflow from a single conversation.

Part 1 — Setup, done once. 5 steps: API key → folder → deps → script → ,CLAUDE.md,. Result: 8 PhantomBuster functions Claude can call.

Part 2 — The lead-gen loop, daily. 4 steps: scrape → qualify → write → send. Run end-to-end from one Claude conversation.

01 — Setup

Five steps to connect PhantomBuster to Claude Code. You only do this once.

1. Get your PhantomBuster API key

  • Log in to PhantomBuster
  • Click your avatar (top-right) → Settings
  • Under Technical, open API keys
  • Click + Add API key, then Copy key

Where to click: Settings › Technical › API keys → + Add API keyCopy key

Keep this key somewhere safe. You'll need it again in Step 5.

2. Create the project folder

  • Open Claude Code in your terminal or in VS Code
  • Run the command to create and enter the project directory
  • Claude Code confirms the folder was created
$ mkdir ~/phantombuster-api && cd ~/phantombuster-api

Everything for this integration lives in one tidy folder.

3. Install dependencies

  • Install uv, a fast Python package manager
  • uv ships no runtime, so add Python 3.12
  • Create a dedicated virtual environment
  • Install httpx inside it
$ brew install uv
$ uv python install 3.12
$ uv venv ~/phantombuster-api/.venv --python 3.12
$ source ~/phantombuster-api/.venv/bin/activate
$ uv pip install httpx

Claude Code handles this automatically. httpx 0.28.1 is installed in a dedicated Python 3.12 venv.

4. Create the API integration file

  • Ask Claude Code to write phantombuster_,api.py,
  • One file wraps the PhantomBuster API v2
  • It defines 8 callable functions
  • No text editor needed. Claude writes it for you
# phantombuster_,api.py,
import httpx, os, json, sys

BASE = ",https://api.phantombuster.com/api/v2,"

def launch_phantom(id):
    r = ,httpx.post,(
        f"{BASE}/agents/launch",
        headers=headers(),
        json={"id": id})
    return str(r.json())

5. Connect it to Claude Code

  • Create a ,CLAUDE.md, in the project folder
  • It tells Claude how to run the script + lists every function
  • Claude reads it automatically inside that folder
  • From now on: just talk in plain English
# ,CLAUDE.md, — PhantomBuster API

Interpreter:  ~/phantombuster-api/.venv/bin/python
Env:          PHANTOMBUSTER_API_KEY=…

Why .venv/bin/python? macOS system python3 is 3.9, too old for modern httpx. The venv has Python 3.12 and all dependencies installed.

Go beyond the 8 functions and give Claude the whole brain

The 8 functions are a starter kit. The real power is the entire API reference,  ask Claude to read it once, and it can drive every part of PhantomBuster.

Why it matters. The 8 functions cover the daily loop. Everything else lives in the full API. Point Claude at the reference once,  it reads and keeps the whole surface in mind.

PhantomBuster ships an llms.txt built for AI: every page in Markdown, every endpoint in OpenAPI. Claude can now call anything,  CRM lead storage, identities, AI completions, 150+ scripts.

> Read the full PhantomBuster API reference at
  ,hub.phantombuster.com/llms.txt, and use it as your
  source of truth for every PhantomBuster call.

What you get: 8 → 60+ endpoints Claude can call, across 12 API groups,  the entire PhantomBuster surface, not just 8.

Some functions Claude can call

Once setup is done, just say what you want.  Claude maps it to the right call.

Function

What to say to Claude

list_phantoms

"List all my phantoms"

create_phantom

"Create a LinkedIn Search Export phantom"

configure_phantom

"Configure my CEOS phantom with this URL"

launch_phantom

"Launch my LinkedIn Search Export"

stop_phantom

"Stop my LinkedIn Profile Scraper"

get_phantom_status

"What's the status of my CEOS phantom?"

get_phantom_output

"Get the output from my Search Export"

delete_phantom

"Delete the test phantom"

Tip: use the exact .js script name from the store. Claude can list all 151 available scripts.

02 — The lead-gen loop

Scrape, qualify, write and send: the full workflow, run from one Claude conversation.

1. Scrape your leads

Tell Claude your use case and ask which Phantom actor fits,  then have it launch the scraper to pull your leads.

How it works:

  • Describe your use case:  the audience you want to reach.
  • Ask which Phantom fits:  Claude picks the right actor from the store, e.g. LinkedIn Search Export.
  • Launch it from the chat:  the scraper runs and pulls leads straight into the conversation.
> Launch my LinkedIn Search Export phantom

What you get: 100 leads per run: name, job title, company and LinkedIn URL  (pulled straight into the conversation).

2. Qualify your leads

With your raw leads in hand, give Claude this ICP prompt and have it run the AI LinkedIn Profile scraper to qualify each one.

How it works:

  • Start from your raw export:  the full list of leads you just scraped.
  • Claude runs the AI LinkedIn Profile scraper on each profile, scored against your ICP.
  • Every lead comes back labelled:  ICP or not, with a reason and a decision.
> Qualify each lead against this ICP and qualify or disqualify them.
  Titles:  VP Sales, Head of Growth
  Size:    10–500 employees
  Output:  ICP or not · reason · decision

What you get: a filtered list, typically 40–60% pass. No wasted messages on the rest.

3. Generate the messages

Add a prompt inside the AI LinkedIn Profile Enricher to write a personalised connection note for each lead — automatically.

How it works:

  • Set the prompt once: it lives inside the Enricher's configuration.
  • Runs on every lead automatically at enrichment time, with no manual writing step.
  • Personalised by default:  each note pulls the lead's real role and company.
> Write a personalised LinkedIn connection note.
  • ≤ 300 chars, no emojis
  • Reference their role and company
  • End with one question about their challenge

What you get: one tailored message per lead, generated at enrichment time, no extra step needed.

4. LinkedIn outreach sequence

Three touches over a week, sent automatically and every step pauses the moment a lead replies.

Day

Touch

What happens

Day 0

1. Connection request

A personalised note that references their role and company. ≤ 300 chars, no emojis.

Day 3

2. Thank-you + opener

Once they accept, thank them and open with one relevant question about their work.

Day 7

3. Value + soft CTA

Share a useful insight or resource, then a light ask,  open to a quick chat?

Launch it from Claude,  pass your qualified leads to the sequence Phantom and it runs the cadence for you, every day.

The whole system, one conversation

Scrape → 100 leads · Qualify → ICP 7+ · Write → personalised · Send → daily, auto

Set up once. Then run lead generation end-to-end, from one Claude Code conversation, in plain English.

Comments

0 comments

Please sign in to leave a comment.