I don't remember the specific case at the moment, but a few years back I think Oracle was suing Google (or some mix of big companies) about Google replicating the Java api but with a complete from-scratch backend reimplementation. Google wasn't using private Oracle source code, just building a replacement that used the publicly published api. Google won the case, and it I remember right that established public api's as non copyright or something. Again, not a lawyer and someone else probably has the details better than I do.