this is straight out of the api_ticket_create.php file with some added array fields. This code does create the new ticket with the correct staffid, topicID and companyid. However, it doesn't accept the due date. Instead, it inserts a date 2 days from the date the ticket is created.
$data = array(
'name' => 'new tickets',
'email' => 'contact@xxxxxx.org',
'staffId' => 8,
'topicId' => 21,
'duedate' => '2023-09-15',
'subject' => 'Test API message',
'message' => 'This is a test of the osTicket API',
'companyid' => '267',
'ip' => $_SERVER['REMOTE_ADDR'],
'attachments' => array(),
);