> ## Documentation Index
> Fetch the complete documentation index at: https://social-b97141fb-feat-user-history-moderation-detail.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Audio Posts

> Create audio posts where the SDK exposes audio post creation.

Audio posts attach uploaded audio files to a post. Upload the audio first, then pass the uploaded audio objects or file IDs to the post creation API.

<Info>
  TypeScript, Android, and iOS expose audio post creation APIs. Flutter can upload audio files, but the current public Flutter post creation builder does not expose an audio post creation method.
</Info>

<CardGroup cols={2}>
  <Card title="Uploaded Audio" icon="file-audio">
    Create posts from audio objects or file IDs returned by the audio upload flow.
  </Card>

  <Card title="Platform-Aware" icon="code">
    Use audio post creation only on SDKs that expose it in the public post builder.
  </Card>
</CardGroup>

## Parameters

| Parameter | Required | Platforms | Description |
| - | - | - | - |
| `audios`, `uploadedAudios`, or `fileId` | Yes | TypeScript, iOS, Android | Uploaded audio objects or audio file IDs, depending on SDK. |
| `text` | No | TypeScript, iOS, Android | Caption text shown with the audio post. |
| `targetType` | Yes | TypeScript, iOS, Android | Feed target, usually `community` or `user`. |
| `targetId` | Yes | TypeScript, iOS, Android | Community ID or user ID for the target feed. |
| `metadata` | No | TypeScript, iOS, Android | Custom metadata stored with the post where supported. |
| `mentionees` | No | TypeScript, iOS, Android | User mention payload where supported by the platform builder. |
| `productTags` | No | iOS | Products named in the parent post text. |
| `attachmentProductTags` | No | TypeScript, iOS | Products shown on the child audio attachment. An `AmityAttachmentProductTags` container keyed by `fileId`. |

<Note>
  **Product tags (SDK API).** An audio post has a text parent and an audio child. iOS accepts both inputs on `createAudioPost`; TypeScript accepts `attachmentProductTags` for the child only. The public Android and Flutter audio creators expose neither field, so this page does not promise a post-creation workaround. UIKit's product-tag UI is a separate surface and may support fewer post types; see [UIKit Product Tagging](/uikit/components/social/product-tagging). For tagging limits and tap-through behavior, see [Product Tagging](/uikit/components/social/posts#product-tagging).
</Note>

## Create an Audio Post

The examples below create an audio post in a community on SDKs that support audio post creation.

<CodeGroup>
  ```swift iOS theme={null}
  func createAudioPost(
      uploadedAudios: [AmityAudioData],
      communityId: String
  ) async throws -> AmityPost {
      let postRepository = AmityPostRepository()
      let builder = AmityAudioPostBuilder()
      builder.setAudios(uploadedAudios)
      builder.setText("Listen to this")

      return try await postRepository.createAudioPost(
          builder,
          targetId: communityId,
          targetType: .community,
          metadata: nil,
          mentionees: nil
      )
  }
  ```

  ```kotlin Android theme={null}
  fun createAudioPost(
      uploadedAudios: Set<AmityAudio>,
      communityId: String
  ) {
      postRepository.createAudioPost(
          targetType = AmityPost.TargetType.COMMUNITY,
          targetId = communityId,
          audios = uploadedAudios,
          text = "Listen to this"
      )
          .subscribe({ post ->
              showSuccessMessage(post.getPostId())
          }, { error ->
              handleGeneralError(error)
          })
  }
  ```

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

  const { data: post } = await PostRepository.createAudioPost({
    targetType: "community",
    targetId: communityId,
    data: {
      text: "Listen to this",
    },
    attachments: [
      {
        type: "audio",
        fileId,
      },
    ],
  });
  ```
</CodeGroup>

## Flutter Support

Flutter's public file repository supports audio upload, but the public post creation builder currently exposes text, image, video, file, poll, live stream, and custom post creation paths. It does not expose `.audio(...)` or a dedicated audio post creator.

Use a supported Flutter post type, or create audio posts from a platform/backend layer that exposes audio post creation.

## Notes

* TypeScript accepts audio attachments as `{ type: "audio", fileId }`.
* Android accepts a `Set<AmityAudio>`.
* iOS accepts `[AmityAudioData]`.
* Do not set `structureType` manually; the service derives post structure from the created post data.

## Related Topics

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

  <Card title="Mixed Media Posts" icon="layer-group" href="./mixed-media-post">
    Combine multiple supported media attachment types.
  </Card>

  <Card title="Posts Overview" icon="newspaper" href="../overview">
    Review post concepts, retrieval, and moderation flows.
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.