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

# ブランドメッセージの画像をアップロードする

> カカオブランドメッセージのテンプレートまたは自由形式メッセージに使う画像をアップロードします。

> [!NOTE]
>
> ブランドメッセージのテンプレートまたは自由形式メッセージに画像を使うときは、先にカカオBizMessageにアップロードします。レスポンスの`data.images[].url`を、テンプレート作成または自由形式メッセージ配信リクエストの画像フィールドに指定します。

> [!WARNING]
>
> 画像の用途に合ったサイズと縦横比を使用してください。比率は横幅と高さの順です。
>
> | `type` | 用途 | サイズと縦横比 |
> | - | - | - |
> | `image` | 画像型、コマース型 | 推奨800 × 400 px、横幅500 px以上、比率3:4から2:1 |
> | `wide-image` | ワイド画像型 | 推奨800 × 600 px、横幅500 px以上、比率1:1から2:1 |
> | `wide-itemlist-first-image` | ワイドアイテムリストのメイン画像 | 横幅500 px以上、比率2:1 |
> | `wide-itemlist-image` | ワイドアイテムリストのサブ画像 | 横幅500 px以上、比率1:1 |
> | `carousel-image` | カルーセルフィード型 | 推奨800 × 600 pxまたは800 × 400 px、横幅500 px以上、比率3:4から2:1 |
> | `carousel-commerce-image` | カルーセルコマース型 | 推奨800 × 600 pxまたは800 × 400 px、横幅500 px以上、比率3:4から2:1。すべての画像に同じ比率を使用します。 |
>
> JPGまたはPNGを使用してください。ファイルサイズは1件あたり最大5 MBです。


## OpenAPI

````yaml /ja/api-reference/openapi.yaml post /v1/projects/{projectId}/messages/kakao-brand-message/images
openapi: 3.0.3
info:
  title: Notifly API
  version: 1.0.0
  contact:
    email: contact@notifly.tech
servers:
  - url: https://api.notifly.tech
    description: Notifly APIサーバー
security: []
tags:
  - name: catalog
    x-group: カタログ
paths:
  /v1/projects/{projectId}/messages/kakao-brand-message/images:
    post:
      summary: upload-kakao-brand-message-image
      operationId: uploadKakaoBrandMessageImage
      parameters:
        - name: projectId
          in: path
          required: true
          schema:
            type: string
          description: プロジェクトIDです。
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/KakaoBrandMessageImageUploadRequest'
            encoding:
              file:
                contentType: image/jpeg, image/png
              images:
                contentType: image/jpeg, image/png
      responses:
        '200':
          description: 画像をアップロードしました。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KakaoBrandMessageImageUploadResponse'
              example:
                data:
                  images:
                    - url: https://mud-kage.kakao.com/example/img_l.jpg
                error: null
        '400':
          description: リクエストの形式が不正であるか、画像がカカオの検証に合格しませんでした。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotiflyV1ErrorResponse'
        '401':
          description: トークンが無効か期限切れのため、認証に失敗しました。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotiflyV1ErrorResponse'
        '403':
          description: プロジェクトへのアクセス権限がありません。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotiflyV1ErrorResponse'
      security:
        - bearerAuth: []
components:
  schemas:
    KakaoBrandMessageImageUploadRequest:
      type: object
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - image
            - wide-image
            - wide-itemlist-first-image
            - wide-itemlist-image
            - carousel-image
            - carousel-commerce-image
          description: >-
            アップロード画像の用途です。単一画像のタイプには`file`を、multipartの同名フィールドを繰り返し指定する複数画像のタイプには`images`を使用します。
        file:
          type: string
          format: binary
          description: '`image`、`wide-image`、`wide-itemlist-first-image`タイプで使用する単一の画像ファイルです。'
        images:
          type: array
          description: >-
            `wide-itemlist-image`、`carousel-image`、`carousel-commerce-image`タイプで繰り返し指定する画像ファイルフィールドです。
          items:
            type: string
            format: binary
    KakaoBrandMessageImageUploadResponse:
      type: object
      properties:
        data:
          type: object
          required:
            - images
          properties:
            images:
              type: array
              items:
                $ref: '#/components/schemas/KakaoBrandMessageUploadedImage'
        error:
          type: string
          nullable: true
          description: 成功時はnullです。
    NotiflyV1ErrorResponse:
      type: object
      properties:
        data:
          type: object
          nullable: true
          description: 失敗時はnullです。
        error:
          oneOf:
            - type: string
            - $ref: '#/components/schemas/NotiflyV1ErrorObject'
          description: >-
            v1
            APIのエラーレスポンスです。認証や権限のエラーはcodeとmessageを持つオブジェクト、リクエストの検証エラーは文字列で返される場合があります。
      example:
        data: null
        error:
          code: UNAUTHORIZED
          message: Invalid Authorization Token
    KakaoBrandMessageUploadedImage:
      type: object
      required:
        - url
      properties:
        url:
          type: string
          format: uri
          description: テンプレート作成リクエストまたは自由形式の送信リクエストで使用する、アップロード済み画像のURLです。
    NotiflyV1ErrorObject:
      type: object
      properties:
        code:
          type: string
          description: エラーコードです。
        message:
          type: string
          description: エラーメッセージです。
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: '`POST /authenticate`で発行したトークンをBearer形式で送信します。'

````

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