Skip to main content

HTTP Push

Aqara Studio supports real-time delivery of device data, object events, and alarms via HTTP Push. Simply configure a global webhook URL in the Studio, and Studio will send messages one by one to the specified address using HTTP POST.

This feature is suitable for the following scenarios:

  • Synchronize device data to your own platform, data center, or alarm center.
  • Receive object events such as device addition, deletion, and space changes in third-party systems.

How Does HTTP Push Work in Aqara Studio?​

Aqara Studio's HTTP Push follows a "Studio proactively delivers, third-party service acknowledges" model:

  1. In Aqara Studio, configure the receiving address, set the response validation rule, and select the event types to subscribe to; optional header fields and signature settings can also be added if needed.

    • By default, the response validation rule uses "Studio standard acknowledgment."
    • If you only need to verify that the HTTP status code is 200, select "HTTP Status Code 200 Only."
  2. After saving the above configuration, Aqara Studio will immediately send a WebhookVerification message (HTTP POST) to your configured address to verify its availability.

  3. If the response validation rule is Studio standard acknowledgment, you must return a response containing a code of 0 and a challenge field set to the data.challenge in the WebhookVerification message. This indicates a successful receipt, and the address passes verification. Only then will Aqara Studio enable HTTP Push.

    For other response validation modes, refer to the [returning WebhookVerification response](#returning-a webhookVerification-response) section for instructions on how to write the response message.

    Only after the above verification succeeds, Aqara Studio enables HTTP Push and begins event delivery. If verification fails, the existing configuration is retained.

  4. When a subscribed event occurs, Aqara Studio will send an HTTP POST request to your configured endpoint as per your settings.

    Each request body contains only a single message, in JSON format.

  5. After receiving a message, you should respond with a message containing a code of 0, indicating success.

tip

HTTP Push is a real-time, best-effort delivery mechanism. It does not provide persistent message queues, historical message re-delivery, or guarantee global order.

Receiver Requirements​

Before implementing HTTP Push, please ensure your receiver meets the following requirements:

  • The URL must be an absolute http or https URL that includes a host, must not exceed 4,096 bytes when UTF-8 encoded, and must not contain whitespace. User information, query strings, and fragments are not allowed, and an explicit port must be between 1 and 65,535. Studio preserves consecutive slashes and existing percent-encoded sequences in the path and does not follow redirects.
  • For HTTPS, the certificate chain, validity period, and hostname are validated. The certificate must be trusted by the JVM running Studio, and certificate validation cannot be disabled.
  • Requests use Content-Type: application/json; charset=utf-8 and Accept-Encoding: identity. Response validation modes that inspect the body do not support compressed responses such as gzip or br. The "HTTP Status Code 200 Only" mode does not read or validate the response body or its encoding.
  • Fixed header names are case-insensitive, and the X-Studio-* prefix is not added automatically. The following header names are not allowed: X-Studio-*, Proxy-*, Host, Content-Length, Transfer-Encoding, Content-Encoding, Content-Type, Accept-Encoding, Connection, Expect, TE, Trailer, and Upgrade.

Supported Message Types​

Aqara Studio will send the following message types to your receiver:

tip

In the table below, data.eventType is a field specific to objectEvent messages and is used to distinguish concrete event types. Other message types do not have this field. For the common fields of HTTP Push request messages, see Message Field Descriptions.

Message type (type)data.eventTypeSend condition
WebhookVerification-Endpoint verification and circuit-breaker recovery probes.
TraitValueUpdate-Device point value changes; sent when the "Device Data and Structure Events" group is enabled (enabled by default).
objectEvent
  • DEVICE_ADDED
  • DEVICE_REMOVED
Sent by default after push is enabled; not affected by other subscription items.
objectEvent
  • DEVICE_ENDPOINT_ADDED
  • DEVICE_ENDPOINT_REMOVED
  • DEVICE_TRAIT_PARAMETER_UPDATE
Shares the "Device Data and Structure Events" group with point value changes; individual selection is not currently supported.
objectEvent
  • SPACE_ADDED
  • SPACE_REMOVED
  • SPACE_UPDATED
  • AUTOMATION_ADDED
  • AUTOMATION_REMOVED
  • AUTOMATION_UPDATED
  • AUTOMATION_SPACE_UPDATED
  • AUTOMATION_EXECUTION_RESULT
  • SCENE_EXECUTION_RESULT
Pushed only after you selectively subscribe to these events or subscribe to all.
AlarmEvent-Raw alarms; disabled by default.

Configuring Push in Aqara Studio​

  1. Log in to Aqara Studio and navigate to the Developer page in the sidebar. Locate the Open API & MCP Access section and select the Message Push button.

    Configuring Push in Aqara Studio
  2. Fill out and save the following details in the popup window:

    Configuring Push in Aqara Studio
    ItemRequiredDescription
    Push URL✓

    The address to receive push notifications. Ensure the address meets the Receiver Requirements.

    Response ValidationYes

    You can select one of the following response validation rules:

    • Studio Standard Acknowledgment: The default option. Verification requires HTTP 2xx, numeric code=0 and the exact challenge. Business messages require HTTP 2xx and code=0.
    • HTTP Status Code 200 Only (Ignore Body): HTTP Status Code 200 is treated as success without reading or validating the body. Business errors returned with 200 are also treated as success and will not be retried.
    • HTTP Status Code 200 + exact text: The full response must match exactly, including spaces and line breaks. No type conversion. Maximum 4096 UTF-8 bytes; leave blank to require an empty response.
    • HTTP Status Code 200 + JSON Match: Enter valid JSON: objects match expected fields recursively and allow extra fields. Strings, numbers, booleans and null are supported; types are distinct. No arrays. Maximum 4096 UTF-8 bytes, 16 levels and 256 values.
    Subscription Mode✓

    Choose a subscription mode:

    • Select events: Select the event types you want to subscribe to. If new object events are added after an Aqara Studio update, you must select them manually to subscribe.
    • Subscribe to all: Subscribe to all event types. If new object events are added after an Aqara Studio update, you will be subscribed to them automatically.
      Note: The receiver must allow unknown data.eventType values and remain compatible with new data structures. You may log and ignore events that are not yet supported, but you should not reject the entire request because of an unknown event.

    For more details, see Subscription and Default Push Rules

    Push events✗

    Only available if Message Subscription Mode is set to Custom Subscription. You can select which event types to subscribe to.

    Fixed headers✗

    Add custom header fields for requests. The following header names are prohibited:

    • X-Studio-Delivery-Id
    • X-Studio-App-Key
    • X-Studio-Time
    • X-Studio-Nonce
    • X-Studio-Sign-Version
    • X-Studio-Sign
    AppKey✗

    AppKey must be 1–128 printable ASCII characters, defined by you, no spaces allowed.

    AppSecret✗

    AppSecret must be 1–4096 UTF-8 bytes, defined by you, and must not contain control characters.

Webhook Verification​

Receiving a WebhookVerification Message​

When you save an HTTP Push configuration or re-enable Push per the above steps, Aqara Studio will send a WebhookVerification message to your configured endpoint to verify receiver availability.

Sample verification message:

{
"type": "WebhookVerification",
"version": "v1",
"msgId": "verify-39c63800-c8c1-4f4b-b77c-57f24f0de240",
"data": {
"challenge": "00112233445566778899aabbccddeeff"
}
}

Returning a WebhookVerification Response​

收到 WebhookVerification 消息后,请按照 Aqara Studio 中配置的响应校验模式返回相应响应。响应通过校验后,即表示消息接收成功且该地址验证通过,说明如下:

模式成功条件响应示例
Studio 标准确认(默认)HTTP 2xx,合法 JSON 对象,顶层整数形式的 code=0;验证消息还需原样返回 challenge。业务 {"code":0};验证 {"code":0,"challenge":"请求中的值"}
仅 HTTP 状态码 200HTTP 状态码必须为 200;忽略正文,可为空或任意内容。空正文
HTTP 状态码 200 + 文本匹配HTTP 状态码 200,完整 UTF-8 正文与期望文本完全一致,包括空格、换行;不做 trim 或类型转换。期望 ok 时返回 ok
HTTP 状态码 200 + JSON 匹配HTTP 状态码 200,合法 UTF-8 JSON 满足期望值。对象按字段递归匹配,允许响应有额外字段。期望 {"result":{"code":0}},允许返回 {"result":{"code":0,"message":"ok"}}

若您的响应校验规则为 Studio 标准确认,当您收到 WebhookVerification 消息后,您需要返回一条包含 code 为 0(不接受 "0"、0.0、0e0) 且 challenge 为 WebhookVerification 消息中 data.challenge 的响应消息,表示您顺利接收该消息,此地址通过验证。如此,Aqara Studio 才会正式启用 HTTP Push。

{
"code": 0,
"challenge": "00112233445566778899aabbccddeeff"
}

后三种模式仍须支持 WebhookVerification,但无需返回 code 或 challenge,只需满足所选规则。

  • 仅 HTTP 状态码 200:无法区分成功和以 HTTP 状态码 200 返回的业务错误,此类响应会被视为成功、不再重试。它也不验证接收端是否识别了验证消息;应另行确认地址及接收逻辑正确。
  • JSON 匹配模式:支持对象、字符串、数字、布尔值和 null,区分类型,但数字按数值比较(0 与 0.0 相同);缺失字段不等于 null。不支持数组作为期望规则、正则或脚本;额外响应字段可以包含数组。JSON 字段顺序和格式化空白不影响匹配。JSON 期望最多 16 层、256 个值,禁止重复字段。
  • 文本匹配模式: 文本期望 0 不匹配 0.0 或 "0";JSON 字符串期望值则必须带双引号,例如 "ok"。期望正文最多 4096 UTF-8 字节。文本模式留空表示要求空响应。
note

WebhookVerification messages are not retried. If verification fails, the current configuration will not take effect.

Request Format​

When Studio sends requests to the receiver, the following characteristics apply:

  • The request method is POST.
  • The default Content-Type is application/json.
  • Each request body contains a single message.
  • The response is returned in the same HTTP request.
  • Any headers configured in Aqara Studio are sent as specified.

Request Headers​

HTTP Push requests include at least the following headers:

HeaderDescription
X-Studio-Delivery-IdA unique delivery ID for each request, formatted as a UUID
X-Studio-App-KeyAppKey field. This is only included if you have configured AppKey and AppSecret in Aqara Studio.
X-Studio-TimeTimestamp. Only included if AppKey and AppSecret are configured.
X-Studio-Nonce32-character lowercase hex random value. Only included if AppKey and AppSecret are configured.
X-Studio-Sign-VersionSignature version. Only included if AppKey and AppSecret are configured, value is always v1.
X-Studio-SignSignature (HMAC-SHA256 in lowercase hex). Only included if AppKey and AppSecret are configured.

Signature Verification Rules​

If you configured AppKey and AppSecret in Aqara Studio, the receiver should use the AppSecret to validate the X-Studio-Sign header.

Reconstruct the Signing String from the plain request data, compute the HMAC using your AppSecret, and compare with the received X-Studio-Sign. The AppKey is sent in plaintext in the X-Studio-App-Key header; you may check it against your local copy. Data integrity and tamper resistance rely on signature verification.

Signing String​

The signing string (signingString) is composed of the following six lines of UTF-8 text in order, joined by LF (\n), with no trailing line-break:

v1
AppKey
Delivery-Id
Time
Nonce
SHA256(raw-body)

Each line refers to:

LineDescription
v1Corresponds to X-Studio-Sign-Version
AppKeyCorresponds to X-Studio-App-Key
Delivery-IdCorresponds to X-Studio-Delivery-Id
TimeCorresponds to X-Studio-Time
NonceCorresponds to X-Studio-Nonce
SHA256(raw-body)The SHA-256 (lowercase hex) of the raw request body
  1. (Optional) Compare X-Studio-App-Key with your local AppKey. If mismatched, you may reject the request.
  2. Construct the signingString using request headers and the raw request body as specified above.
  3. Generate the signature (a lowercase hexadecimal string) with the HmacSHA256 algorithm, using the your AppSecret as the key.
  4. Compare the result with the X-Studio-Sign header; if equal, the X-Studio-Sign passes the verification.
tip

On retry, the request body and X-Studio-Delivery-Id remain the same, but Time, Nonce, and Sign are regenerated.

Message Field Descriptions​

The common fields of an HTTP Push request message are as follows:

FieldDescription
typeMessage type. Currently supports WebhookVerification, TraitValueUpdate, objectEvent, and AlarmEvent. For the send conditions of each message type, see Supported Message Types.
versionCurrently only v1 is supported.
msgIdMessage identifier, used for traceability.
dataBusiness payload. The structure depends on type:
codeProcessing result code; 0 indicates success.
messageProcessing result description.

Response Format​

Response Content​

The response body should contain at least:

{
"code": 0
}

If processing fails, you can return a non-zero code:

{
"code": 1
}

Response Body Limits​

The maximum event request body size is determined by the Studio deployment configuration and cannot exceed 64 MiB. Messages that exceed the limit are not delivered. The receiver should set its inbound body limit according to its own capacity and the limits agreed upon for the actual deployment.

Additional requirements are listed below:

LimitRequirement
Response compressionWhen the response body is validated, the response must be uncompressed
Maximum response body size65,536 bytes (the actual limit of a deployed Studio may be lower)
Maximum number of response headers16 headers in all modes
Maximum header line length4,096 bytes
Maximum JSON nesting depth in standard mode128 levels
Maximum nesting depth in JSON Match mode16 levels
Maximum parsed values in JSON Match mode1,024
Maximum numeric text length128 characters
Duplicate fieldsProhibited

The receiver should return only the minimal content required for acknowledgment. If the response validation rule is HTTP Status Code 200 Only, the response body is not read and is therefore not subject to the response body size limit, but connection, response header, and timeout limits still apply.

Retry and Circuit Breaker​

Each event message is sent at most twice. Connection or read failures, HTTP 408, HTTP 429, HTTP 5xx, and invalid acknowledgments with an HTTP 2xx status are retryable. The standard retry delay is 1 second. For HTTP 429, Retry-After accepts only integer values from 0 to 30 seconds; other values use a 1-second delay. Other HTTP 4xx and HTTP 3xx responses are not retried.

Aqara Studio considers a request failed if it cannot establish a connection within 2 seconds. Each HTTP call has a 5-second cancellation timeout. The 45-second logical delivery window starts when the message enters the sending phase and does not include prior queueing time; no new retry is started after this window expires. These time limits do not guarantee end-to-end delivery or immediate release of underlying resources. If low-level operations such as DNS do not respond to cancellation, the request may terminate later.

Each endpoint verification sends only one HTTP request and is not retried immediately. After the circuit breaker is triggered, Studio sends a new WebhookVerification when the next backoff interval is reached. Event delivery resumes only after successful verification.

X-Studio-Delivery-Id is the UUID for each logical delivery and remains unchanged across retries. The msgId in the body is used only for business tracking and cannot replace an idempotency key. When signing is enabled, we recommend using (X-Studio-App-Key, X-Studio-Delivery-Id) as a persistent composite unique key. If signing is disabled and the same receiving service connects to multiple Studio instances, add a mutually agreed fixed instance identifier header and use it together with the Delivery ID. Persist the idempotency record and the business result or durable processing task in a single transaction before acknowledging success. A network timeout may occur after the third party has already processed the message.

This is a real-time, best-effort delivery mechanism. It does not guarantee that every message will arrive, does not redeliver historical messages, and does not guarantee delivery or processing order. Messages may be lost if the queue overflows or the endpoint is paused. Third parties that require complete state should periodically reconcile their data using the available query APIs. The protocol does not require an additional compensating acknowledgment handshake.

Subscription and Default Push Rules​

After HTTP Push is enabled, message delivery follows the rules below. You do not need to select every event manually:

CategoryRule
DEVICE_ADDED / DEVICE_REMOVEDSent by default and cannot be disabled in the configuration. These events are always delivered regardless of other subscription settings.
TraitValueUpdateDevice point value changes. This event belongs to the "Device Data and Structure Events" group, which is enabled by default.
DEVICE_ENDPOINT_ADDED / DEVICE_ENDPOINT_REMOVEDShares the "Device Data and Structure Events" group with TraitValueUpdate. Individual subscriptions are not currently supported, and the group is enabled by default.
DEVICE_TRAIT_PARAMETER_UPDATEAlso shares the "Device Data and Structure Events" group, which is enabled by default.
Configurable object eventsEight object events can currently be selected individually. All are selected by default, and all may be deselected.
Alarm event AlarmEventDisabled by default and can be enabled as needed.
tip
  • "Subscribe to Alls" includes not only all current object events but also any object events added in the future. The receiver should remain compatible with unknown event types and new data structures by logging and ignoring unsupported events instead of rejecting the entire request.
  • Even if all optional items are deselected, DEVICE_ADDED and DEVICE_REMOVED will still be delivered.
  • Disabling HTTP Push stops the delivery of all events.

Receiver Implementation Suggestions​

To ensure stable HTTP Push operation, we recommend the following best practices for your receiver:

  • Prioritize "fast receive, async process"; avoid long business logic within the 5-second timeout window.
  • Use X-Studio-Delivery-Id for delivery tracing and implement idempotence per business requirements.
  • Do not rely on global order or expect historical message re-delivery.
  • If signature verification is enabled, always use the raw request body for digest computation—do not use formatted JSON.
  • Handle WebhookVerification separately. If your response validation rule is "Studio Standard Acknowledgment," ensure that the challenge is returned unchanged.

Failure Recovery​

After consecutive delivery failures, Aqara Studio pauses event delivery and sends another WebhookVerification recovery probe after a progressively longer delay.

Event delivery resumes after successful verification, but messages generated while delivery was paused are not redelivered. Verification is also performed again after HTTP Push is re-enabled or the Studio service restarts, and no event messages are sent until verification succeeds. The receiver does not need to implement an additional recovery acknowledgment process.

Example​

Below is a typical push and acknowledgement example.

Studio Push Request​

POST /hook HTTP/1.1
Content-Type: application/json
X-Studio-Delivery-Id: 0c9c109a-e724-469c-ae96-1f96e824c127

{
"type": "WebhookVerification",
"version": "v1",
"msgId": "verify-39c63800-c8c1-4f4b-b77c-57f24f0de240",
"data": {
"challenge": "00112233445566778899aabbccddeeff"
}
}

Receiver Response Example​

The following is an example of a response for Studio standard acknowledgment:

HTTP/1.1 200 OK
Content-Type: application/json

{
"code": 0,
"challenge": "00112233445566778899aabbccddeeff"
}