---
title: "Lead Scraping API for B2B Lead Generation"
description: "Scrape B2B leads from directories and company websites. Extract company data, contact details, and emails as structured JSON with WebScraping.AI."
url: https://webscraping.ai/use-cases/b2b-lead-generation
markdown_index: https://webscraping.ai/llms.txt
---
LEAD GENERATION

# Lead Scraping for B2B Lead Generation

Scrape B2B leads at scale. Build targeted prospect lists by pulling company information, contact details, and business data from directories and company websites.

[Start Free Trial](https://webscraping.ai/auth/sign_up)[View Documentation](https://webscraping.ai/docs)

## Manual Lead Generation Doesn't Scale

Your sales team spends hours copying names, emails, and company details from directories and company websites into a spreadsheet. That manual work caps how many prospects you can reach.

Existing lead databases are expensive, often outdated, and may not cover your specific target market or niche industries.

#### WebScraping.AI Solution

- **Any Data Source:** Extract leads from industry directories, company websites, events, and more
- **AI-Powered:** Our AI finds contact info even when it's not in standard formats
- **Fresh Data:** Get real-time data directly from the source
- **Custom Fields:** Extract exactly the data points your sales team needs

## Lead Data Extraction Features

Extract comprehensive business and contact information

#### Company Data

Extract company name, industry, size, location, and description.

#### Contact Info

Find emails, phone numbers, and key decision-maker names.

#### Web Presence

Gather website URLs, social profiles, and online footprint.

#### Custom Fields

Extract any additional data points specific to your needs.

## How It Works

Build your lead list in three simple steps

1

#### Identify Sources

Choose your data sources - industry directories, company websites, and public business listings.

2

#### Define Fields

Specify what lead data you need - company info, contacts, industry, size, etc.

3

#### Export to CRM

Receive structured JSON data ready to import into your CRM or sales tools.

## Code Examples

Extract business leads from any company page

**cURL**

```bash
curl -G "https://api.webscraping.ai/ai/fields" \
  --data-urlencode "api_key=YOUR_API_KEY" \
  --data-urlencode "url=https://example-company.com/about" \
  --data-urlencode "fields[company_name]=Name of the company" \
  --data-urlencode "fields[industry]=Industry or sector the company operates in" \
  --data-urlencode "fields[company_size]=Number of employees or company size" \
  --data-urlencode "fields[headquarters]=Location of headquarters" \
  --data-urlencode "fields[description]=Brief company description" \
  --data-urlencode "fields[website]=Main website URL" \
  --data-urlencode "fields[contact_email]=General contact email address" \
  --data-urlencode "fields[phone]=Contact phone number" \
  --data-urlencode "fields[linkedin]=LinkedIn company page URL"
# Response:
# {
# "company_name": "TechCorp Solutions",
# "industry": "Software Development",
# "company_size": "50-200 employees",
# "headquarters": "San Francisco, CA",
# "description": "Enterprise software solutions for...",
# "website": "https://techcorp.com",
# "contact_email": "contact@techcorp.com",
# "phone": "+1 (555) 123-4567",
# "linkedin": "https://linkedin.com/company/techcorp"
# }
```

**Python**

```python
# pip install webscraping_ai
# https://pypi.org/project/webscraping-ai/
from webscraping_ai import Client

client = Client(api_key="YOUR_API_KEY")
result = client.fields(
    "https://example-company.com/about",
    fields={
        "company_name": "Name of the company",
        "industry": "Industry or sector the company operates in",
        "company_size": "Number of employees or company size",
        "headquarters": "Location of headquarters",
        "description": "Brief company description",
        "website": "Main website URL",
        "contact_email": "General contact email address",
        "phone": "Contact phone number",
        "linkedin": "LinkedIn company page URL",
    },
)
print(result)
# Response:
# {
# "company_name": "TechCorp Solutions",
# "industry": "Software Development",
# "company_size": "50-200 employees",
# "headquarters": "San Francisco, CA",
# "description": "Enterprise software solutions for...",
# "website": "https://techcorp.com",
# "contact_email": "contact@techcorp.com",
# "phone": "+1 (555) 123-4567",
# "linkedin": "https://linkedin.com/company/techcorp"
# }
```

**JavaScript**

```javascript
// npm install webscraping-ai
// https://www.npmjs.com/package/webscraping-ai
import { WebScrapingAI } from 'webscraping-ai';

const client = new WebScrapingAI({ apiKey: 'YOUR_API_KEY' });
const result = await client.fields({
  url: 'https://example-company.com/about',
  fields: {
    company_name: 'Name of the company',
    industry: 'Industry or sector the company operates in',
    company_size: 'Number of employees or company size',
    headquarters: 'Location of headquarters',
    description: 'Brief company description',
    website: 'Main website URL',
    contact_email: 'General contact email address',
    phone: 'Contact phone number',
    linkedin: 'LinkedIn company page URL',
  },
});
console.log(result);
// Response:
// {
// "company_name": "TechCorp Solutions",
// "industry": "Software Development",
// "company_size": "50-200 employees",
// "headquarters": "San Francisco, CA",
// "description": "Enterprise software solutions for...",
// "website": "https://techcorp.com",
// "contact_email": "contact@techcorp.com",
// "phone": "+1 (555) 123-4567",
// "linkedin": "https://linkedin.com/company/techcorp"
// }
```

**PHP**

```php
<?php
// composer require webscraping-ai/webscraping-ai-php
// https://packagist.org/packages/webscraping-ai/webscraping-ai-php
require 'vendor/autoload.php';

use WebScrapingAI\Client;

$client = new Client('YOUR_API_KEY');
$result = $client->fields('https://example-company.com/about', [
    'company_name' => 'Name of the company',
    'industry' => 'Industry or sector the company operates in',
    'company_size' => 'Number of employees or company size',
    'headquarters' => 'Location of headquarters',
    'description' => 'Brief company description',
    'website' => 'Main website URL',
    'contact_email' => 'General contact email address',
    'phone' => 'Contact phone number',
    'linkedin' => 'LinkedIn company page URL',
]);
print_r($result);
// Response:
// {
// "company_name": "TechCorp Solutions",
// "industry": "Software Development",
// "company_size": "50-200 employees",
// "headquarters": "San Francisco, CA",
// "description": "Enterprise software solutions for...",
// "website": "https://techcorp.com",
// "contact_email": "contact@techcorp.com",
// "phone": "+1 (555) 123-4567",
// "linkedin": "https://linkedin.com/company/techcorp"
// }
```

**Ruby**

```ruby
# gem install webscraping_ai
# https://rubygems.org/gems/webscraping_ai
require 'webscraping_ai'

client = WebScrapingAI::Client.new(api_key: 'YOUR_API_KEY')
result = client.fields(
  'https://example-company.com/about',
  fields: {
    company_name: 'Name of the company',
    industry: 'Industry or sector the company operates in',
    company_size: 'Number of employees or company size',
    headquarters: 'Location of headquarters',
    description: 'Brief company description',
    website: 'Main website URL',
    contact_email: 'General contact email address',
    phone: 'Contact phone number',
    linkedin: 'LinkedIn company page URL',
  }
)
puts result.inspect
# Response:
# {
# "company_name": "TechCorp Solutions",
# "industry": "Software Development",
# "company_size": "50-200 employees",
# "headquarters": "San Francisco, CA",
# "description": "Enterprise software solutions for...",
# "website": "https://techcorp.com",
# "contact_email": "contact@techcorp.com",
# "phone": "+1 (555) 123-4567",
# "linkedin": "https://linkedin.com/company/techcorp"
# }
```

**Go**

```go
// go get github.com/webscraping-ai/webscraping-ai-go/v4
// https://pkg.go.dev/github.com/webscraping-ai/webscraping-ai-go/v4
package main

import (
    "context"
    "fmt"

    webscrapingai "github.com/webscraping-ai/webscraping-ai-go/v4"
)

func main() {
    client, _ := webscrapingai.NewClient(&webscrapingai.Config{APIKey: "YOUR_API_KEY"})
    result, _ := client.Fields(context.Background(), &webscrapingai.FieldsOptions{
        URL: "https://example-company.com/about",
        Fields: map[string]string{
            "company_name": "Name of the company",
            "industry": "Industry or sector the company operates in",
            "company_size": "Number of employees or company size",
            "headquarters": "Location of headquarters",
            "description": "Brief company description",
            "website": "Main website URL",
            "contact_email": "General contact email address",
            "phone": "Contact phone number",
            "linkedin": "LinkedIn company page URL",
        },
    })
    fmt.Println(result.Result)
}
// Response:
// {
// "company_name": "TechCorp Solutions",
// "industry": "Software Development",
// "company_size": "50-200 employees",
// "headquarters": "San Francisco, CA",
// "description": "Enterprise software solutions for...",
// "website": "https://techcorp.com",
// "contact_email": "contact@techcorp.com",
// "phone": "+1 (555) 123-4567",
// "linkedin": "https://linkedin.com/company/techcorp"
// }
```

**Java**

```java
// Maven: ai.webscraping:webscraping-ai:4.2.0
// https://central.sonatype.com/artifact/ai.webscraping/webscraping-ai
import ai.webscraping.Client;
import ai.webscraping.Config;
import ai.webscraping.option.FieldsOptions;
import ai.webscraping.result.FieldsResult;

Client client = new Client(Config.builder().apiKey("YOUR_API_KEY").build());
FieldsResult result = client.fields(FieldsOptions.builder()
    .url("https://example-company.com/about")
    .addField("company_name", "Name of the company")
    .addField("industry", "Industry or sector the company operates in")
    .addField("company_size", "Number of employees or company size")
    .addField("headquarters", "Location of headquarters")
    .addField("description", "Brief company description")
    .addField("website", "Main website URL")
    .addField("contact_email", "General contact email address")
    .addField("phone", "Contact phone number")
    .addField("linkedin", "LinkedIn company page URL")
    .build());
System.out.println(result.getResult());
// Response:
// {
// "company_name": "TechCorp Solutions",
// "industry": "Software Development",
// "company_size": "50-200 employees",
// "headquarters": "San Francisco, CA",
// "description": "Enterprise software solutions for...",
// "website": "https://techcorp.com",
// "contact_email": "contact@techcorp.com",
// "phone": "+1 (555) 123-4567",
// "linkedin": "https://linkedin.com/company/techcorp"
// }
```

**C#**

```csharp
// dotnet add package WebScrapingAI
// https://www.nuget.org/packages/WebScrapingAI
using WebScrapingAI;

var client = new WebScrapingAIClient(new WebScrapingAIClientOptions { ApiKey = "YOUR_API_KEY" });
var result = await client.FieldsAsync(new FieldsRequest {
    Url = "https://example-company.com/about",
    Fields = new Dictionary<string, string> {
        ["company_name"] = "Name of the company",
        ["industry"] = "Industry or sector the company operates in",
        ["company_size"] = "Number of employees or company size",
        ["headquarters"] = "Location of headquarters",
        ["description"] = "Brief company description",
        ["website"] = "Main website URL",
        ["contact_email"] = "General contact email address",
        ["phone"] = "Contact phone number",
        ["linkedin"] = "LinkedIn company page URL",
    },
});
Console.WriteLine(result.Result);
// Response:
// {
// "company_name": "TechCorp Solutions",
// "industry": "Software Development",
// "company_size": "50-200 employees",
// "headquarters": "San Francisco, CA",
// "description": "Enterprise software solutions for...",
// "website": "https://techcorp.com",
// "contact_email": "contact@techcorp.com",
// "phone": "+1 (555) 123-4567",
// "linkedin": "https://linkedin.com/company/techcorp"
// }
```

Got the company's LinkedIn URL? The [LinkedIn Scraper API](https://webscraping.ai/linkedin-scraper-api) turns it into follower count, size band, industry and office locations as JSON, 15 credits per page.

## Benefits for Sales Teams

**Faster Prospecting:** Build lead lists programmatically instead of copying them by hand.

**Fresh Data:** Get up-to-date information directly from source websites.

**Custom Targeting:** Extract leads from niche directories your competitors don't know about.

**No Per-Lead Fees:** Pay for API usage, not per-lead pricing.

**CRM Ready:** Structured data exports directly to your sales tools.

#### Lead Sources You Can Scrape

**Industry Directories**

Chamber of commerce lists, trade associations, professional directories

**Company Websites**

About pages, team pages, contact information

**Event Attendee Lists**

Conference speakers, exhibitors, registered attendees

**Review Platforms**

G2, Capterra, and industry-specific review sites

## Related Use Cases

More lead generation solutions

[Sales Intelligence](https://webscraping.ai/use-cases/sales-intelligence): Gather competitive insights to inform your sales strategy.

[CRM Enrichment](https://webscraping.ai/use-cases/crm-enrichment): Enhance existing leads with additional company data.

[Competitor Analysis](https://webscraping.ai/use-cases/competitor-content-analysis): Understand competitor positioning and messaging.

## Start Generating Leads Today

Get started with 2,000 free API credits. No credit card required.

[Start Free Trial](https://webscraping.ai/auth/sign_up)[View API Documentation](https://webscraping.ai/docs)
