> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sendpilot.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Lead Extractor Campaign

> Create a new lead extraction campaign from LinkedIn search URLs

Initiates a lead extraction campaign to scrape leads from LinkedIn search results. Requires an active LinkedIn account connected to your workspace.

## Request

<ParamField header="X-API-Key" type="string" required>
  Your API key
</ParamField>

<ParamField body="name" type="string" required>
  A name for this extraction campaign
</ParamField>

<ParamField body="urls" type="string[]" required>
  LinkedIn search URLs to extract leads from
</ParamField>

<ParamField body="limit" type="number" required>
  Maximum number of leads to extract (1-10000)
</ParamField>

<ParamField body="url_type" type="string" default="linkedin_search">
  Type of URLs provided: `linkedin_search` or `sales_navigator`
</ParamField>

<ParamField body="mode" type="string" default="extraction_only">
  Extraction mode: `extraction_only` or `with_enrichment`
</ParamField>

## Response

<ResponseField name="id" type="string">
  Unique identifier for the campaign
</ResponseField>

<ResponseField name="name" type="string">
  Name of the campaign
</ResponseField>

<ResponseField name="status" type="string">
  Current status: `pending`, `running`, `completed`, `failed`, `cancelled`
</ResponseField>

<ResponseField name="created_at" type="string">
  ISO 8601 timestamp when the campaign was created
</ResponseField>

<ResponseField name="estimated_credits" type="number">
  Estimated credits that will be consumed
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.sendpilot.ai/v1/lead-extractor/campaigns \
    -H "X-API-Key: YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "Tech Startup Founders",
      "urls": [
        "https://www.linkedin.com/search/results/people/?keywords=CEO%20startup"
      ],
      "limit": 100,
      "url_type": "linkedin_search",
      "mode": "with_enrichment"
    }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://api.sendpilot.ai/v1/lead-extractor/campaigns', {
    method: 'POST',
    headers: {
      'X-API-Key': process.env.SENDPILOT_API_KEY,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      name: 'Tech Startup Founders',
      urls: ['https://www.linkedin.com/search/results/people/?keywords=CEO%20startup'],
      limit: 100,
      url_type: 'linkedin_search',
      mode: 'with_enrichment'
    })
  });
  const result = await response.json();
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      'https://api.sendpilot.ai/v1/lead-extractor/campaigns',
      headers={
          'X-API-Key': 'YOUR_API_KEY',
          'Content-Type': 'application/json'
      },
      json={
          'name': 'Tech Startup Founders',
          'urls': ['https://www.linkedin.com/search/results/people/?keywords=CEO%20startup'],
          'limit': 100,
          'url_type': 'linkedin_search',
          'mode': 'with_enrichment'
      }
  )
  result = response.json()
  ```
</RequestExample>

<ResponseExample>
  ```json 201 theme={null}
  {
    "id": "camp_abc123xyz",
    "name": "Tech Startup Founders",
    "status": "pending",
    "created_at": "2024-02-24T10:30:00.000Z",
    "estimated_credits": 200
  }
  ```

  ```json 400 theme={null}
  {
    "statusCode": 400,
    "error": "Bad Request",
    "code": "NO_LINKEDIN_ACCOUNT",
    "message": "No active LinkedIn account found in workspace. Please connect a LinkedIn account first."
  }
  ```

  ```json 403 theme={null}
  {
    "statusCode": 403,
    "error": "Forbidden",
    "code": "INSUFFICIENT_CREDITS",
    "message": "Insufficient credits. Required: 200, Available: 50"
  }
  ```
</ResponseExample>

<Note>
  Credits are calculated as: 1 credit per lead for extraction, plus 1 additional credit per lead if enrichment is enabled.
</Note>


## OpenAPI

````yaml POST /v1/lead-extractor/campaigns
openapi: 3.0.0
info:
  title: SendPilot External API
  description: >
    The SendPilot API enables you to programmatically manage LinkedIn outreach
    campaigns,

    add leads, update lead statuses, send messages, and receive real-time
    webhook notifications.
  version: 1.0.0
  contact:
    name: SendPilot Support
    email: support@sendpilot.ai
    url: https://sendpilot.ai
servers:
  - url: https://api.sendpilot.ai
    description: Production server
security:
  - ApiKeyAuth: []
tags:
  - name: Credits
    description: Credits and quota management
  - name: Campaigns
    description: Campaign management endpoints
  - name: Leads
    description: Lead management endpoints
  - name: Lead Database
    description: Lead Database search endpoints
  - name: Lead Extractor
    description: Lead extraction campaign endpoints
  - name: Inbox
    description: Direct messaging endpoints
paths:
  /v1/lead-extractor/campaigns:
    post:
      tags:
        - Lead Extractor
      summary: Create Lead Extractor Campaign
      description: >
        Initiates a lead extraction campaign to scrape leads from LinkedIn
        search results.

        Requires an active LinkedIn account connected to your workspace.
      operationId: createLeadExtractorCampaign
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateLeadExtractorCampaignRequest'
      responses:
        '201':
          description: Campaign created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateLeadExtractorCampaignResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  schemas:
    CreateLeadExtractorCampaignRequest:
      type: object
      properties:
        name:
          type: string
          description: A name for this extraction campaign
        urls:
          type: array
          description: LinkedIn search URLs to extract leads from
          items:
            type: string
          minItems: 1
        limit:
          type: integer
          description: Maximum number of leads to extract
          minimum: 1
          maximum: 10000
        url_type:
          type: string
          description: Type of URLs provided
          enum:
            - linkedin_search
            - sales_navigator
          default: linkedin_search
        mode:
          type: string
          description: Extraction mode
          enum:
            - extraction_only
            - with_enrichment
          default: extraction_only
      required:
        - name
        - urls
        - limit
    CreateLeadExtractorCampaignResponse:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        status:
          type: string
          enum:
            - pending
            - running
            - completed
            - failed
            - cancelled
        created_at:
          type: string
          format: date-time
        estimated_credits:
          type: integer
          description: Estimated credits that will be consumed
      required:
        - id
        - status
    Error:
      type: object
      properties:
        statusCode:
          type: integer
        error:
          type: string
        code:
          type: string
        message:
          type: string
      required:
        - statusCode
        - message
  responses:
    BadRequest:
      description: Bad request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: API key for authentication

````