Contracts

Get Started

Read, write, and deploy smart contracts on any EVM compatible blockchain.

Read a Contract

You can read contract data efficiently using the contract read API.

GET /v1/contracts/read
Host: api.thirdweb.com
Content-Type: application/json
x-client-id: <your-project-client-id>
{
"chainId": "1" // your chain id
"calls": [{
"contractAddress": "0x...",
"method": "function allowance(address owner, address spender)",
"params": ["0x...", "0x..."],
}],
}

You can batch multiple contract reads in a single request, and the response will be an array of results or errors.

Authentication requires either x-secret-key (backend) or x-client-id (frontend) to be set in the request headers.

Write to a Contract

You can write to a contract using the contract write API.

On the frontend, use your project client ID and the users's auth token to send a transaction on their behalf.

POST /v1/contracts/write
Host: api.thirdweb.com
Content-Type: application/json
x-client-id: <your-project-client-id>
Authorization: Bearer <user-auth-token>
{
"from": "0x...", // the user wallet address
"chainId": "1" // the chain id
"calls": [{
"contractAddress": "0x...",
"method": "function transfer(address to, uint256 amount)",
"params": ["0x...", "1000000000000000000"],
}],
}

You can batch multiple contract writes in a single request, and the transactions will be batched atomically onchain.

Going further

Explore Full API References

For comprehensive guides on implementing the full thirdweb SDK, explore our language-specific documentation: