I need to update a pdf document to a contact.
I want to automate this process using HubSpot API, want to check if it is possible to perform this action.
Just to make sure that we're on the same page, are you referring to document in the HubSpot Documents tool? Or just a regular PDF document? If you mean the former, then it's unfortunately not currently possible to associate these objects via the API.
If you're just looking to attach a PDF file to a contact record, you can do that by using the Engagements API; you'll want to create a NOTE type engagement, and attach the file to that engagement: