> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chainstack.com/llms.txt
> Use this file to discover all available pages before exploring further.

# sendQuery | TON v2

> The sendQuery method sends an unpacked external message to the TON blockchain. Unlike sendBoc which requires a fully serialized BoC.

The `sendQuery` method sends an unpacked external message to the TON blockchain. Unlike [sendBoc](/reference/ton-sendboc-v2) which requires a fully serialized BoC, this method accepts individual message components and constructs the message on the server side.

<Info>
  There's no difference between a full node an archive node in data availability or pricing. All data is always available and all node requests are consumed as 1 request unit.
</Info>

## Request body

* `address` (string, required) — The destination address for the message. Example: `EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs`.
* `body` (string, required) — The body of the message in base64 format.
* `init_code` (string, optional) — The init code in base64 format. Required when deploying a new contract.
* `init_data` (string, optional) — The init data in base64 format. Required when deploying a new contract.

## JSON-RPC

<CodeGroup>
  ```shell shell theme={"system"}
  curl -X POST \
    'https://ton-mainnet.core.chainstack.com/f2a2411bce1e54a2658f2710cd7969c3/api/v2/jsonRPC' \
    -H 'Content-Type: application/json' \
    -d '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "sendQuery",
      "params": {
        "address": "EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs",
        "body": "te6cckEBAQEAAgAAAEysuc0="
      }
    }'
  ```
</CodeGroup>

## Response

* `ok` (boolean) — Whether the operation was successful.

* `result` (object) — The result of the operation. Contains:

  * `@type` (string) — The type of the result, typically `ok` for successful submissions.
  * `@extra` (string) — Extra information about the operation.

## Use case

The `sendQuery` method is useful when you have the message components but haven't serialized them into a BoC:

1. Smart contract deployment when you have separate code and data cells.
2. Simplified transaction sending without manual BoC construction.
3. Testing and debugging with individual message components.
4. Integration with systems that provide message parts separately.

Here's an example of deploying a smart contract using sendQuery:

<CodeGroup>
  ```shell shell theme={"system"}
  curl -X 'POST' \
    'https://ton-mainnet.core.chainstack.com/f2a2411bce1e54a2658f2710cd7969c3/api/v2/sendQuery' \
    -H 'accept: application/json' \
    -H 'Content-Type: application/json' \
    -d '{
    "address": "EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs",
    "body": "te6cckEBAQEAAgAAAEysuc0=",
    "init_code": "te6cckEBAQEAXAAAsFF/APSkE/S88sgL...",
    "init_data": "te6cckEBAQEAJAAAQ4AW..."
  }'
  ```
</CodeGroup>

<Tip>
  For most use cases, [sendBoc](/reference/ton-sendboc-v2) or [sendBocReturnHash](/reference/ton-sendbocreturnhash-v2) are preferred as they give you full control over the message serialization. Use `sendQuery` when working with systems that provide unpacked message components.
</Tip>


## OpenAPI

````yaml openapi/ton_node_api/v2/sendQuery.json POST /sendQuery
openapi: 3.0.0
info:
  title: sendQuery example
  version: 1.0.0
  description: >-
    This is an API example for sendQuery, a method to send an unpacked external
    message to the TON blockchain.
servers:
  - url: >-
      https://ton-mainnet.core.chainstack.com/f2a2411bce1e54a2658f2710cd7969c3/api/v2
security: []
paths:
  /sendQuery:
    post:
      tags:
        - TON Operations
      summary: sendQuery
      operationId: sendQuery
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                address:
                  type: string
                  description: The destination address for the message
                  default: EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs
                body:
                  type: string
                  description: The body of the message in base64 format
                  default: te6cckEBAQEAAgAAAEysuc0=
                init_code:
                  type: string
                  description: Optional init code in base64 format for contract deployment
                init_data:
                  type: string
                  description: Optional init data in base64 format for contract deployment
              required:
                - address
                - body
      responses:
        '200':
          description: The result of sending the query
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
                    description: Whether the operation was successful
                  result:
                    type: object
                    nullable: true
                    properties:
                      '@type':
                        type: string
                        description: The type of the result
                      '@extra':
                        type: string
                        description: Extra information

````