Using OpenAI ChatGPT and API Filters To Dynamically Filter Leads In Lead Prosper

With the new Lead Prosper API Filters, you can now filter your leads based on responses from just about any external API. At first, you might think of things like checking phone numbers or emails for duplicates, or running a lead through a fraud detection service — and those are great use cases.


But where things get really exciting is when you connect your lead data to an AI service like OpenAI. You can send over lead details and have the AI analyze, interpret, or even make decisions based on your custom prompt. It can return a simple “yes” or “no,” a score, a tag — really anything you need — and you can use that response to accept, reject, or route the lead.


What makes this powerful is the flexibility. With AI in the mix, you’re no longer limited to rigid filters. You can create smart, dynamic rules based on context, tone, intent, and more — unlocking a whole new level of precision in how you qualify your leads.

Get an OpenAI API Key

The first step is to get an API key from OpenAI. To do so you'll first need to create an OpenAI account if you don't have one - https://platform.openai.com/signup. Once you have your account and are logged in head to the Developer Dashboard to create your API Key - https://platform.openai.com/account/api-keys. To generate the new API key:

  • Click the “+ Create new secret key” button.
  • Give it a name (optional, but helpful for tracking usage).
  • Copy the key when it appears — you won’t be able to see it again!

📌 Important: Store your key somewhere secure (e.g., an environment variable or secrets manager). Don’t share it publicly.

To learn more about OpenAI projects and managing your API keys you can read this article - https://help.openai.com/en/articles/9186755-managing-projects-in-the-api-platform

Use ChatGPT To Create Your Prompt

We can now use ChatGPT to help us create the prompt you are going to use with the API and your filters.

If you're not sure how to phrase your prompt, ask ChatGPT something like:

"Help me write a prompt that asks ChatGPT to check if a zip code is within a 50 mile radius of Asheville, NC."

ChatGPT will return a sample prompt you can use, like:

"Is ZIP code 28806 within 50 miles of Asheville, NC?"

You can then plug this into the API call. Or you can ask ChatGPT to help format it for you into a JSON body which will look something like:

{
  "model": "gpt-4",
  "messages": [
    {
      "role": "system",
      "content": "You are a helpful assistant that determines if a U.S. ZIP code is within a 50-mile radius of Asheville, North Carolina."
    },
    {
      "role": "user",
      "content": "Is ZIP code 28806 within 50 miles of Asheville, NC?"
    }
  ]
}

Set Up Your API Filter

Now that you’ve created your prompt, it’s time to build your API filter.

In this example, we’ll set up an API filter that uses ChatGPT to check whether a given zip_code falls within a 50-mile radius of Asheville, NC. The settings shown below are specific to this example.

If you're using a different prompt you’ll likely need to adjust the Body and Response Mapping to match your own use case.

Go to your campaign, select Filters, and then choose which Buyer or Supplier to add the filter to, or add a Global Filter. Select Add > API Filter. In the API Filter Pop Up fill out the payload (the details below are specifically for OpenAI / ChatGPT}:

{
  "model": "gpt-4",
  "messages": [
    {
      "role": "system",
      "content": "You are a helpful assistant that determines if a U.S. ZIP code is within a 50-mile radius of Asheville, North Carolina."
    },
    {
      "role": "user",
      "content": "Is ZIP code 28806 within 50 miles of Asheville, NC?"
    }
  ]
}
  • Custom Headers:
    • Key: Content-Type

      Value: application/json

    • Key: Authorization

      Value: Bearer {{OpenAI_API_Key}}

  • Response Type:
    • Action: Allow
    • Condition: key equal with
    • Key: choices/0/message/content
    • Value: Yes
  • Customer Error Message (optional): Zip code not within given range.


Test Your API Filter

Once you’ve finished setting up your API Filter, click Save & Close to create it.

By default, all new API Filters are set to Paused, so the next step is testing to make sure everything works correctly.

To test your filter:

  1. Select the filter.
  2. Click the cog icon.
  3. Choose Test.

The Test Filter page functions just like the Test Buyer tool.

We recommend running at least two tests:

  • One that returns an ACCEPTED response
  • One that returns a REJECTED response

This helps confirm that your filter logic is working as expected.

Once you’ve verified everything is working properly, you’re ready to turn the filter Live.

Turn Your OpenAI / ChatGPT AI Filter Live!

Last but not least - turn your API filter live!


With Lead Prosper’s new API Filters and the power of ChatGPT, you now have the tools to create intelligent, flexible, and highly customized lead filtering logic — all without writing complex code. Whether you're scoring leads, verifying data, or making contextual decisions on the fly, the possibilities are virtually endless. This combination of automation and AI not only saves time, but also helps you make smarter decisions faster. So go ahead — turn that filter live and start leveling up your lead flow. The future of dynamic filtering is here.

Still need help? Contact Us Contact Us