Basketball Rules for a Self-Pass

According to basketball rules, passing the ball to yourself is technically illegal at all levels of the game; however, there are numerous methods of legally advancing or maintaining control of the ball that differ little from a self-pass.
Similar to other fouls and technically illegal plays, the manner in which a ball handler executes a self-pass can determine whether they are charged with a foul and lose possession of the ball in a basketball game.

Official Rules
According to NBA Rules, you will be charged with traveling and lose possession if you are the first person that touches a ball after you have made a pass, rather than another teammate or a defensive player from the opposing team.
Rules of basketball for both the NCAA and International Basketball Federation both have similar concepts: All three groups agree that the ball must legally contact another in-bounds player for a throw-in to be completed.
Although "legal contact" refers primarily to whether the receiving player is fully in bounds, this term can also apply to situations of deliberately bouncing the ball off another basketball player.

Using Another Player
NBA, NCAA and FIBA rulebooks all state that you can touch a ball after making a pass if the ball touches another player first, whether that be an offensive player or a defensive player. As such, it is technically legal to complete a self-pass that involves deliberately bouncing the ball off an opposing player's body.
This is also true for out of bounds throw-ins, as long as you have both of your feet in bounds before recovering the ball. However, if the referee judges that you have deliberately bounced the ball off an opponent in a way that might cause injury, you can be charged with a technical foul or personal foul.
Other Objects
In addition to contact with other players, contact with the rim or backboard can be used as a means of recovering your own pass. This form of self-passing is often used at the end of a fast break, typically as part of an acrobatic layup or slam-dunk attempt.
However, as FIBA rules clearly state, deliberately bouncing the ball off the rim or backboard can be considered a form of dribbling. As such, you may be charged with a traveling violation if the referee does not view your use of the backboard or rim as an actual field goal attempt where you went into the act of shooting.

Leading the Ball
Although it is not clearly a form of self-passing, leading the ball is one of the most common ways to pass to yourself. This typically occurs when trying to catch a defender off guard by quickly changing your pace and rushing up-court.
You can use this legal form of self-passing in one of two ways. The first involves a dribbler bouncing the ball so it travels a great distance, then rushing to recover the ball and continue their dribble.
The second is by pushing the ball farther forward during a normal dribble, forcing you to rush up-court to continue your dribble after it bounces. This is commonly seen as a player from the now-offensive team grabs the rebound off of a missed shot attempt and pushes a fastbreak from the baseline or backcourt to the frontcourt in an attempt to beat the defense down the floor for an easy layup.