# Marketing settings

Marketing module settings

::: 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`.
:::

## GET /marketing-settings/get

Get the tenant's marketing settings (created with defaults on first access).

**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/marketing-settings/get' \
  -H "api-key: $BITO_API_KEY"
```

```js [JavaScript]
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/marketing-settings/get', {
  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/marketing-settings/get",
    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/marketing-settings/get');
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);
```

:::

**Request body**

No request body.

**Response**

| Field | Type | Description |
|---|---|---|
| `_id` | `string` |  |
| `expected_product_template_id` | `string` |  |
| `send_by_sms` | `boolean` |  |
| `send_by_bot` | `boolean` |  |
| `integration_id` | `string` |  |
| `template` | `object` |  |
| `template._id` | `string` |  |
| `template.content` | `string` |  |
| `integration` | `object` |  |
| `integration._id` | `string` |  |
| `integration.name` | `string` |  |

```json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": {
    "_id": "string",
    "expected_product_template_id": "string",
    "send_by_sms": false,
    "send_by_bot": false,
    "integration_id": "string",
    "template": {
      "_id": "string",
      "content": "string"
    },
    "integration": {
      "_id": "string",
      "name": "string"
    }
  },
  "time": "2025-05-01T12:00:00Z"
}
```

## PUT /marketing-settings/set

Update the tenant's marketing settings (partial patch).

**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 PUT 'https://api.bito.uz/integration-api/integration/api/v2/marketing-settings/set' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "expected_product_template_id": "string",
  "send_by_sms": false,
  "send_by_bot": false,
  "integration_id": "string"
}'
```

```js [JavaScript]
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/marketing-settings/set', {
  method: 'PUT',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "expected_product_template_id": "string",
    "send_by_sms": false,
    "send_by_bot": false,
    "integration_id": "string"
  }),
})
const { code, data } = await res.json()
```

```python [Python]
import os
import requests

res = requests.request(
    "PUT",
    "https://api.bito.uz/integration-api/integration/api/v2/marketing-settings/set",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "expected_product_template_id": "string",
        "send_by_sms": False,
        "send_by_bot": False,
        "integration_id": "string",
    },
)
print(res.json())
```

```php [PHP]
<?php
$body = <<<'JSON'
{
  "expected_product_template_id": "string",
  "send_by_sms": false,
  "send_by_bot": false,
  "integration_id": "string"
}
JSON;

$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/marketing-settings/set');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'PUT',
    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 |
|---|---|---|---|
| `expected_product_template_id` | `string` | No | ObjectId of the SMS template used for the expected-product event notification |
| `send_by_sms` | `boolean` | No | Whether to send expected-product notifications via SMS |
| `send_by_bot` | `boolean` | No | Whether to send expected-product notifications via Telegram bot |
| `integration_id` | `string` | No | ObjectId of the SMS integration to use for outgoing messages |

```json
{
  "expected_product_template_id": "string",
  "send_by_sms": false,
  "send_by_bot": false,
  "integration_id": "string"
}
```

**Response**

Same response shape as [GET /marketing-settings/get](#get-marketing-settings-get).

---

*This page is generated from the OpenAPI spec.*
