Copyright violation requires copying, and independent derivation is a valid defense.
Patents don't require proof of copying and are always infringed, even with no knowledge.
If you wrote that API, and I wrote that exact same API without having seen yours, you wouldn't be able to sue me for copyright violation.
All I'd have to show in court is that there's a decent probability that I independently created the same API, at which point we'd both have full copyright over our own (identical) APIs, and more likely it would be ruled un-copyrightable due to being too trivial / not creative enough.