Rule 15 of the Federal Rules of Civil Procedure says—
(a) Amendments Before Trial.
(1) Amending as a Matter of Course. A party may amend its pleading once as a matter of course within:
(A) 21 days after serving it, or
(B) if the pleading is one to which a responsive pleading is required, 21 days after service of a responsive pleading or 21 days after service of a motion under Rule 12(b), (e), or (f), whichever is earlier.
(2) Other Amendments. In all other cases, a party may amend its pleading only with the opposing party’s written consent or the court’s leave. The court should freely give leave when justice so requires.
A party gets one free amendment to a complaint. Any further amendment requires either the consent of the opposing party(ies) or convincing the judge that an amendment is warranted. That’s not always a gimme.