# Source

Lead/trade acquisition sources

::: info
Every response arrives in the shared envelope — `code`, `message`, `messages`, `status_code`, `time` — with the payload in `data`. The tables below describe what is inside `data`.
:::

## POST /source/get-all

Return all lead/customer acquisition sources for the tenant. Optionally filter by source type.

**Required permission:** none — closed to an app that declares permissions · [how permissions work](https://docs.bito.uz/en/api/permissions.md)

**Example request**

::: code-group

```bash [curl]
curl -X POST 'https://api.bito.uz/integration-api/integration/api/v2/source/get-all' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "type": "user",
  "own_only": false
}'
```

```js [JavaScript]
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/source/get-all', {
  method: 'POST',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "type": "user",
    "own_only": false
  }),
})
const { code, data } = await res.json()
```

```python [Python]
import os
import requests

res = requests.request(
    "POST",
    "https://api.bito.uz/integration-api/integration/api/v2/source/get-all",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "type": "user",
        "own_only": False,
    },
)
print(res.json())
```

```php [PHP]
<?php
$body = <<<'JSON'
{
  "type": "user",
  "own_only": false
}
JSON;

$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/source/get-all');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_HTTPHEADER => ['api-key: ' . getenv('BITO_API_KEY'), 'Content-Type: application/json'],
    CURLOPT_POSTFIELDS => $body,
    CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);
```

:::

**Request body**

| Field | Type | Required | Description |
|---|---|---|---|
| `type` | `string` | No | Filter sources by origin category (forward-compatible — not yet applied server-side). One of: `user`, `system`, `integration`, `lead_form` |
| `own_only` | `boolean` | No |  |

```json
{
  "type": "user",
  "own_only": false
}
```

**Response**

```json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": [],
  "time": "2025-05-01T12:00:00Z"
}
```

## GET /source/get-by-id/{id}

Fetch a single acquisition source by its ObjectId.

**Required permission:** none — closed to an app that declares permissions · [how permissions work](https://docs.bito.uz/en/api/permissions.md)

**Example request**

::: code-group

```bash [curl]
curl -X GET 'https://api.bito.uz/integration-api/integration/api/v2/source/get-by-id/6712f0a9c4d1e87b3a0f9911' \
  -H "api-key: $BITO_API_KEY"
```

```js [JavaScript]
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/source/get-by-id/6712f0a9c4d1e87b3a0f9911', {
  method: 'GET',
  headers: { 'api-key': process.env.BITO_API_KEY },
})
const { code, data } = await res.json()
```

```python [Python]
import os
import requests

res = requests.request(
    "GET",
    "https://api.bito.uz/integration-api/integration/api/v2/source/get-by-id/6712f0a9c4d1e87b3a0f9911",
    headers={"api-key": os.environ["BITO_API_KEY"]},
)
print(res.json())
```

```php [PHP]
<?php
$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/source/get-by-id/6712f0a9c4d1e87b3a0f9911');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_HTTPHEADER => ['api-key: ' . getenv('BITO_API_KEY')],
    CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);
```

:::

**Path parameters**

| Parameter | Type | Required | Description |
|---|---|---|---|
| `id` | `string` | Yes | Source ObjectId |

**Request body**

No request body.

**Response**

| Field | Type | Description |
|---|---|---|
| `_id` | `string` | Source ObjectId |
| `name` | `string` | Display name of the source (e.g. 'Instagram', 'Walk-in', 'Referral') |
| `type` | `string` | Origin category of the source. One of: `user`, `system`, `integration`, `lead_form` |
| `integration_id` | `string` | ObjectId of the linked integration, if type is 'integration' |
| `is_visible` | `boolean` | Whether the source is shown in customer-facing selection lists |
| `is_deleted` | `boolean` | Soft-delete flag |
| `created_at` | `string (date-time)` | Creation timestamp |
| `updated_at` | `string (date-time)` | Last update timestamp |

```json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": {
    "_id": "string",
    "name": "string",
    "type": "user",
    "integration_id": "string",
    "is_visible": false,
    "is_deleted": false,
    "created_at": "2025-05-01T12:00:00Z",
    "updated_at": "2025-05-01T12:00:00Z"
  },
  "time": "2025-05-01T12:00:00Z"
}
```

---

*This page is generated from the OpenAPI spec.*
