Social API reference

Social API · Assets

post/v1/communities/{community_id}/assetsAuth

Upload media. Images (multipart): processed synchronously, returns ready. Videos (JSON, kind:'video' + declared content_type/byte_size): returns an `uploading` asset with a presigned PUT — upload the bytes, then POST /assets/:id/complete.

Path parameters

community_id*string

Community UUID.

Headers

Idempotency-Keystring

Makes retries safe.

Request body

filestring · binary

PNG / JPEG / WEBP, ≤10 MB — image path (multipart) only.

actor_idstring · uuid

The acting actor, who owns the upload. Send it, or the deprecated `owner_actor_id`; one of the two is required.

owner_actor_idstring · uuid

Deprecated alias of `actor_id`; send `actor_id`.

kindenum (2)

Pass 'video' (JSON body) for the presigned-PUT flow.

content_typeenum (3)

Video path: declared container type.

byte_sizeinteger

Video path: declared size in bytes (≤512 MB).

Response · 201 Image stored and ready, or video created in `uploading` with `upload` instructions.

id*string · uuid

Id of the new asset; attach it to posts, comments or messages once it is `ready`.

Example: "eeeeeeee-0000-0000-0000-000000000001"

status*object

`ready` when the bytes were sent inline; `uploading` until you PUT the bytes to `upload.url` (then call complete); `processing` while a video transcodes; `failed` on error.

Example: "ready"

uploadobject

Present only on video creation — PUT the bytes here, then POST /assets/:id/complete.

Example

Request

POST https://social.productcraft.co/v1/communities/{community_id}/assets
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json

{
  "file": "string",
  "actor_id": "00000000-0000-0000-0000-000000000000",
  "owner_actor_id": "00000000-0000-0000-0000-000000000000",
  "kind": "image",
  "content_type": "video/mp4",
  "byte_size": 0
}

Response

{
  "id": "eeeeeeee-0000-0000-0000-000000000001",
  "status": "ready",
  "upload": {}
}