View Functions — Move REST API on Movement
Execute read-only Move view functions on Movement without submitting a transaction. Query on-chain state, token balances, pool prices, and module data using the Aptos-compatible REST API.
Overview
View functions let you call read-only Move functions on-chain without submitting a transaction or paying gas. They are the primary way to query computed state from Move modules: token balances, pool prices, governance parameters, NFT metadata, and any other data exposed through #[view] functions. The response contains the return values of the function, serialized as JSON.
This is one of the most frequently used endpoints for dApp frontends and backend services that need to read on-chain state.
Endpoint
POST /v1/viewBase URL: https://api-movement-mainnet.n.dwellir.com/YOUR_API_KEY/v1
Code Examples
Query Token Balance
# Get MOVE token balance for an account
curl -s -X POST "https://api-movement-mainnet.n.dwellir.com/YOUR_API_KEY/v1/view" \
-H "Content-Type: application/json" \
-d '{
"function": "0x1::coin::balance",
"type_arguments": ["0x1::aptos_coin::AptosCoin"],
"arguments": ["0xYOUR_ADDRESS"]
}'
# Response: ["1000000"] (in smallest unit, 8 decimals)Get Chain ID
Query DEX Pool Price
Query Historical State
Common Use Cases
DApp Frontend State Queries
View functions are the backbone of dApp frontends. Use them to display token balances, NFT ownership, pool prices, staking positions, and governance states without requiring the user to submit transactions.
Price Oracles and Aggregators
Query multiple DEX pools to compute aggregated prices and find optimal swap routes. View functions are free and fast, making them ideal for real-time price feeds.
Smart Contract Testing
Call view functions during development to verify your module's read-only functions return expected values. This is faster than submitting a full transaction for every state query during testing.
Movement-Specific Notes
- The function identifier must be fully qualified:
{address}::{module}::{function_name}. For framework functions, the address is0x1. - Only functions marked with
#[view]in the Move source can be called through this endpoint. Attempting to call a non-view function returns a 404 error. - View function execution is free (no gas cost) but is still subject to computational limits. Extremely complex view functions may time out.
- All argument values must be passed as strings, even numeric types. The node handles deserialization.
Related Endpoints
GET /v1/accounts/{address}/modules-- List modules to discover available view functions.GET /v1/accounts/{address}/resources-- Read raw resource data (alternative to view functions for simple reads).POST /v1/transactions/simulate-- Simulate a transaction to preview state changes (for write operations).POST /v1/tables/{handle}/item-- Query table data directly.