Send an Email v 3.0 crm.[type].activity.email.send
Choose a tool for developing with an AI agent:
- use Alaio Vibecode to build an app for Bitrix24 from a task description without knowing any programming language. The agent writes the code and deploys the app to a server, with no manual hosting setup
- use the MCP server to develop a REST API integration in your own project. The agent refers to the official REST documentation
Scope:
crmWho can execute the method: a user with permission to edit the CRM item and an available mailbox or sender address
This method belongs to REST 3.0. The call specifics and response format of the new API version are described in the REST 3.0 Overview.
Sends an email from a CRM item and retains it as an activity of that item. Sends the email to the recipients immediately and returns it in the same format as the crm.<type>.activity.email.get method.
The sent email:
- is retained as a completed outgoing activity, with the user who called the method as the responsible person
- is bound to the item specified in
ownerId - links each recipient address to a CRM item: the item's contact or company if they have this address, or otherwise the item itself. The links are returned in
communications
The method supports the Idempotency-Key header: repeating a request with the same key returns the same email without sending it again. For details, see Repeat Calls without Duplicates.
To reply to an email in the same thread, use the crm.activity.email.reply method.
Method Name for the Object Type
|
Object Type |
Method |
|
Deal |
|
|
Lead |
|
|
Contact |
|
|
Company |
|
|
Estimate |
|
|
Invoice |
|
|
CRM Document |
|
|
SPA |
|
For an SPA, substitute its type ID entityTypeId in the method name. SPA type IDs entityTypeId are returned by the crm.smartprocess.list method.
The method name is written in lowercase: crm.smartinvoice.activity.email.send, rather than crm.smartInvoice.activity.Email.send. A name with different capitalization returns the Method Not Found error.
Method Parameters
Required parameters are marked with *
|
Name |
Description |
|
fields* |
Email fields. Required fields are |
Parameter fields
|
Name |
Description |
|
ownerId* |
ID of the CRM item the email is sent from. The item must belong to the object type specified in the method name. This field is not returned in the response. The ID can be retrieved with the crm.<type>.list method |
|
subject* |
Email subject. If an empty string is passed, Bitrix24 takes the subject from the beginning of the email text, or uses |
|
to* |
Recipient addresses, at least one. Pass an address as a string: |
|
body* |
Email body: plain text or HTML. Empty strings and whitespace-only strings are not accepted. Unsafe HTML markup is removed, and a signature is added if enabled in the mail settings |
|
cc |
CC addresses. Addresses already in |
|
bcc |
BCC addresses. Addresses already in |
|
from |
Sender address, for example, Default: the CRM address from the settings if it is available to the user; otherwise, the first available address |
|
senderId |
ID of a sender address verified without connecting a mailbox. Use with |
|
mailboxId |
ID of the connected mailbox. Use with |
Usually, from is sufficient: the method finds the mailbox or sender with this address automatically. The senderId and mailboxId parameters are needed only to select a specific mailbox or sender when the same address is available to the user in several ways. These parameters do not work without from: the method returns CRM_EMAIL_SENDER_NOT_AVAILABLE.
If the address in from does not belong to a connected mailbox, the email is still sent, but a copy does not appear in the mailbox's sent folder.
The method validates addresses before sending. If any address is invalid or on the mail blacklist, or the recipient limit is exceeded, the email is not sent and no activity is created. The total number of addresses in to, cc, and bcc is limited; the limit is specified in the error message. The plan may also limit the number of addresses in each field.
Code Examples
How to Use Examples in Documentation
The new API call differs by adding the /api/ segment to the request URL:
https://{installation_address}/rest/api/{user_id}/{webhook_token}/crm.deal.activity.email.send
The examples send an email to a customer from a deal. For another object type, replace the method name using the table above.
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Idempotency-Key: 7f2d3d50-9235-4e56-b768-b8a78c58e4f2" \
-d '{"fields":{"ownerId":741,"subject":"Sales Proposal","to":["client@example.com"],"body":"Hello! Here is our sales proposal.","from":"sales@example.com"}}' \
https://**put_your_bitrix24_address**/rest/api/**put_your_user_id_here**/**put_your_webhook_here**/crm.deal.activity.email.send
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Idempotency-Key: 7f2d3d50-9235-4e56-b768-b8a78c58e4f2" \
-d '{"fields":{"ownerId":741,"subject":"Sales Proposal","to":["client@example.com"],"body":"Hello! Here is our sales proposal.","from":"sales@example.com"},"auth":"**put_access_token_here**"}' \
https://**put_your_bitrix24_address**/rest/api/crm.deal.activity.email.send
CRM methods are not yet included in the list of REST 3.0 methods known to $b24.actions.v3.call.make: such a call returns the SDK error JSSDK_CORE_METHOD_NOT_SUPPORT_IN_API_V3. Call the method through the REST 3.0 HTTP client — $b24.getHttpClient(ApiVersion.v3).call.
import { ApiVersion, Text } from '@bitrix24/b24jssdk'
import type { B24Frame } from '@bitrix24/b24jssdk'
declare const $b24: B24Frame
type EmailSendResult = {
item: {
id: number
subject: string
from: string | null
to: string[] | null
createdTime: string
communications: Array<{ type: string; value: string | null; entityTypeId: number | null; entityId: number | null }>
}
}
try {
const response = await $b24.getHttpClient(ApiVersion.v3).call<EmailSendResult>(
'crm.deal.activity.email.send',
{
fields: {
ownerId: 741,
subject: 'Sales Proposal',
to: ['client@example.com'],
body: 'Hello! Here is our sales proposal.',
from: 'sales@example.com',
},
},
Text.getUuidRfc4122()
)
if (!response.isSuccess) {
console.error(response.getErrorMessages().join('; '))
} else {
const result = response.getData()!.result
console.info('Email sent:', result.item.id)
}
} catch (error) {
// Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
console.error(error)
}
CRM methods are not yet included in the list of REST 3.0 methods known to $b24.actions.v3.call.make. Call the method through the REST 3.0 HTTP client — $b24.getHttpClient(B24Js.ApiVersion.v3).call.
<script src="https://unpkg.com/@bitrix24/b24jssdk@1/dist/umd/index.min.js"></script>
<script>
async function sendEmail() {
try {
const $b24 = await B24Js.initializeB24Frame()
const response = await $b24.getHttpClient(B24Js.ApiVersion.v3).call(
'crm.deal.activity.email.send',
{
fields: {
ownerId: 741,
subject: 'Sales Proposal',
to: ['client@example.com'],
body: 'Hello! Here is our sales proposal.',
from: 'sales@example.com',
},
},
B24Js.Text.getUuidRfc4122()
)
if (!response.isSuccess) {
console.error(response.getErrorMessages().join('; '))
return
}
const result = response.getData().result
console.info('Email sent:', result.item.id)
} catch (error) {
// Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
console.error(error)
}
}
document.addEventListener('DOMContentLoaded', sendEmail)
</script>
CRM methods have no ready-made wrappers in b24pysdk, and the SDK sends only methods from the Config().api_v3_methods list to REST 3.0. Add the method to this list and call it through bitrix_token.call_method with prefer_version=3.
from b24pysdk import Config
from b24pysdk.errors import BitrixSDKException
from b24pysdk.errors.v3 import BitrixAPIError
method = "crm.deal.activity.email.send"
Config().configure(api_v3_methods=Config().api_v3_methods | {method})
try:
response = bitrix_token.call_method(
api_method=method,
params={
"fields": {
"ownerId": 741,
"subject": "Sales Proposal",
"to": ["client@example.com"],
"body": "Hello! Here is our sales proposal.",
"from": "sales@example.com",
},
},
prefer_version=3,
)
result = response["result"]
print(result)
except BitrixAPIError as error:
print(
"Bitrix API error",
f"code: {error.code}",
f"message: {error.error.message}",
sep="\n",
)
except BitrixSDKException as error:
print(f"Bitrix SDK error: {error.message}")
except Exception as error:
print(f"Unexpected error: {error}")
The SDK does not yet support calls to /rest/api/. Use a direct HTTP request, for example, through cURL or fetch.
try {
$response = $b24Service
->core
->call(
'crm.deal.activity.email.send',
[
'fields' => [
'ownerId' => 741,
'subject' => 'Sales Proposal',
'to' => ['client@example.com'],
'body' => 'Hello! Here is our sales proposal.',
'from' => 'sales@example.com',
],
]
);
$result = $response
->getResponseData()
->getResult();
print_r($result);
} catch (Throwable $e) {
echo $e->getMessage();
}
The SDK does not yet support calls to /rest/api/. Use a direct HTTP request, for example, through cURL or fetch.
BX24.callMethod(
'crm.deal.activity.email.send',
{
fields: {
ownerId: 741,
subject: 'Sales Proposal',
to: ['client@example.com'],
body: 'Hello! Here is our sales proposal.',
from: 'sales@example.com',
},
},
result => {
if (result.error())
console.error(result.error());
else
console.dir(result.data());
}
);
The SDK does not yet support calls to /rest/api/. Use a direct HTTP request, for example, through cURL or fetch.
require_once('crest.php');
$result = CRest::call(
'crm.deal.activity.email.send',
[
'fields' => [
'ownerId' => 741,
'subject' => 'Sales Proposal',
'to' => ['client@example.com'],
'body' => 'Hello! Here is our sales proposal.',
'from' => 'sales@example.com',
],
]
);
echo '<PRE>';
print_r($result);
echo '</PRE>';
// client and ctx have already been created — see the "SDK for Go" section
res, err := client.Core().Call(ctx, "crm.deal.activity.email.send", b24.Params{
"fields": b24.Params{
"ownerId": 741,
"subject": "Sales Proposal",
"to": []string{"client@example.com"},
"body": "Hello! Here is our sales proposal.",
"from": "sales@example.com",
},
})
if err != nil {
return fmt.Errorf("crm.deal.activity.email.send: %w", err)
}
var result struct {
Item struct {
ID int `json:"id"`
Subject string `json:"subject"`
From *string `json:"from"`
To []string `json:"to"`
CreatedTime string `json:"createdTime"`
} `json:"item"`
}
if err := json.Unmarshal(res.Result, &result); err != nil {
return fmt.Errorf("parsing the response: %w", err)
}
fmt.Println(result.Item.ID, result.Item.Subject)
Response Handling
HTTP status: 200
{
"result": {
"item": {
"subject": "Sales Proposal",
"direction": "outgoing",
"communications": [
{
"type": "EMAIL",
"value": "client@example.com",
"entityTypeId": 2,
"entityId": 741
}
],
"from": "sales@example.com",
"to": [
"client@example.com"
],
"cc": [],
"bcc": [],
"parentActivityId": null,
"body": "Hello! Here is our sales proposal.\n\nSent from Bitrix24",
"isBodyTruncated": false,
"id": 8695,
"providerId": "CRM_EMAIL",
"isCompleted": true,
"assignedById": 1,
"authorId": 1,
"editorId": 1,
"createdTime": "2026-11-27T12:41:49+03:00",
"updatedTime": "2026-11-27T12:41:50+03:00",
"startTime": "2026-11-27T12:41:49+03:00",
"endTime": "2026-11-27T12:41:49+03:00",
"deadlineTime": "2026-11-27T12:41:49+03:00",
"bindings": [
{
"entityTypeId": 2,
"entityId": 741
}
]
}
},
"time": {
"start": 1795772508,
"finish": 1795772510.740127,
"duration": 2.7401270866394043,
"processing": 1,
"date_start": "2026-11-27T12:41:48+03:00",
"date_finish": "2026-11-27T12:41:50+03:00",
"operating_reset_at": 1795773060,
"operating": 1.3997678756713867
}
}
Returned Data
|
Name |
Description |
|
result |
Response data object |
|
result.item |
The sent email with all fields, including the email text in |
|
time |
Request execution time information |
Error Handling
HTTP status: 400
{
"error": {
"code": "CRM_EMAIL_SENDER_NOT_AVAILABLE",
"message": "Sender email is not available for this user."
}
}
|
Name |
Description |
|
error.code |
String error code. Use it to identify the type of exception |
|
error.message |
Text description of the error |
|
error.validation |
Array with error details. Present only in data validation errors |
|
error.validation[].field |
Name of the field where the validation error occurred |
|
error.validation[].message |
Description of the error related to the specified field |
Possible Error Codes
Request Validation Errors
Error code: BITRIX_REST_V3_EXCEPTION_VALIDATION_REQUESTVALIDATIONEXCEPTION
|
Field |
Error Description |
How to Fix |
|
|
Required field |
Pass the email fields in |
|
|
to must contain at least one email address. |
Pass at least one address in |
|
|
to must contain email addresses only. |
Remove empty strings from |
|
|
This request requires data type |
Pass the addresses as an array, even for a single address: |
|
|
body must be a non-empty string. |
Pass the email text in |
|
|
This request requires data type |
Pass the item ID as a number |
Field Validation Errors
Error code: BITRIX_REST_V3_EXCEPTION_VALIDATION_DTOVALIDATIONEXCEPTION
|
Field |
Error Description |
How to Fix |
|
|
Required field "subject" is empty |
Pass the email subject. The method validates |
|
|
Field value must be 1 or greater |
Pass a positive item ID. The method validates |
|
|
Incorrect argument type |
Pass the addresses as strings |
|
|
Field "id" is read-only |
Remove fields from |
Unknown Field Error
Error code: BITRIX_REST_V3_EXCEPTION_UNKNOWNDTOPROPERTYEXCEPTION
|
Field |
Error Description |
How to Fix |
|
|
Unknown field |
Check the field names in |
Item Not Found
Error code: BITRIX_REST_V3_EXCEPTION_ENTITYNOTFOUNDEXCEPTION
|
Field |
Error Description |
How to Fix |
|
|
Entity with ID |
The item from |
Invalid Recipient Address
Error code: CRM_EMAIL_INVALID_RECIPIENT
|
Field |
Error Description |
How to Fix |
|
|
Invalid recipient email(s): to: not-an-email |
Correct the addresses listed in the error message. The method validates |
Blacklisted Address
Error code: CRM_EMAIL_RECIPIENT_BLACKLISTED
|
Field |
Error Description |
How to Fix |
|
|
Some recipients are in the global mail blacklist: |
Remove addresses on the mail blacklist from the recipients |
Limit Exceeded
Error code: CRM_EMAIL_TOO_MANY_RECIPIENTS
|
Field |
Error Description |
How to Fix |
|
|
Too many recipients: |
Reduce the total number of addresses in |
|
|
Bitrix24 mail-sending limit reached for this portal. |
The Bitrix24 email sending limit has been reached. Try again later |
|
|
Bitrix24 custom mail-sending limit reached for this portal. |
The email sending limit set by the Bitrix24 administrator has been reached. Try again later |
Sender Unavailable
Error code: CRM_EMAIL_SENDER_NOT_AVAILABLE
|
Field |
Error Description |
How to Fix |
|
|
No available email sender is configured for this user. |
The user has no mailbox or sender address. Connect a mailbox in Bitrix24 |
|
|
Sender email is not available for this user. |
The address in |
Invalid Sender Address
Error code: CRM_EMAIL_INVALID_FROM
|
Field |
Error Description |
How to Fix |
|
|
Sender email is not available for this user. |
The value of |
|
|
Cannot resolve a valid "from" address. |
The selected sender's address is invalid. Pass another available address in |
Email Not Sent
Error code: CRM_EMAIL_SEND_FAILED
|
Field |
Error Description |
How to Fix |
|
|
Tariff restriction: cannot send to more than |
The plan limits the number of addresses per field. Reduce the number of addresses in |
|
|
Failed to send the email through the Bitrix mail system. |
The email was not sent, and its activity was deleted. Try again later |
Mail Unavailable
Error code: CRM_EMAIL_MAIL_MODULE_UNAVAILABLE
|
Field |
Error Description |
How to Fix |
|
|
The "mail" module is not available. |
Mail is unavailable in this Bitrix24 |
Idempotency Key Reused
Error code: BITRIX_REST_V3_EXCEPTION_IDEMPOTENCYKEYREUSEDEXCEPTION, HTTP status 422
|
Field |
Error Description |
How to Fix |
|
|
Idempotency-Key was previously used with a different request body. Use a new key for a different request. |
Pass a new |
Access Error
Error code: BITRIX_REST_V3_EXCEPTION_ACCESSDENIEDEXCEPTION, HTTP status 403
|
Field |
Error Description |
How to Fix |
|
|
Access denied |
For |
Method Not Found
Error code: BITRIX_REST_V3_EXCEPTION_METHODNOTFOUNDEXCEPTION, HTTP status 404
|
Field |
Error Description |
How to Fix |
|
|
Method |
Check the method name: it is written in lowercase, for example, |
Statuses and System Error Codes
HTTP Status: 4xx, 5xx
The errors described below are returned by the REST API itself, not by the logic of a specific method. They can arrive in response to any method.
|
Status |
Code |
Description |
|
|
|
An internal server error has occurred. Retry the call, and if the error persists, contact the server administrator or Bitrix24 technical support |
|
|
|
The server returned an unexpected response. Retry the call, and if the error persists, contact the server administrator or Bitrix24 technical support |
|
|
|
The request intensity limit has been exceeded |
|
|
|
The SQL query inside the method ran longer than the SQL query time limit. The |
|
|
|
The method is blocked because the request resource intensity limit has been exceeded. The block lasts 5 minutes, after which the accumulated execution time of the method is counted from zero |
|
|
|
The same block in REST 3.0 methods. The |
|
|
|
The request contains no authorization data: neither an access token nor a webhook code was passed |
|
|
|
Methods are called over the HTTPS protocol only |
|
|
|
The REST API is blocked due to overload. This is a manual individual block. To have it lifted, contact Bitrix24 technical support |
|
|
|
REST API access is not active for this account. In Bitrix24 Cloud, check the current plan or trial status: Vibe+ plans include REST API access, while Essentials plans do not. A webhook receives a different error message — |
|
|
|
The Bitrix24 Market application is blocked because the number of installed applications exceeds the plan limit. Events are not delivered to such an application. Applications exempt from the limit are not blocked |
|
|
|
No active webhook with the specified user identifier and secret code was found |
|
|
|
No method with this name was found. The name is misspelled, the method does not exist in the REST API, or it is unavailable without the required scope |
|
|
|
The request requires broader permissions than the token has: for a webhook these are the permissions granted to it, for an application it is the scope. For an application, the error message ends with |
|
|
|
The access token has expired |
|
|
|
The application is installed, but the Bitrix24 administrator has granted access to it only to specific users |
|
|
|
The public part of the site is closed. To open it on an on-premise installation, disable the "Temporary closure of the public part of the site" option. Path to the setting: Desktop > Settings > Product Settings > Module Settings > Main Module > Temporary closure of the public part of the site |