Here is the how-to for creating custom objects manually in Salesforce.
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_qs_customobject.htm
I would like to know can this be done programmatically and if so via which API?
Here is the how-to for creating custom objects manually in Salesforce.
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_qs_customobject.htm
I would like to know can this be done programmatically and if so via which API?
You can use Salesforce Metadata API for dynamic creation of objects, fields, etc. In particular, there is createMetadata() method.