I am looking at the following references: https://asana.com/developers/api-reference/tasks and https://asana.com/developers/api-reference/attachments. Am I correct to assume that you cannot create a task with an attachment in it using the Asana's API? Or maybe I am missing something?
Yes, you can create it. You first need to Create a Task. This will return a "taskid".
https://asana.com/developers/api-reference/attachments#upload
Then in the next request you need to add attachment to that task.