Remap palette via script?

I’m trying to write a script to automate a series of steps I need to do to process a lot of images, and I was eventually able to figure out the API for “new palette from sprite” (ColorQuantization), but for the life of me I can’t figure out how to remap the palette after that step. Is there API to hook into “remap palette”?