How to upload via API media files and relate it to post

In this article you it’s explained how to upload media files and relate it to a post via Socialveo REST API.

  1. Upload media file:
POST /media/create


    "target_type": "tmp",

    "network_uuid": "a66b8654-14a8-11e6-af87-54bef75c7a3f",

    "name": "name",

    "file" : "file://..."


  • Important! Set target_type to tmp.
  • You can change network_uuid to dialog_uuid for private messages.
  1. Create post with media files:
POST /posts/create


    "body": "",

    "post_type": "post",

    "media_uuids": "9a92599e-a484-11e7-954c-54bef75c7a3f,9a92599e-a484-11e7-954c-54bef75c7a3f"


  • media_uuids accepts uuids separated by comas or array, e.g.
  "media_uuids": "UUID1,UUID2,UUID3"


  "media_uuids[]": "UUID1",

  "media_uuids[]": "UUID2",

  "media_uuids[]": "UUID3"

  • body not required when media_uuids set
  • all media of media_uuids must have target_type tmp, after creating post it automatically will be changed to post
  • post accepts up to 10 (defined in config posts.maxUploadFiles) uploaded images or 1 video or 1 file

Was this article helpful?

Related Articles

Leave A Comment?

You must be logged in to post a comment.