To add media attachments to a post or a comment, set the attachments parameter to a JSON array containing attachment objects. Each object has the type field which determines the type of the attachemtn and the rest of the fields:

image – an image file that is not a photo that belongs to a photo album:

  • file_id – the id returned by the upload endpoint after uploading the image
  • file_hash – the hash from the upload endpoint
  • text – an optional caption or alt text for this image

photo – a photo from an album:

  • photo_id – the identifier of the photo

poll – a poll:

  • poll_id – the identifier of the poll returned by polls.create