Versioning for instances of custom document type

I created a new custom document type and I created instances of this document type using Kentico API.
Does Kentico provide versioning for instances of custom document types?
I found a sample of code for versioning of css styles, but this code didn't work for documents.
Can you give me a sample of code for versioning documents?

Recent Answers

If you want to handle those documents using the API, you need to use the API for document workflows basically and the VersionManager. For more details please see the API examples here and also in here.