How Do I Connect My IC Backend to Web2 APIs?
Your Internet Computer
$ICP backend can call Web2 services using HTTPS outcalls. Your canister sends a secure request, the network performs the HTTPS call, and the response comes back on-chain.
🧠 How it works
Your canister calls the system method http_request. The Internet Computer performs the HTTPS request and returns the response.
It works just like a normal backend, but fully decentralized.
⚙️ Consensus vs. Non-Consensus Calls
There are two modes of HTTPS outcalls on the IC:
Consensus calls
• All nodes perform the request
• The network agrees on the same response
• Fully trustless, fully decentralized
• Ideal for public APIs and deterministic data
Non-consensus calls
• Only one node performs the request
• Faster and cheaper
• Good when full decentralization isn’t required
• Useful for real-time data or less predictable APIs
💡 Most developers use consensus calls for reliability and integrity,
and non-consensus calls when performance or flexibility is more important.
🧹 Transform function
Some Web2 APIs include unstable headers like timestamps. A small transform step cleans the response so nodes can agree on one result.
💸 Who pays?
The canister pays in cycles, so users never need tokens or gas.
✨ You can fetch Web2 data, call external APIs, or trigger workflows.
Directly from your on-chain backend, no oracle needed.