# Add Tasks

Add Twitter user tweets scraping tasks by screen name

Add Twitter users to scrape tweets from by providing their screen names (usernames). The scraper will retrieve tweets from the specified user's timeline.

<AccountSyncRequired platform="Twitter/X" />

<Note>Crawler ID: `9d6b83aaf1ae9d5b4a775d223e3eb5df`</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 Twitter User Tweets Scraper |
| **tasks** | array | Yes | Array of task objects, each containing a `screen_name` field |

## Task Object

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| **screen_name** | string | Yes | Twitter username without the @ symbol (e.g., `elonmusk`) |

<Tip>
  You can add multiple screen names in a single request to scrape tweets from several users at once.
</Tip>

<Note>
  The screen_name should not include the @ symbol - use `elonmusk` not `@elonmusk`.
</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": [
      {
        "screen_name": "elonmusk"
      }
    ],
    "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 Twitter users to scrape tweets from
response = requests.post(f"{BASE_URL}/tasks",
    headers=headers,
    json={
        "tasks": [
            {"screen_name": "elonmusk"}
        ],
        "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": "dea6b229a9cf67cc5363dfe6062b63ba",
      "created_at": "2025-07-07T09:36:01.623358",
      "is_active": true,
      "params": {
        "username": "elonmusk"
      },
      "module": 127,
      "object": "task"
    }
  ]
}
```
