Get another while you still have one.
If you lose the only one you have now, it will cost you double or triple the money to get a new one.
Why?
If there is no key at all, the dealer needs to find the unique code inside the ECU (control CPU).
The labor cost is huge.
If you still have one, either
- dealer can sell you a blank one
or
- buy one on-line (make sure it is blank/brand-new)
Then, ask the dealer to program it for you (only dealer can do this with their hand-held computer).
This is estimated to cost around $150-200 (part) + $100-150 (labor) = $300 +/- $50
(also ask dealer to laser-cut the metal key BTW).
If you have TWO keycards, you can get a new one (as above) and
program it yourself at home. (people do this for a spare keycard).
This is cheaper because you don't need dealer's "precious time" to program it for you.
Hope this is clear.
For cheapest part on-line (genuine Mazda dealers), try
- waynemazda.com
- mazdaparts.org
Two with best price that I know of.