Got news: when using the code api, you can add attachments when creating a mail like this:
$attachment = new stdClass();
$attachment->filename = $filepath;
$attachment->size = filesize(ACYM_ROOT.$filepath);
$mail->attachments = json_encode(
[
$attachment
]
);
The $filepath variable must contain the path of the file relative to the site's root folder.