In D&D 5th edition, can any class disarm a trap, or can just the Rogue class do that?
There's no specific class requirement for the general action of disarming a trap. There's really no specific "disarm a trap" action, either, it's just a thing you can do like other interaction with your environment.
If disarming a trap requires an ability check, the only real guidance is that it may involve a Dexterity check (PHB p. 177).
The main aspects that a Rogue has are:
- If one has proficiency with Thieves' Tools (as a Rogue does), then one can add one's proficiency bonus to the check (PHB p. 154).
- If one chooses the Thief archetype at 3rd level, one gets the "Fast Hands" ability which allows for using your Cunning Action Bonus Action to disarm a trap (PHB p. 97).
Under "Detecting and Disabling a Trap" (DMG p. 120):
A trap's description specifies the checks and DCs needed to detect it, disable it, or both. A character actively looking for a trap can attempt a Wisdom (Perception) check against the trap's DC. You can also compare the DC to detect the trap with each character's passive Wisdom (Perception) score to determine whether anyone in the party notices the trap in passing. If the adventurers detect a trap before triggering it, they might be able to disarm it, either permanently or long enough to move past it. You might call for an Intelligence (Investigation) check for a character to deduce what needs to be done, followed by a Dexterity check using thieves' tools to perform the necessary sabotage.
So, there may be more specific requirements depending on the specific trap. For example, the sample "Poison Needle" trap (DMG p. 123) says that a "DC 15 Dexterity check using thieves' tools disarms the trap", though I'm not completely confident whether that means that having thieves' tools are required in order to even attempt disarming it, or whether that language is just saying that in the Dexterity check one can add one's proficiency bonus if one has proficiency with Thieves' tools. That's just a sample of a kind of trap that a DM might use, though, and each trap can be different. There certainly could be a trap that some DM has used somewhere that could only be disarmed by a character with the knowledge that comes from having the Rogue class. But there are no general requirements that apply to disarming all traps that require any particular class.
It depends on the trap type
There is no particular "disarm a trap" action in 5e rules. Various adventures describe plenty of magical and mechanical traps, simple and complicated. Some traps, like Hunting Trap, are meant to be disarmed by anyone without any tools. Some traps can not be disarmed at all. For instance, Lost Mines of Phandelver from Starter Set has a Pit trap in the forest — it is just a pit 6 feet wide, 10 feet deep, camouflaged with leaves.
You probably have to be proficient with Thieves' Tools
Talking about deactivating mechanical traps, the Dungeon Master's Guide implies using Thieves' Tools in the process:
You might call for an Intelligence (Investigation) check for a character to deduce what needs to be done, followed by a Dexterity check using thieves' tools to perform the necessary sabotage.
Some trap descriptions explicitly say you can disable them with Thieves' Tools:
The trip wire is 3 inches off the ground and stretches between two support beams. The DC to spot the trip wire is 10. A successful DC 15 Dexterity check using thieves' tools disables the trip wire harmlessly.
It is unclear if the character has to be proficient. He/she has to, apparently, since the DMG requires a burglar to be proficient with Thieves' Tools in order to unlock a door:
Characters who don't have the key to a locked door can pick the lock with a successful Dexterity check (doing so requires thieves' tools and proficiency in their use).
The final decision is up to the DM.
You don't have to be a rogue, though
Rogue class gives you proficiency with Thieves' Tools. But you don't have to be a Rogue to be proficient — you can get the proficiency from your background or gain it during a downtime activity.
Yes, although rogues are often better at disarming traps.
According to the Player's Handbook, p.177:
Other Dexterity Checks. The DM might call for a Dexterity check when you try to accomplish tasks like the following: [...]
- Pick a lock
- Disable a trap
You may require thieves' tools (p. 154), and having proficiency in those tools will allow you add your proficiency modifier whenever you use them, which will improve your chances of picking a lock. A rogue gains proficiency in thieves' tools automatically, so rogues are better than average, but it's not an exclusive ability like in earlier editions of the game.
It's up to the DM whether a particular trap requires thieves' tools to disarm. This is different to earlier editions of the game, where, for example, Disable Device skill could not be used untrained. Anyone can attempt to disarm a trap untrained in 5th edition.
From page 177 of the PHB, under "Other Dexterity Checks" (formatting is mine):
Other Dexterity Checks. The DM might call for a Dexterity check when you try to accomplish tasks like the following:
- Control a heavily laden cart on a steep descent
- Steer a chariot around a tight turn
- Pick a lock
- Disable a trap
- Securely tie up a prisoner
- Wriggle free of bonds
- Play a stringed instrument
- Craft a small or detailed object
This makes no mention of being a rogue, so anyone can make a Dex check to disable a trap.