Skip to content
View as Markdown

Sms template ​

SMS message templates

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 /sms-template/create ​

Create a new SMS template for the tenant.

Required permission: sms_template · how permissions work

Example request

bash
curl -X POST 'https://api.bito.uz/integration-api/integration/api/v2/sms-template/create' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "content": "string"
}'
js
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/sms-template/create', {
  method: 'POST',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "content": "string"
  }),
})
const { code, data } = await res.json()
python
import os
import requests

res = requests.request(
    "POST",
    "https://api.bito.uz/integration-api/integration/api/v2/sms-template/create",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "content": "string",
    },
)
print(res.json())
php
<?php
$body = <<<'JSON'
{
  "content": "string"
}
JSON;

$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/sms-template/create');
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

FieldTypeRequiredDescription
contentstringYesSMS message body text. System variables: {name}, {phone_number}, {balance}. A customer custom field is referenced as {{<field name>}} (e.g. {{Mijoz mamlakati}}; case, spaces and underscores are ignored) and is stored as {{cf.<custom_field_id>}}, so renaming the field does not break the template. {{cf.<custom_field_id>}} is accepted as-is. A {{...}} that names no customer custom field is rejected with error code 116002.
json
{
  "content": "string"
}

Response

FieldTypeDescription
_idstringSMS template ObjectId
account_idstringTenant identifier (immutable, injected server-side)
contentstringSMS message body text. Customer custom-field variables are returned as {{cf.<custom_field_id>}}.
is_deletedbooleanSoft-delete flag
created_atstring (date-time)Creation timestamp (ISO 8601)
updated_atstring (date-time)Last update timestamp (ISO 8601)
created_bystringObjectId of the user who created this template
updated_bystringObjectId of the user who last updated this template
json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": {
    "_id": "string",
    "account_id": "string",
    "content": "string",
    "is_deleted": false,
    "created_at": "2025-05-01T12:00:00Z",
    "updated_at": "2025-05-01T12:00:00Z",
    "created_by": "string",
    "updated_by": "string"
  },
  "time": "2025-05-01T12:00:00Z"
}

GET /sms-template/get-by-id/{id} ​

Fetch a single SMS template by ObjectId.

Required permission: sms_template · how permissions work

Example request

bash
curl -X GET 'https://api.bito.uz/integration-api/integration/api/v2/sms-template/get-by-id/6712f0a9c4d1e87b3a0f9911' \
  -H "api-key: $BITO_API_KEY"
js
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/sms-template/get-by-id/6712f0a9c4d1e87b3a0f9911', {
  method: 'GET',
  headers: { 'api-key': process.env.BITO_API_KEY },
})
const { code, data } = await res.json()
python
import os
import requests

res = requests.request(
    "GET",
    "https://api.bito.uz/integration-api/integration/api/v2/sms-template/get-by-id/6712f0a9c4d1e87b3a0f9911",
    headers={"api-key": os.environ["BITO_API_KEY"]},
)
print(res.json())
php
<?php
$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/sms-template/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

ParameterTypeRequiredDescription
idstringYesSMS template ObjectId

Request body

No request body.

Response

Same response shape as POST /sms-template/create.

POST /sms-template/get-paging ​

Paginated list of SMS templates scoped to the tenant.

Required permission: sms_template · how permissions work

Example request

bash
curl -X POST 'https://api.bito.uz/integration-api/integration/api/v2/sms-template/get-paging' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "page": 1,
  "limit": 20
}'
js
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/sms-template/get-paging', {
  method: 'POST',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "page": 1,
    "limit": 20
  }),
})
const { code, data } = await res.json()
python
import os
import requests

res = requests.request(
    "POST",
    "https://api.bito.uz/integration-api/integration/api/v2/sms-template/get-paging",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "page": 1,
        "limit": 20,
    },
)
print(res.json())
php
<?php
$body = <<<'JSON'
{
  "page": 1,
  "limit": 20
}
JSON;

$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/sms-template/get-paging');
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

FieldTypeRequiredDescription
pagenumberYesDefault: 1
limitnumberYesDefault: 20
json
{
  "page": 1,
  "limit": 20
}

Response

FieldTypeDescription
totalnumber
listobject[]
list[]._idstringSMS template ObjectId
list[].account_idstringTenant identifier (immutable, injected server-side)
list[].contentstringSMS message body text. Customer custom-field variables are returned as {{cf.<custom_field_id>}}.
list[].is_deletedbooleanSoft-delete flag
list[].created_atstring (date-time)Creation timestamp (ISO 8601)
list[].updated_atstring (date-time)Last update timestamp (ISO 8601)
list[].created_bystringObjectId of the user who created this template
list[].updated_bystringObjectId of the user who last updated this template
json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": {
    "total": 0,
    "list": [
      {
        "_id": "string",
        "account_id": "string",
        "content": "string",
        "is_deleted": false,
        "created_at": "2025-05-01T12:00:00Z",
        "updated_at": "2025-05-01T12:00:00Z",
        "created_by": "string",
        "updated_by": "string"
      }
    ]
  },
  "time": "2025-05-01T12:00:00Z"
}

PUT /sms-template/update/{id} ​

Update an existing SMS template by ObjectId.

Required permission: sms_template · how permissions work

Example request

bash
curl -X PUT 'https://api.bito.uz/integration-api/integration/api/v2/sms-template/update/6712f0a9c4d1e87b3a0f9911' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "content": "string"
}'
js
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/sms-template/update/6712f0a9c4d1e87b3a0f9911', {
  method: 'PUT',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "content": "string"
  }),
})
const { code, data } = await res.json()
python
import os
import requests

res = requests.request(
    "PUT",
    "https://api.bito.uz/integration-api/integration/api/v2/sms-template/update/6712f0a9c4d1e87b3a0f9911",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "content": "string",
    },
)
print(res.json())
php
<?php
$body = <<<'JSON'
{
  "content": "string"
}
JSON;

$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/sms-template/update/6712f0a9c4d1e87b3a0f9911');
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);

Path parameters

ParameterTypeRequiredDescription
idstringYesSMS template ObjectId

Request body

FieldTypeRequiredDescription
contentstringYesSMS message body text. System variables: {name}, {phone_number}, {balance}. A customer custom field is referenced as {{<field name>}} (e.g. {{Mijoz mamlakati}}; case, spaces and underscores are ignored) and is stored as {{cf.<custom_field_id>}}, so renaming the field does not break the template. {{cf.<custom_field_id>}} is accepted as-is. A {{...}} that names no customer custom field is rejected with error code 116002.
json
{
  "content": "string"
}

Response

Same response shape as POST /sms-template/create.

DELETE /sms-template/delete/{id} ​

Soft-delete an SMS template by ObjectId (sets is_deleted=true).

Required permission: sms_template · how permissions work

Example request

bash
curl -X DELETE 'https://api.bito.uz/integration-api/integration/api/v2/sms-template/delete/6712f0a9c4d1e87b3a0f9911' \
  -H "api-key: $BITO_API_KEY"
js
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/sms-template/delete/6712f0a9c4d1e87b3a0f9911', {
  method: 'DELETE',
  headers: { 'api-key': process.env.BITO_API_KEY },
})
const { code, data } = await res.json()
python
import os
import requests

res = requests.request(
    "DELETE",
    "https://api.bito.uz/integration-api/integration/api/v2/sms-template/delete/6712f0a9c4d1e87b3a0f9911",
    headers={"api-key": os.environ["BITO_API_KEY"]},
)
print(res.json())
php
<?php
$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/sms-template/delete/6712f0a9c4d1e87b3a0f9911');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'DELETE',
    CURLOPT_HTTPHEADER => ['api-key: ' . getenv('BITO_API_KEY')],
    CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);

Path parameters

ParameterTypeRequiredDescription
idstringYesSMS template ObjectId

Request body

No request body.

Response

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

This page is generated from the OpenAPI spec.

Bito 2.0 Integration API