I have this weird idea to show the documentation on API I've developed for a startup to potential clients as a part of my portfolio. Is such an idea ethical?
It depends. If the documentation on the API is , there should be no reason you can't share the public document and tell someone you wrote it. If the documentation was written for someone else (), and is , it may be governed by an .
In that case, you should request permission from the person you did the work from to share some or all of this documentation as an example of your work product when job hunting or client hunting.
I have created many work for hire documents and products and regularly ask clients and employers if I can share some or all of that work. I have always received permission to share something for these limited purposes, though it is not infrequent that I am requested to show only a portion of the work, or to redact sensitive things.
As a hiring manager I have frequently asked writers, programmers and artists to show me examples of both their finished work, and the specs they started with.
Is it a public or private API? If it is public, no problem. If it is private, you need to get their permission.