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

# Describe an image with Midjourney

> Use CometAPI POST /mj/submit/describe to extract an initial Midjourney prompt from an uploaded image for fast remixing and iteration.

Use this endpoint to extract Midjourney-style prompt suggestions from an input image.

## What this route is good for

* Turning an image into prompt candidates you can remix
* Extracting a visual direction before you start a fresh imagine task
* Building a faster authoring loop when you do not want to write the first prompt from scratch

## Task flow

<Steps>
  <Step title="Submit the image">
    Upload or reference the image you want Midjourney to describe and store the returned task id.
  </Step>

  <Step title="Poll the describe task">
    Use [Fetch Single Task](./task-fetching-api/fetch-single-task) until the task completes and returns prompt-like output.
  </Step>

  <Step title="Reuse the generated prompt">
    Take the prompt candidate that fits your intent and continue with [Imagine](./imagine) for a fresh generation pass.
  </Step>
</Steps>


## OpenAPI

````yaml api/openapi/image/midjourney/post-describe.openapi.json POST /mj/submit/describe
openapi: 3.1.0
info:
  title: Describe (image -> text) API
  version: 1.0.0
servers:
  - url: https://api.cometapi.com
security:
  - bearerAuth: []
paths:
  /mj/submit/describe:
    post:
      summary: Describe (image -> text)
      description: >-
        . The extracted prompt suggestions arrive in the task's `promptEn` field
        when you fetch the finished task.
      operationId: describe
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - base64
                - link
              properties:
                botType:
                  type: string
                  description: >-
                    Bot type to use. `MID_JOURNEY` for Midjourney (default),
                    `NIJI_JOURNEY` for Niji.
                  enum:
                    - NIJI_JOURNEY
                    - MID_JOURNEY
                base64:
                  type: string
                  description: >-
                    Base64-encoded image to describe. Use a data URI such as
                    `data:image/png;base64,xxx`. Provide either `base64` or
                    `link`.
                  default: data:image/png;base64,<your-image-base64>
                state:
                  type: string
                  description: >-
                    Custom state string. Returned as-is in the task result and
                    webhook callback for your own tracking.
                link:
                  type: string
                  description: >-
                    URL of the image to describe. Provide either `link` or
                    `base64`.
                  default: https://your-image-host/source.png
              default:
                base64: data:image/png;base64,<your-image-base64>
                link: https://your-image-host/source.png
            examples:
              Default:
                summary: Default
                value:
                  botType: MID_JOURNEY
                  base64: data:image/png;base64,xxx
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                required:
                  - code
                  - description
                  - properties
                  - result
                properties:
                  code:
                    type: integer
                    description: >-
                      Submission status code. `1` = submitted successfully
                      (`result` carries the task id). `21` = the action opened a
                      confirmation modal; continue with `/mj/submit/modal` using
                      the returned task id. `4` = parameter error; `description`
                      explains the cause.
                  description:
                    type: string
                  properties:
                    type: object
                    properties: {}
                  result:
                    type: integer
      x-codeSamples:
        - lang: Shell
          label: Default
          source: |
            IMAGE_B64=$(base64 < cat.jpg | tr -d '\n')

            curl https://api.cometapi.com/mj/submit/describe \
              -H "Authorization: Bearer $COMETAPI_KEY" \
              -H "Content-Type: application/json" \
              -d "{
                \"botType\": \"MID_JOURNEY\",
                \"base64\": \"data:image/jpeg;base64,$IMAGE_B64\"
              }"
        - lang: Python
          label: Default
          source: >
            import base64

            import os

            import requests


            with open("cat.jpg", "rb") as f:
                image_b64 = base64.b64encode(f.read()).decode()

            response = requests.post(
                "https://api.cometapi.com/mj/submit/describe",
                headers={"Authorization": "Bearer " + os.environ["COMETAPI_KEY"]},
                json={
                    "botType": "MID_JOURNEY",
                    "base64": "data:image/jpeg;base64," + image_b64,
                },
            )


            task = response.json()

            print(task["code"], task.get("result"))  # poll the task; extracted
            prompts arrive in promptEn
        - lang: JavaScript
          label: Default
          source: >
            import { readFile } from "node:fs/promises";


            const imageB64 = (await readFile("cat.jpg")).toString("base64");


            const response = await
            fetch("https://api.cometapi.com/mj/submit/describe", {
                method: "POST",
                headers: {
                    Authorization: `Bearer ${process.env.COMETAPI_KEY}`,
                    "Content-Type": "application/json",
                },
                body: JSON.stringify({
                    botType: "MID_JOURNEY",
                    base64: `data:image/jpeg;base64,${imageB64}`,
                }),
            });


            const task = await response.json();

            console.log(task.code, task.result); // poll the task; extracted
            prompts arrive in promptEn
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Bearer token authentication. Use your CometAPI key.

````