How to use api to create/update a new file in the bitbucket repo

I am new to Bitbucket and exploring options to to use bitbucket as salesforce repo.

Can we use api to update/create a file from salesforce application. The file to commit is in salesforce files. I want to check if file exists update else create.