Generally yes - fasteners on a bike are made from Stainless Steel, Steel, or High Tensile Steel.
There are occasionally fasteners made from Titanium or Aluminium for weight savings, but titanium is expensive and aluminium is weak.
Stainless Steel reduces rust/corrosion (but doesn't fully eliminate it) and is generally ideal for most places on your bike.
You'll also need to match the thread form, pitch, and diameter of the threadded part. The head also needs to suit the application and the length should provide sufficient engagement of threads without bottoming out in a blind hole.
For convenience, you probably want to have the same tool fitment as other bolts on your bike. That probably means a 3/4/5 mm hex tool or perhaps a T25 torx, or older bikes often use hex bolts in the 8/9/10mm range (or the imperial equivalents.)
Related - washers can also be stainless steel, should you need them.
Your other option is to check the existing bolts and figure out what they are.
Stainless steel is generally not magnetic, (or only very slightly)
Steel responds well to a magnet.
High Tensile bolts will have specific markings on the head to show what Grade of bolt they are - Example
https://www.boat-renovation.com/wp-content/uploads/2020/06/Bolts.png