# Add Tasks

Add keyword-based search tasks to scrape Google Search results

Add keyword-based tasks to scrape Google Search results. Each task represents a search query that will be executed on Google.

<Note>Crawler ID: `f588385d11c48f8af51560e561077238`</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 google-search-scraper crawler |
| **tasks** | array | Yes | Array of task objects, each containing a `keyword` field |

## Task Object

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| **keyword** | string | Yes | The search query to execute on Google |

<Tip>
  You can add multiple keywords in a single request for bulk searches.
</Tip>

<Note>
  Configure search parameters like country, language, and max_pages in the squid settings.
</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": [
      {"keyword": "crab"},
      {"keyword": "lobster recipes"}
    ],
    "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 keyword-based tasks
response = requests.post(f"{BASE_URL}/tasks",
    headers=headers,
    json={
        "squid": squid_id,
        "tasks": [
            {"keyword": "crab"},
            {"keyword": "lobster recipes"}
        ]
    }
)

data = response.json()
print(f"Added {len(data['tasks'])} tasks")
for task in data["tasks"]:
    print(f"  {task['id']}: {task['params']['keyword']}")
```
</CodeGroup>

## Response

```json 200
{
  "duplicated_count": 0,
  "tasks": [
    {
      "id": "36a5f24a550f89c2b997107ca043ec8a",
      "created_at": "2025-06-30T08:25:29.311114",
      "is_active": true,
      "params": {
        "keyword": "crab"
      },
      "module": 128,
      "object": "task"
    }
  ]
}
```
