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

# Kirim Pesan

> Kirim pesan teks atau media melalui platform CSKU AI.

## Tipe Media yang Didukung

| Tipe     | Deskripsi    | Contoh Tipe MIME                    |
| -------- | ------------ | ----------------------------------- |
| image    | File gambar  | image/jpeg, image/png, image/gif    |
| video    | File video   | video/mp4, video/avi                |
| audio    | File audio   | audio/mp3, audio/wav                |
| document | File dokumen | application/pdf, application/msword |

<Callout type="warning">
  Pastikan URL media dapat diakses publik. API tidak mengunggah file; API hanya mereferensikan URL yang sudah ada.
</Callout>

<Callout type="info">
  Bahkan saat mengirim media, sediakan teks yang bermakna untuk konteks yang lebih baik.
</Callout>


## OpenAPI

````yaml openapi.yaml post /v1/message
openapi: 3.0.3
info:
  title: CSKU AI API Publik
  description: >
    CSKU AI API Publik menyediakan endpoint untuk integrasi eksternal.


    API ini memungkinkan pengiriman pesan, pengelolaan percakapan, dan
    pengambilan riwayat pesan.


    ## Autentikasi


    Gunakan header Authorization dengan Secret Key Anda:


    ```

    Authorization: Bearer {secret_key}

    ```


    Dapatkan Secret Key Anda di https://app.csku.ai/settings/secret-key-settings


    ## Batas Rate


    - **100 permintaan per menit** untuk permintaan yang terautentikasi
  version: '1.3'
  contact:
    name: Dukungan CSKU AI
    email: support@csku.ai
    url: https://docs.csku.ai
servers:
  - url: https://api.csku.ai
    description: Server produksi
security:
  - BearerAuth: []
tags:
  - name: Pesan
    description: Endpoint pengelolaan pesan
  - name: Catatan
    description: Endpoint pengelolaan catatan
  - name: Percakapan
    description: Endpoint pengelolaan percakapan
paths:
  /v1/message:
    post:
      tags:
        - Pesan
      summary: Kirim pesan
      description: Kirim pesan teks atau media melalui platform CSKU AI.
      operationId: sendMessage
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SendMessageRequest'
            examples:
              textOnly:
                summary: Pesan teks saja
                value:
                  conversation_id: conv_123456
                  text: Halo, saya butuh bantuan
                  media: null
              withImage:
                summary: Pesan dengan gambar
                value:
                  conversation_id: conv_123456
                  text: Lihat produk ini
                  media:
                    url: https://example.com/product.jpg
                    type: image
                    mimetype: image/jpeg
                    name: product.jpg
                    caption: Gambar produk
      responses:
        '200':
          description: Pesan berhasil dikirim
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SuccessResponse'
              example:
                status: 1
                message: Sukses
        '400':
          description: Permintaan Buruk - Parameter tidak valid
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Tidak terotorisasi - Autentikasi tidak valid atau tidak ada
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                status: 0
                rc: 401
                error_msg: Data tidak valid. Mohon periksa kembali parameter dan header
        '500':
          description: Kesalahan Server Internal
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    SendMessageRequest:
      type: object
      required:
        - conversation_id
        - text
      properties:
        conversation_id:
          type: string
          description: Pengidentifikasi percakapan yang unik
          example: conv_123456
        text:
          type: string
          description: Konten teks pesan
          example: Halo, saya butuh bantuan
        media:
          $ref: '#/components/schemas/MediaObject'
    SuccessResponse:
      type: object
      properties:
        status:
          type: integer
          description: Kode status (1 = sukses)
          example: 1
        message:
          type: string
          description: Pesan sukses
          example: Sukses
    ErrorResponse:
      type: object
      properties:
        status:
          type: integer
          description: Kode status (0 = error)
          example: 0
        rc:
          type: integer
          description: Kode respons/error
          example: 400
        error_msg:
          type: string
          description: Deskripsi pesan error
          example: Data tidak valid. Mohon periksa kembali parameter dan header
    MediaObject:
      type: object
      nullable: true
      description: Lampiran media (opsional)
      properties:
        url:
          type: string
          format: uri
          description: URL file media (harus dapat diakses publik)
          example: https://example.com/image.jpg
        type:
          type: string
          enum:
            - image
            - video
            - audio
            - document
          description: Jenis media
          example: image
        mimetype:
          type: string
          description: Tipe MIME file
          example: image/jpeg
        name:
          type: string
          description: Nama file
          example: image.jpg
        thumbnail:
          type: string
          format: uri
          description: URL thumbnail (opsional)
          example: https://example.com/thumb.jpg
        caption:
          type: string
          description: Keterangan atau deskripsi media
          example: Gambar produk
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        Secret Key dari dashboard
        (https://app.csku.ai/settings/secret-key-settings)

````