There is no API endpoint to export the gradebook CSV.
The call to get the gradebook CSV is a non-API call. It starts with a call to /courses/12345/gradebook_csv. This starts the gradebook generation process with an attachment_id and a progress_id. Canvas polls the progress API to determine when it is done. It repeats this call until it's finished and then it downloads the gradebook using an API call.
But the initial call that gets everything started is not an API call.
It appears that you do not have to be on the gradebook page to invoke the call. This means that you could write a script that logs into Canvas and sends the calls to start the generation of the CSV file and then do the rest from the API.
This discussion post is outdated and has been archived. Please use the Community question forums and official documentation for the most current and accurate information.