united-states
tl;dr: Adding a lock yourself may not be legal, but you can buy a USPS-approved mailbox with a lock. The box will need a mail slot or similar, so delivery is possible without unlocking.
There does not appear to be some overriding federal law governing mailboxes, so there may be state-specific regulations. However, I would assume that the rules set by the United States Postal Service (USPS) are more or less valid in all states.
According to the USPS (emphasis mine):
Curbside mailboxes - Installation policies
Installation of curbside mailboxes must meet specific construction
standards, which can be obtained from the local Post Office™ facility.
[...]
The following are a few of the regulations that apply when installing
a curbside mailbox:
Important: Before installing, moving or replacing your mailbox or
mailbox support, you will need to contact your Postmaster or
mailperson from your local Post Office™.
All mailboxes must be approved by the Postal Service™.
Requirements for city delivery mail receptacles
So, from reading the page it seems that you may not alter your mailbox by adding a lock.
You must either:
- buy a mailbox that is approved by the USPS, or
- seek approval from the USPS for your mailbox with your own lock
Of course it is possible that a lock on your mailbox will be tolerated in practice, but that appears to be the official situation.
Note that approved, locking mailboxes are available - for example, wall-mounted mailboxes usually have a lock. You could install one of these. A web search for "usps approved wall mailbox" finds many options.
This is further clarified by this FAQ (emphasis mine):
Locked Mailboxes
[...]
If you would like to obtain a locked mailbox for your residence:
- you may purchase one at a local store
- you may purchase one online from an approved manufacturer
Note: A mailbox with a lock must have a slot that is large enough to
accommodate your daily mail volume. The Postal Service™ neither opens
a locked box nor accepts a key for this purpose.
Locked Mailboxes and Mailbox Keys
This also explicitly mentions that while there may be a lock to prevent taking out mail, it must still be possible to deliver mail without opening the lock.
Also note that there is an explicit prohibition by the UPSPS on "locked mailboxes" - however, that refers to boxes that must be unlocked for delivery - these are prohibited by Postal Operations Manual 632.527:
The use of locks, locking devices, or inserts on curbside mailboxes on
rural and highway contract routes is prohibited. See the list of
curbside mailbox manufacturers for approved locking style mailboxes (a
current listing of approved manufacturers and models can be obtained
from the office listed in section 632.511). The Postal Service does
not allow carriers to open locked boxes and does not accept keys for
this purpose.
Finally, note that the USPS distinguishes between a personal mailbox and a cluster box (or cluster box unit, CBU). A personal mailbox is the usual mailbox for a single household, while a cluster box is meant to hold the mail for multiple households. Cluster boxes usually installed for all residences in a neighboorhood or in an apartment building. Some rules are different for CBUs - for example, they may be allowed to require a lock for delivery.Thanks Brian for pointing this out.