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

# Create Lead

> Create a new lead in your workspace

> [!NOTE]
>
> Requires an [API key](https://www.orwel.io/docs/authentication.md) (`orwel_sk_`) with the `leads:write` scope.

## Request Body

**visitor\_id** `string`

Associated visitor ID (UUID)

**code** `string`

Lead code or identifier

**source** `string`

Source of the lead (e.g., "website", "referral", "campaign")

**properties** `object`

Custom properties as key-value pairs

**location** `object`

Location data (city, country, etc.)

**identity\_id** `string`

Associated identity ID (UUID)

**session\_id** `string`

Associated session ID (UUID)

**company\_id** `string`

Associated company ID (UUID)

```bash cURL theme={null}
curl -X POST "https://api.orwel.io/api/v1/leads" \
  -H "Authorization: Bearer orwel_sk_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "visitor_id": "660e8400-e29b-41d4-a716-446655440001",
    "code": "lead_002",
    "source": "website",
    "properties": {
      "industry": "fintech",
      "company_size": "100-500"
    },
    "location": {
      "city": "New York",
      "country": "USA"
    }
  }'
```

```javascript JavaScript theme={null}
const response = await fetch('https://api.orwel.io/api/v1/leads', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer orwel_sk_YOUR_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    visitor_id: '660e8400-e29b-41d4-a716-446655440001',
    code: 'lead_002',
    source: 'website',
    properties: {
      industry: 'fintech',
      company_size: '100-500'
    },
    location: {
      city: 'New York',
      country: 'USA'
    }
  })
});

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

```python Python theme={null}
import requests
import json

headers = {
    'Authorization': 'Bearer orwel_sk_YOUR_KEY',
    'Content-Type': 'application/json'
}

payload = {
    'visitor_id': '660e8400-e29b-41d4-a716-446655440001',
    'code': 'lead_002',
    'source': 'website',
    'properties': {
        'industry': 'fintech',
        'company_size': '100-500'
    },
    'location': {
        'city': 'New York',
        'country': 'USA'
    }
}

response = requests.post(
    'https://api.orwel.io/api/v1/leads',
    headers=headers,
    data=json.dumps(payload)
)

data = response.json()
```

```json 201 Created theme={null}
{
  "data": {
    "id": "bb0e8400-e29b-41d4-a716-446655440006",
    "visitor_id": "660e8400-e29b-41d4-a716-446655440001",
    "workspace_id": "770e8400-e29b-41d4-a716-446655440002",
    "code": "lead_002",
    "source": "website",
    "created_at": "2025-01-15T14:30:00Z",
    "updated_at": "2025-01-15T14:30:00Z",
    "properties": {
      "industry": "fintech",
      "company_size": "100-500"
    },
    "location": {
      "city": "New York",
      "country": "USA"
    },
    "identity_id": null,
    "session_id": null,
    "summary": null,
    "company_id": null
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.