The Ravens will receive a sixth-round draft choice in return, the sources said.
Boldin is currently in Africa on a mission and is scheduled to pass a physical before the trade with San Francisco becomes complete.
The trade agreement was earlier reported by the Baltimore Sun.
Boldin is scheduled to earn $6 million in the coming season and carries a $7.531 million salary-cap figure.
Boldin told USA Today that he was unwilling to slash his salary in order to stay with the team, citing “principles.”
“At no point, no matter how well I played, would I come back to the table and say, ‘I need more money.’ The contract that I signed was the contract that I intended to play out,” USA Today quoted Boldin.
In the playoffs, Boldin caught 22 passes for 380 yards receiving (95 yards per game) and four touchdowns. He has led Baltimore in receiving yards in each of the past three seasons since being traded from Arizona.