# List Leads

> Retrieve a paginated list of leads for your workspace

## Query Parameters

<ParamField query="limit" type="integer" default="50">
  Maximum number of results to return (max: 100)
</ParamField>

<ParamField query="offset" type="integer" default="0">
  Number of results to skip for pagination
</ParamField>

<ParamField query="source" type="string">
  Filter leads by source (e.g., "website", "referral")
</ParamField>

<ParamField query="code" type="string">
  Filter leads by code
</ParamField>

<ParamField query="created_after" type="string">
  Filter leads created after this date (ISO 8601 format)
</ParamField>

<ParamField query="created_before" type="string">
  Filter leads created before this date (ISO 8601 format)
</ParamField>

## Response

<ResponseField name="data" type="array">
  Array of lead objects
  
  <Expandable title="Lead Object">
    <ResponseField name="id" type="string">
      Unique identifier for the lead
    </ResponseField>
    
    <ResponseField name="visitor_id" type="string">
      Associated visitor ID
    </ResponseField>
    
    <ResponseField name="workspace_id" type="string">
      Workspace ID (always your workspace)
    </ResponseField>
    
    <ResponseField name="code" type="string">
      Lead code or identifier
    </ResponseField>
    
    <ResponseField name="source" type="string">
      Source of the lead
    </ResponseField>
    
    <ResponseField name="created_at" type="string">
      ISO 8601 timestamp of creation
    </ResponseField>
    
    <ResponseField name="updated_at" type="string">
      ISO 8601 timestamp of last update
    </ResponseField>
    
    <ResponseField name="properties" type="object">
      Custom properties (JSONB)
    </ResponseField>
    
    <ResponseField name="location" type="object">
      Location data (JSONB)
    </ResponseField>
    
    <ResponseField name="identity_id" type="string">
      Associated identity ID
    </ResponseField>
    
    <ResponseField name="session_id" type="string">
      Associated session ID
    </ResponseField>
    
    <ResponseField name="summary" type="object">
      Lead summary data (JSONB)
    </ResponseField>
    
    <ResponseField name="company_id" type="string">
      Associated company ID
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="pagination" type="object">
  Pagination information
  
  <Expandable title="Pagination Object">
    <ResponseField name="limit" type="integer">
      Number of results per page
    </ResponseField>
    
    <ResponseField name="offset" type="integer">
      Current offset
    </ResponseField>
    
    <ResponseField name="total" type="integer">
      Total number of leads matching the query
    </ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>

```bash cURL
curl -X GET "https://api.orwel.io/api/v1/leads?limit=10&source=website" \
  -H "Authorization: Bearer orwel_sk_YOUR_KEY"
```

```javascript JavaScript
const response = await fetch(
  'https://api.orwel.io/api/v1/leads?limit=10&source=website',
  {
    headers: {
      'Authorization': 'Bearer orwel_sk_YOUR_KEY'
    }
  }
);

const data = await response.json();
console.log(data);
```

```python Python
import requests

headers = {
    'Authorization': 'Bearer orwel_sk_YOUR_KEY'
}

params = {
    'limit': 10,
    'source': 'website'
}

response = requests.get(
    'https://api.orwel.io/api/v1/leads',
    headers=headers,
    params=params
)

data = response.json()
print(data)
```

</RequestExample>

<ResponseExample>

```json Response
{
  "data": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "visitor_id": "660e8400-e29b-41d4-a716-446655440001",
      "workspace_id": "770e8400-e29b-41d4-a716-446655440002",
      "code": "lead_001",
      "source": "website",
      "created_at": "2025-01-15T10:30:00Z",
      "updated_at": "2025-01-15T10:30:00Z",
      "properties": {
        "industry": "technology",
        "company_size": "50-100"
      },
      "location": {
        "city": "San Francisco",
        "country": "USA"
      },
      "identity_id": "880e8400-e29b-41d4-a716-446655440003",
      "session_id": "990e8400-e29b-41d4-a716-446655440004",
      "summary": {
        "score": 85,
        "status": "qualified"
      },
      "company_id": "aa0e8400-e29b-41d4-a716-446655440005"
    }
  ],
  "pagination": {
    "limit": 10,
    "offset": 0,
    "total": 150
  }
}
```

</ResponseExample>
