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

# Add Tasks

> Add keyword-based tasks to scrape Google News articles

Add keyword-based tasks to scrape Google News articles. Each task represents a news search query that will fetch matching articles from Google News.

## 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-news-search-export crawler |
| **tasks** | array  | Yes      | Array of task objects, each containing a `keyword` field                 |

## Task Object

| Field       | Type   | Required | Description                                                         |
| ----------- | ------ | -------- | ------------------------------------------------------------------- |
| **keyword** | string | Yes      | The news search query (e.g., `crab`, `climate change`, `tech news`) |

<Tip>
  Use specific keywords for more targeted news results.
</Tip>

<Note>
  Configure time range and language in the squid settings to filter results.
</Note>

## Code Examples

<CodeGroup>
  ```bash cURL theme={null}
  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": "climate change"}
      ],
      "squid": "YOUR_SQUID_HASH"
    }'
  ```

  ```python Python theme={null}
  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 news search tasks
  response = requests.post(f"{BASE_URL}/tasks",
      headers=headers,
      json={
          "squid": squid_id,
          "tasks": [
              {"keyword": "crab"},
              {"keyword": "climate change"}
          ]
      }
  )

  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 theme={null}
{
  "duplicated_count": 0,
  "tasks": [
    {
      "id": "5f5ccd42b74cf18196dcb7fe14fb8030",
      "created_at": "2025-07-04T04:51:12.532884",
      "is_active": true,
      "params": {
        "keyword": "crab"
      },
      "module": 131,
      "object": "task"
    }
  ]
}
```
