Is there an API or library to compile the sketch and upload it to Arduino?

Hello everyone, I was wanting to integrate the IDE function into another application to make it easier for users to use. So they will not need to leave my application and get into the IDE to compile and upload your code. Is there any library or API that compiles and uploads code in Arduino?

You could use the Arduino IDE's CLI:

Or, to go a bit deeper, you could use arduino-builder to compile:

But I don't believe that does anything related to uploading so you would need to handle that in your application. Arduino AVR boards use avrdude to upload but boards that use other architectures use other tools. This is defined in their platform.txt.

If using arduino-builder, you should be aware that a transition is in progress to separate the sketch preprocessing work (which has previously been done by arduino-builder) into a separate tool named arduino-preprocessor:

Thanks for the answer. That's what I was looking for.