# Add Tasks

Add Leboncoin search URLs to scrape listings with phone numbers

Add Leboncoin search result pages to scrape by providing search URLs. This scraper extracts all classified listings including phone numbers when available.

This scraper is identical to Leboncoin Listings Search Export but adds phone number extraction capabilities.

<Note>Crawler ID: `7bc4acdb18f2b90fdd5eb42b8e8251e9`</Note>

## Headers

<ParamField header="Authorization" type="string" required>
  Your API authentication token. Value: `Token YOUR_API_KEY`
</ParamField>

<ParamField header="Content-Type" type="string" required>
  Request body format. Value: `application/json`
</ParamField>

## Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| **squid** | string | Yes | Hash of your squid configured with the Leboncoin Listings & Phone Search Export crawler |
| **tasks** | array | Yes | Array of task objects, each containing a `url` field |

## Task Object

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| **url** | string | Yes | Leboncoin search URL (e.g., `https://www.leboncoin.fr/annonces/offres/provence_alpes_cote_d_azur/`) |

<Tip>
  Apply filters on Leboncoin first, then copy the URL. All filter parameters will be preserved.
</Tip>

<Note>
  Phone extraction requires enabling `functions.get_phone_numbers` in the settings and incurs extra credits.
</Note>

## Code Examples

<CodeGroup>
```bash cURL
curl -X POST "https://api.lobstr.io/v1/tasks" \
  -H "Authorization: Token YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "tasks": [
      {
        "url": "https://www.leboncoin.fr/annonces/offres/provence_alpes_cote_d_azur/bouches_du_rhone/p-2"
      }
    ],
    "squid": "YOUR_SQUID_HASH"
  }'
```

```python Python
import requests

API_KEY = "YOUR_API_KEY"
BASE_URL = "https://api.lobstr.io/v1"
headers = {"Authorization": f"Token {API_KEY}"}

squid_id = "YOUR_SQUID_HASH"

# Add Leboncoin search URLs to scrape with phone extraction
response = requests.post(f"{BASE_URL}/tasks",
    headers=headers,
    json={
        "tasks": [
            {"url": "https://www.leboncoin.fr/annonces/offres/provence_alpes_cote_d_azur/bouches_du_rhone/p-2"}
        ],
        "squid": squid_id
    }
)

data = response.json()
print(f"Added {len(data['tasks'])} tasks")
print(f"Duplicates: {data['duplicated_count']}")
```
</CodeGroup>

## Response

```json 200
{
  "duplicated_count": 0,
  "tasks": [
    {
      "id": "bbeff62182c6239a8df533ec9d281c2e",
      "created_at": "2025-07-04T04:57:45.202264",
      "is_active": true,
      "params": {
        "url": "https://www.leboncoin.fr/annonces/offres/provence_alpes_cote_d_azur/bouches_du_rhone/p-2"
      },
      "module": 103,
      "object": "task"
    }
  ]
}
```
