How Can Add Custom Demographic field using API

How can add a custom demographic field using API, I have viewed this document for creating a custom field through UI (HOWTO: Customize A Demographics User Defined Field - OpenEMR Project Wiki)

I want to create this field using API.

also one more thing, is there any way that I can add a URL in the custom field? I want to redirect from that URL to my platform

@Maitrak_Nirmal I think you have to write your own API for layout based form. You have to write the insert and update API into layout based form.

Okay Thank you @Nilesh_Hake