> ## Documentation Index
> Fetch the complete documentation index at: https://learn.social.plus/llms.txt
> Use this file to discover all available pages before exploring further.

# Clip Posts

> Create short-form video posts from an uploaded clip.

Clip posts publish an uploaded clip into a user or community feed. Upload the clip first, then pass the uploaded file ID or clip data into the post creation API.

<Note>
  Use clip posts for short-form video experiences that need the `clip` post type. Use video posts when you only need the standard uploaded-video post flow.
</Note>

## Parameters

| Parameter          | Required | Description                                                |
| ------------------ | -------- | ---------------------------------------------------------- |
| `clip` or `fileId` | Yes      | Uploaded clip data or clip file ID, depending on SDK       |
| `text`             | No       | Caption text shown with the post                           |
| `displayMode`      | No       | Clip display mode where supported, such as `fill` or `fit` |
| `isMuted`          | No       | Whether playback should start muted where supported        |
| `targetType`       | Yes      | Feed target, usually `community` or `user`                 |
| `targetId`         | Yes      | Community ID or user ID for the target feed                |

## Create a Clip Post

Create a clip post from an uploaded clip file or clip data, and include optional display settings where supported.

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { PostRepository } from "@amityco/ts-sdk";

  const { data: post } = await PostRepository.createClipPost({
    targetType: "community",
    targetId: communityId,
    data: {
      text: "Watch this clip",
    },
    attachments: [
      {
        type: "clip",
        fileId,
        displayMode: "fill",
        isMuted: false,
      },
    ],
  });
  ```

  ```kotlin Android theme={null}
  fun createClipPost(uploadedClip: AmityClip, communityId: String) {
      postRepository.createClipPost(
          targetType = AmityPost.TargetType.COMMUNITY,
          targetId = communityId,
          clip = uploadedClip,
          text = "Watch this clip",
          displayMode = AmityClip.DisplayMode.FILL,
          isMuted = false
      )
          .subscribe(
              { post -> showSuccessMessage(post.getPostId()) },
              { error -> handleGeneralError(error) }
          )
  }
  ```

  ```swift iOS theme={null}
  func createClipPost(
      uploadedClip: AmityClipData,
      communityId: String
  ) async throws -> AmityPost {
      let postRepository = AmityPostRepository()
      let builder = AmityClipPostBuilder()
      builder.setClip(uploadedClip)
      builder.setText("Watch this clip")
      builder.setDisplayMode(.fill)
      builder.setIsMuted(false)

      return try await postRepository.createClipPost(
          builder,
          targetId: communityId,
          targetType: .community,
          metadata: nil,
          mentionees: nil
      )
  }
  ```
</CodeGroup>

<Info>
  The current Flutter public post creation builder does not expose a clip post creator. It supports text, image, video, file, poll, live stream, and custom post creation.
</Info>

## Platform Notes

* TypeScript exposes `PostRepository.createClipPost()` with `attachments: [{ type: "clip", fileId }]`.
* Android exposes `AmityPostRepository.createClipPost()` with an uploaded `AmityClip`.
* iOS exposes `AmityPostRepository.createClipPost()` with `AmityClipPostBuilder` and uploaded `AmityClipData`.
* Flutter does not currently expose a public clip post creation method.

## Related Topics

<CardGroup cols={3}>
  <Card title="Video Handling" icon="upload" href="/social-plus-sdk/core-concepts/content-handling/files-images-and-videos/video-handling">
    Upload video files before creating video-based posts.
  </Card>

  <Card title="Video Posts" icon="film" href="./video-post">
    Create standard uploaded-video posts.
  </Card>

  <Card title="Mixed Media Posts" icon="images" href="./mixed-media-post">
    Combine multiple supported media attachments in one post.
  </Card>
</CardGroup>
