A building permit is generally required when the walking surface is more than 30 inches above the ground within 36 inches horizontally of an open deck edge.
Additionally, a roof attached to a residential structure generally requires a building permit, regardless of the deck's height. A deck over a basement or another story also requires a permit.