Sets of integers form a monoid, where the product of two sets A
and B is defined as the set containing a+b for all $a\in A$ and
$b\in B$. We give a characterization of when a family of finite
sets is a code in this monoid, that is when the sets do not satisfy
any nontrivial relation. We also extend this result for some
infinite sets, including all infinite rational sets.