No API functions, I'm working directly with the database outside of Moodle.
EDIT: Let me clarify a little: I've written a script in bash that recreates quiz_attempts, question_attempts and question_attempt_steps, along with accompanying question_usages in order to import quiz results from csv files into Moodle. This is all working great (after like 150 hours of work. . . never mind).
The ONLY thing that's not working is the quiz is marked as "not completed" from a student's point of view, which is preventing the student from downloading their certificate. I have the state set to "finished" on the quiz_attempt. What am I missing?