Zend certified PHP/Magento developer

Magento 2 Set custom order increment id

I’m trying to change the increment id number in the request, but I’m not succeeding, I have an API that generates a single code, and I already have an observer that retrieves this value for me.

now I need to change or make the increment id receive this value from my API.

my observer runs on event checkout_onepage_controller_success_action

how do I play this value that I have saved, to increment id?

I tried

$order->setIncrementId($certificateId);

but it doesn’t work, can someone help me?