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

<AgentInstructions>

## Submitting Feedback

If you encounter incorrect, outdated, or confusing documentation on this page, submit feedback:

POST https://docs.ton.org/feedback

```json
{
  "path": "/ecosystem/api/toncenter/v2/send/estimate-fee",
  "feedback": "Description of the issue"
}
```

Only submit feedback when you have something specific and actionable to report.

</AgentInstructions>

# Estimate fee

> Calculates the fees required to send a message. Provide the destination address and message body. For new contract deployments, also include init_code and init_data. Set ignore_chksig to true when estimating before signing. Returns a breakdown of storage, gas, and forwarding fees.



## OpenAPI

````yaml post /api/v2/estimateFee
openapi: 3.1.1
info:
  title: TON HTTP API C++
  description: >
    This API enables HTTP access to TON blockchain - getting accounts and
    wallets information, looking up blocks and transactions, sending messages to
    the blockchain, calling get methods of smart contracts, and more.


    In addition to REST API, all methods are available through a JSON-RPC
    endpoint  with `method` equal to method name and `params` passed as a
    dictionary.


    The response contains a JSON object, which always has a boolean field `ok`
    and either `error` or `result`. If `ok` equals true, the request was
    successful and the result of the query can be found in the `result` field.
    In case of an unsuccessful request, `ok` equals false and the error is
    explained in the `error`.


    API Key should be sent either as `api_key` query parameter or `X-API-Key`
    header
  version: 2.1.1
servers:
  - url: https://toncenter.com
    description: TON Mainnet
  - url: https://testnet.toncenter.com
    description: TON Testnet
security: []
tags:
  - name: Accounts
    description: Information about accounts
  - name: Transactions
    description: Fetching and locating transactions
  - name: Blocks
    description: Information about blocks
  - name: Run method
    description: Run get-method of smart contracts
  - name: Send
    description: Send data to blockchain
  - name: Utils
    description: Some useful methods
  - name: Configuration
    description: Information about blockchain config
  - name: RPC
    description: JSON-RPC and POST endpoints
paths:
  /api/v2/estimateFee:
    post:
      tags:
        - Send
      summary: Estimate fee
      description: >-
        Calculates the fees required to send a message. Provide the destination
        address and message body. For new contract deployments, also include
        init_code and init_data. Set ignore_chksig to true when estimating
        before signing. Returns a breakdown of storage, gas, and forwarding
        fees.
      operationId: estimateFee_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EstimateFeeRequest'
        required: true
      responses:
        '200':
          description: >-
            Returns the estimated fees (gas, storage, forwarding) for the
            specified message.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EstimateFeeResponse'
        '401':
          $ref: '#/components/responses/401'
        '403':
          $ref: '#/components/responses/403'
        '422':
          $ref: '#/components/responses/422_run'
        '429':
          $ref: '#/components/responses/429'
        '500':
          $ref: '#/components/responses/500_execution'
        '504':
          $ref: '#/components/responses/504'
      security:
        - APIKeyHeader: []
        - APIKeyQuery: []
components:
  schemas:
    EstimateFeeRequest:
      type: object
      additionalProperties: false
      required:
        - address
        - body
      properties:
        address:
          $ref: '#/components/schemas/TonAddr'
        body:
          $ref: '#/components/schemas/Bytes'
          description: Message body in BoC format, base64 encoded.
        init_code:
          $ref: '#/components/schemas/Bytes'
          description: >-
            Contract code for deployment messages, BoC format, base64 encoded.
            Omit for regular transfers.
        init_data:
          $ref: '#/components/schemas/Bytes'
          description: >-
            Initial contract storage for deployment, BoC format, base64 encoded.
            Omit for regular transfers.
        ignore_chksig:
          type: boolean
          default: true
          description: >-
            Set to `true` to skip signature verification during fee estimation;
            otherwise `false`. Useful when a real signature is not yet
            available.
      description: >-
        Request to estimate transaction fees. Include the target address,
        message body, and optionally init code/data for contract deployment.
    EstimateFeeResponse:
      type: object
      additionalProperties: false
      required:
        - ok
        - result
      properties:
        ok:
          type: boolean
          default: true
          description: >-
            Returns `true` if the request succeeded; otherwise `false`. See the
            `error` field for details.
        result:
          $ref: '#/components/schemas/QueryFees'
          description: Response data. Present only when `ok` is `true`.
        '@extra':
          type: string
          description: >-
            Optional request ID that can be passed in the request and received
            back in the response. Useful for matching async responses.
    TonAddr:
      type: string
      x-usrv-cpp-type: ton_http::types::ton_addr
      description: >-
        Account address in [raw](/foundations/addresses/formats#raw-format)
        format (e.g., `0:ca6e321c...`) or
        [user-friendly](/foundations/addresses/formats#user-friendly-format)
        format (e.g., `EQDKbjIcfM...`). All formats are automatically detected.
    Bytes:
      type: string
      x-usrv-cpp-type: ton_http::types::bytes
      description: >-
        Binary data encoded as base64. Used for serialized cells (BoC format),
        message bodies, and smart contract code/data.
    QueryFees:
      type: object
      additionalProperties: false
      required:
        - '@type'
        - source_fees
        - destination_fees
      properties:
        '@type':
          type: string
          enum:
            - query.fees
          default: query.fees
          description: >-
            TonLib type identifier for fee estimation results. Refer to the
            [TonLib type reference](/ecosystem/api/toncenter/v2-tonlib-types)
            for a full list.
        source_fees:
          $ref: '#/components/schemas/Fees'
          description: Fees charged on the sending account.
        destination_fees:
          type: array
          items:
            $ref: '#/components/schemas/Fees'
          description: >-
            Array of fee breakdowns charged on the receiving account(s). One
            entry per destination in multi-hop transactions.
      description: >-
        Estimated fees for a transaction. Shows the breakdown between storage
        fees (for contract state), gas fees (for computation), and forward fees
        (for message delivery).
    Fees:
      type: object
      additionalProperties: false
      required:
        - '@type'
        - in_fwd_fee
        - storage_fee
        - gas_fee
        - fwd_fee
      properties:
        '@type':
          type: string
          enum:
            - fees
          default: fees
          description: >-
            TonLib type identifier for fee breakdown objects. Refer to the
            [TonLib type reference](/ecosystem/api/toncenter/v2-tonlib-types)
            for a full list.
        in_fwd_fee:
          type: integer
          format: int64
          description: Fee for importing this inbound message, in nanotons.
        storage_fee:
          type: integer
          format: int64
          description: >-
            Storage fee charged for keeping the contract state on-chain, in
            nanotons.
        gas_fee:
          type: integer
          format: int64
          description: Computation gas fee for executing contract code, in nanotons.
        fwd_fee:
          type: integer
          format: int64
          description: >-
            Fee for forwarding outbound messages created by this transaction, in
            nanotons.
  responses:
    '401':
      description: API key does not exist. Check for typos or generate a new key.
      content:
        application/json:
          schema:
            type: object
            additionalProperties: false
            required:
              - ok
              - code
              - error
            properties:
              ok:
                type: boolean
                const: false
                description: Always `false` for error responses.
              code:
                type: integer
                const: 401
                description: HTTP status code `401`.
              error:
                type: string
                enum:
                  - API key does not exist
              '@extra':
                type: string
                description: Extra data passed through from the request.
          example:
            ok: false
            code: 401
            error: API key does not exist
    '403':
      description: >-
        API key is not allowed for this network (e.g. testnet key used on
        mainnet).
      content:
        application/json:
          schema:
            type: object
            additionalProperties: false
            required:
              - ok
              - code
              - error
            properties:
              ok:
                type: boolean
                const: false
                description: Always `false` for error responses.
              code:
                type: integer
                const: 403
                description: HTTP status code `403`.
              error:
                type: string
                enum:
                  - Network not allowed
              '@extra':
                type: string
                description: Extra data passed through from the request.
          example:
            ok: false
            code: 403
            error: Network not allowed
    '429':
      description: >-
        Rate limit exceeded. Back off and retry, or use an API key for higher
        limits.
      content:
        application/json:
          schema:
            type: object
            additionalProperties: false
            required:
              - ok
              - code
              - error
            properties:
              ok:
                type: boolean
                const: false
                description: Always `false` for error responses.
              code:
                type: integer
                const: 429
                description: HTTP status code `429`.
              error:
                type: string
                enum:
                  - Ratelimit exceeded
              '@extra':
                type: string
                description: Extra data passed through from the request.
          example:
            ok: false
            code: 429
            error: Ratelimit exceeded
    '504':
      description: Timeout waiting for liteserver response.
      content:
        application/json:
          schema:
            type: object
            additionalProperties: false
            required:
              - ok
              - code
              - error
            properties:
              ok:
                type: boolean
                const: false
                description: Always `false` for error responses.
              code:
                type: integer
                const: 504
                description: HTTP status code `504`.
              error:
                type: string
                enum:
                  - LITE_SERVER_NETWORK timeout
              '@extra':
                type: string
                description: Extra data passed through from the request.
          example:
            ok: false
            code: 504
            error: LITE_SERVER_NETWORK timeout
    422_run:
      description: Invalid get method or stack parameters.
      content:
        application/json:
          schema:
            type: object
            additionalProperties: false
            required:
              - ok
              - code
              - error
            properties:
              ok:
                type: boolean
                const: false
                description: Always `false` for error responses.
              code:
                type: integer
                const: 422
                description: HTTP status code `422`.
              error:
                type: string
                enum:
                  - Stack should be array
                  - 'Invalid stack format: array expected'
                  - >-
                    Invalid stack entry format: array of exact 2 elements
                    expected
                  - Expected string as first element in stack entry
                  - Wrong type of number in stack entry
                  - Invalid tvm.Cell, base64 string expected
                  - Invalid tvm.Slice, base64 string expected
                  - Empty tvm.Cell
                  - Empty tvm.Slice
              '@extra':
                type: string
                description: Extra data passed through from the request.
          example:
            ok: false
            code: 422
            error: Stack should be array
    500_execution:
      description: Get method or simulation execution failed.
      content:
        application/json:
          schema:
            type: object
            additionalProperties: false
            required:
              - ok
              - code
              - error
            properties:
              ok:
                type: boolean
                const: false
                description: Always `false` for error responses.
              code:
                type: integer
                const: 500
                description: HTTP status code `500`.
              error:
                type: string
                enum:
                  - Exit code <N> != 0
                  - Stack size <N> < 5
                  - 'Failed to parse int: <value>'
                  - stackEntryNumber expected
                  - stackEntryCell expected at <N> position
                  - stackEntryCell or stackEntrySlice expected
                  - addr_ext is not supported
                  - addr_var is not supported
                  - anycast is not supported
              '@extra':
                type: string
                description: Extra data passed through from the request.
          example:
            ok: false
            code: 500
            error: Exit code <N> != 0
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key
      description: >-
        API key header of the form `X-API-Key: <token>`, where `<token>` is the
        API key. Requests without a key are limited to 1 RPS. Refer to the
        [authentication guide](/ecosystem/api/toncenter/v2-authentication) for
        details.
    APIKeyQuery:
      type: apiKey
      in: query
      name: api_key
      description: >-
        API key query parameter of the form `?api_key=<token>`, where `<token>`
        is the API key. Equivalent to the header method. Refer to the
        [authentication guide](/ecosystem/api/toncenter/v2-authentication) for
        details.

````