{% note tip "" %}
If you are developing integrations for Bitrix24 using AI tools (Codex, Claude Code, Cursor), connect to the MCP server so that the assistant can utilize the official REST documentation.
{% endnote %}
Scope:
crmWho can execute the method: administrator
This method adds a new Icon.
{% include Note on required parameters %}
#|
|| Name
type | Description ||
|| code*
string | Icon code (for example, info) ||
|| fileContent*
string | Encoded base64 content of the icon file.
File requirements:
- Type — png
- Size — 24x24 pixels
- Background — transparent
|| |#
{% include Note on examples %}
{% list tabs %}
-
cURL (Webhook)
curl -X POST \ -H "Content-Type: application/json" \ -H "Accept: application/json" \ -d '{"code":"info","fileContent":"iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAIAAABvFaqvAAABhWlDQ1BJQ0MgcHJvZmlsZQAAKJF9kT1Iw0AcxV9TRdGqgx1UHDLUgmBBVMRRq1CECqFWaNXB5NIvaNKQpLg4Cq4FBz8Wqw4uzro6uAqC4AeIo5OToouU"}' \ https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/crm.timeline.icon.add
-
cURL (OAuth)
curl -X POST \ -H "Content-Type: application/json" \ -H "Accept: application/json" \ -d '{"code":"info","fileContent":"iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAIAAABvFaqvAAABhWlDQ1BJQ0MgcHJvZmlsZQAAKJF9kT1Iw0AcxV9TRdGqgx1UHDLUgmBBVMRRq1CECqFWaNXB5NIvaNKQpLg4Cq4FBz8Wqw4uzro6uAqC4AeIo5OToouU","auth":"**put_access_token_here**"}' \ https://**put_your_bitrix24_address**/rest/crm.timeline.icon.add
-
JS (TS)
// This snippet is an ES module: top-level await requires type="module" or a bundler. // $b24 is an already-initialized SDK instance (see the SDK "Get started" guide). import { Text } from '@bitrix24/b24jssdk' import type { B24Frame } from '@bitrix24/b24jssdk' declare const $b24: B24Frame // Shape of the payload returned in result (match the "response handling" section of the page) type AddIconResult = { icon: { code: string isSystem: boolean fileUri: string } } try { const response = await $b24.actions.v2.call.make<AddIconResult>({ method: 'crm.timeline.icon.add', params: { code: 'info', fileContent: 'iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAIAAABvFaqvAAABhWlDQ1BJQ0MgcHJvZmlsZQAAKJF9kT1Iw0AcxV9TRdGqgx1UHDLUgmBBVMRRq1CECqFWaNXB5NIvaNKQpLg4Cq4FBz8Wqw4uzro6uAqC4AeIo5OToouU', }, requestId: Text.getUuidRfc4122() }) // The payload is available only on a successful response if (!response.isSuccess) { console.error(response.getErrorMessages().join('; ')) } else { const result = response.getData()!.result console.info(result.icon) } } catch (error) { // Thrown on transport or SDK failures (AjaxError, SdkError, etc.) console.error(error) }
-
JS (UMD)
<!-- Load the SDK (UMD build); it is exposed as the global B24Js --> <script src="https://unpkg.com/@bitrix24/b24jssdk@1/dist/umd/index.min.js"></script> <script> async function addIcon() { try { // Initialize the SDK inside a Bitrix24 frame const $b24 = await B24Js.initializeB24Frame() const response = await $b24.actions.v2.call.make({ method: 'crm.timeline.icon.add', params: { code: 'info', fileContent: 'iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAIAAABvFaqvAAABhWlDQ1BJQ0MgcHJvZmlsZQAAKJF9kT1Iw0AcxV9TRdGqgx1UHDLUgmBBVMRRq1CECqFWaNXB5NIvaNKQpLg4Cq4FBz8Wqw4uzro6uAqC4AeIo5OToouU', }, requestId: B24Js.Text.getUuidRfc4122() }) // The payload is available only on a successful response if (!response.isSuccess) { console.error(response.getErrorMessages().join('; ')) return } const result = response.getData().result console.info(result.icon) } catch (error) { // Thrown on transport or SDK failures (AjaxError, SdkError, etc.) console.error(error) } } document.addEventListener('DOMContentLoaded', addIcon) </script>
-
Python
from b24pysdk.errors import BitrixAPIError, BitrixSDKException try: bitrix_response = client.crm.timeline.icon.add( code="info", file_content="iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAIAAABvFaqvAAABhWlDQ1BJQ0MgcHJvZmlsZQAAKJF9kT1Iw0AcxV9TRdGqgx1UHDLUgmBBVMRRq1CECqFWaNXB5NIvaNKQpLg4Cq4FBz8Wqw4uzro6uAqC4AeIo5OToouU", ) result = bitrix_response.response.result print(result) except BitrixAPIError as error: print( "Bitrix API Error", f"error: {error.error}", f"error_description: {error.error_description}", sep="\n", ) except BitrixSDKException as error: print(f"Bitrix SDK Error: {error.message}") except Exception as error: print(f"Unexpected error: {error}")
-
PHP
try { $response = $b24Service ->core ->call( 'crm.timeline.icon.add', [ 'code' => 'info', 'fileContent' => 'iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAIAAABvFaqvAAABhWlDQ1BJQ0MgcHJvZmlsZQAAKJF9kT1Iw0AcxV9TRdGqgx1UHDLUgmBBVMRRq1CECqFWaNXB5NIvaNKQpLg4Cq4FBz8Wqw4uzro6uAqC4AeIo5OToouU', ] ); $result = $response ->getResponseData() ->getResult(); if ($result->error()) { error_log($result->error()); } else { echo 'Success: ' . print_r($result->data(), true); } } catch (Throwable $e) { error_log($e->getMessage()); echo 'Error adding timeline icon: ' . $e->getMessage(); }
-
BX24.js
BX24.callMethod( "crm.timeline.icon.add", { code: "info", fileContent: "iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAIAAABvFaqvAAABhWlDQ1BJQ0MgcHJvZmlsZQAAKJF9kT1Iw0AcxV9TRdGqgx1UHDLUgmBBVMRRq1CECqFWaNXB5NIvaNKQpLg4Cq4FBz8Wqw4uzro6uAqC4AeIo5OToouU", }, result => { if (result.error()) console.error(result.error()); else console.dir(result.data()); } );
-
PHP CRest
require_once('crest.php'); $result = CRest::call( 'crm.timeline.icon.add', [ 'code' => 'info', 'fileContent' => 'iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAIAAABvFaqvAAABhWlDQ1BJQ0MgcHJvZmlsZQAAKJF9kT1Iw0AcxV9TRdGqgx1UHDLUgmBBVMRRq1CECqFWaNXB5NIvaNKQpLg4Cq4FBz8Wqw4uzro6uAqC4AeIo5OToouU' ] ); echo '<PRE>'; print_r($result); echo '</PRE>';
-
Go
// client and ctx are already created — see the Go SDK section res, err := client.Core().Call(ctx, "crm.timeline.icon.add", b24.Params{ "code": "info", "fileContent": "iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAIAAABvFaqvAAABhWlDQ1BJQ0MgcHJvZmlsZQAAKJF9kT1Iw0AcxV9TRdGqgx1UHDLUgmBBVMRRq1CECqFWaNXB5NIvaNKQpLg4Cq4FBz8Wqw4uzro6uAqC4AeIo5OToouU", }) if err != nil { return fmt.Errorf("crm.timeline.icon.add: %w", err) } // The method wraps the response in an object with the "icon" key. raw, ok := b24.Unwrap(res.Result, "icon") if !ok { return fmt.Errorf("no icon key in the response") } var item struct { Code string `json:"code"` IsSystem bool `json:"isSystem"` FileUri string `json:"fileUri"` } if err := json.Unmarshal(raw, &item); err != nil { return fmt.Errorf("parse response: %w", err) } fmt.Println(item.Code, item.IsSystem)
{% endlist %}
HTTP status: 200
{
"result": {
"icon": {
"code": "info",
"isSystem": false,
"fileUri": "/upload/crm/13f/huhnvzds7ckoy6mk5mdze9pb7jqscpxi/e66fm2cbau9f8u32oe9jzx2qflqhj2vv"
}
},
"time": {
"start": 1712132792.910734,
"finish": 1712132793.530359,
"duration": 0.6196250915527344,
"processing": 0.032338857650756836,
"date_start": "2024-04-03T10:26:32+02:00",
"date_finish": "2024-04-03T10:26:33+02:00",
"operating_reset_at": 1705765533,
"operating": 3.3076241016387939
}
}#|
|| Name
type | Description ||
|| result
object | Root element of the response.
The result field contains the icon object ||
|| time
time | Information about the request execution time ||
|#
#|
|| Field
type | Description ||
||code | Icon code ||
||isSystem | Flag field.
Can have the value:
true— if the icon is standard (provided in the product)false— if the icon was added by the user
|| ||fileUri | Path to the file.
If the icon was added by the user, the field contains the path to the icon image file || |#
HTTP status: 400
{
"error": "ACCESS_DENIED",
"error_description": "Access denied"
}{% include notitle Error handling %}
#|
|| Code | Description ||
|| ACCESS_DENIED | Access denied ||
|| INVALID_ARG_VALUE | Invalid fileContent parameter specified ||
|| FILE_SAVE_ERROR | Unable to save the provided icon file ||
|| 100 | Required fields are not provided ||
|| 0 | Other errors (e.g., fatal) ||
|#
{% include System errors %}