The official scorer is the person appointed to observe from the press box and record the outcome of everything that happens during a game, and to make judgment calls that affect the official record of said game. The official scorer files a report after each game for documentation purposes.
The most common judgment call an official scorer makes is whether a batter reached base on a hit or an error. Other rulings made by the official scorer include whether a pitch that goes past the catcher is a wild pitch or a passed ball, and which reliever is credited with a win when the starting pitcher does not go five innings but leaves with a lead that his team doesn't relinquish.
The official scorer is permitted to change a judgment call for up to 24 hours after a game concludes or is suspended. A player or team can request that the executive vice president of baseball operations review a call in which said player or team participated. This request must come within 72 hours after the conclusion or suspension of that game, or 72 hours after the official scorer's call in the event a postgame change is made.
Watch: The official scorer initially rules Nick Markakis' batted ball a hit but later changes it to an error on Kris Bryant.