> ## 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.

# Bir Midjourney imagine görevi oluşturun

> CometAPI içinde POST /mj/submit/imagine kullanarak tam Discord parametreleriyle Midjourney imagine görevleri oluşturun, task_id durumunu takip edin ve görüntüden videoya hareket efektlerini etkinleştirin.

Bu endpoint’i ana Midjourney iş akışını başlatmak için kullanın. Upscale, variation ve custom zoom dahil sonraki her adım, başarılı bir imagine göreviyle başlar.

## İlk yanıtın size verdikleri

* `result`, bir sonraki sorgulayacağınız task id’dir
* `code`, HTTP tarzı `200` olmadığında bile yine de bir başarı kodu olabilir

## Temel iş akışı

<Steps>
  <Step title="Imagine görevini gönderin">
    Prompt’u gönderin ve döndürülen task id’yi saklayın.
  </Step>

  <Step title="Görev tamamlanana kadar sorgulayın">
    Görev `SUCCESS`, `MODAL` veya `FAILURE` durumuna ulaşana kadar [Tek bir görevi getir](./task-fetching-api/fetch-single-task) endpoint’ini kullanın.
  </Step>

  <Step title="Sonraki işlem adımlarıyla devam edin">
    Butonlar göründüğünde, upscale, variation, reroll, zoom ve benzeri devam işlemleri için [Action](./action) kullanın.
  </Step>
</Steps>

## İsteğe bağlı video prompt kalıbı

Bir kaynak görüntüden hareket istiyorsanız, prompt’a bir görüntü URL’si ile Midjourney video bayrakları ekleyin; örneğin `--video` ve `--motion`.


## OpenAPI

````yaml api/openapi/image/midjourney/post-imagine.openapi.json POST /mj/submit/imagine
openapi: 3.1.0
info:
  title: Imagine API
  version: 1.0.0
  description: >-
    Create a Midjourney imagine task through CometAPI and receive a task id for
    later polling.
servers:
  - url: https://api.cometapi.com
security:
  - bearerAuth: []
paths:
  /mj/submit/imagine:
    post:
      summary: Create a Midjourney imagine task
      description: >-
        Submit the primary Midjourney generation request. Poll the returned task
        id with the fetch endpoint until the task reaches a terminal state.
      operationId: imagine
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - prompt
              properties:
                botType:
                  type: string
                  description: >-
                    Bot type to use. `MID_JOURNEY` for Midjourney (default),
                    `NIJI_JOURNEY` for Niji.
                  default: MID_JOURNEY
                  enum:
                    - MID_JOURNEY
                    - NIJI_JOURNEY
                prompt:
                  type: string
                  description: >-
                    Text prompt for the generation. Supports standard Midjourney
                    parameters such as `--v`, `--ar`, `--stylize`, etc.
                  example: a paper boat floating on calm water at sunrise --v 6.1
                accountFilter:
                  type: object
                  description: >-
                    Filter which Midjourney account modes may be used for this
                    task.
                  properties:
                    modes:
                      type: array
                      description: Allowed speed modes, e.g. `FAST`, `RELAX`, or `TURBO`.
                      items:
                        type: string
                base64Array:
                  type: array
                  description: >-
                    Base64-encoded reference images. Each item should be a data
                    URI such as `data:image/png;base64,xxx`.
                  items:
                    type: string
                state:
                  type: string
                  description: >-
                    Custom state string. Returned as-is in the task result and
                    webhook callback for your own tracking.
              default:
                botType: MID_JOURNEY
                prompt: a paper boat floating on calm water at sunrise --v 6.1
                accountFilter:
                  modes:
                    - FAST
            examples:
              Default:
                summary: Default
                value:
                  botType: MID_JOURNEY
                  prompt: a paper boat floating on calm water at sunrise --v 6.1
                  accountFilter:
                    modes:
                      - FAST
      responses:
        '200':
          description: Task accepted.
          content:
            application/json:
              schema:
                type: object
                required:
                  - code
                  - description
                  - 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:
                      discordChannelId:
                        type: string
                      discordInstanceId:
                        type: string
                  result:
                    type: string
                    description: Task id returned after submission.
                example:
                  code: 1
                  description: Submission successful
                  result: '1773314942177684'
                  properties:
                    discordChannelId: 5e6ca8e1f40e4de6
                    discordInstanceId: 5e6ca8e1f40e4de6
      x-codeSamples:
        - lang: Shell
          label: Default
          source: |
            curl https://api.cometapi.com/mj/submit/imagine \
              -H "Authorization: Bearer $COMETAPI_KEY" \
              -H "Content-Type: application/json" \
              -d '{
                  "botType": "MID_JOURNEY",
                  "prompt": "a paper boat floating on calm water at sunrise --v 6.1",
                  "accountFilter": {
                    "modes": [
                      "FAST"
                    ]
                  }
                }'
        - lang: Python
          label: Default
          source: >
            import os

            import requests


            response = requests.post(
                "https://api.cometapi.com/mj/submit/imagine",
                headers={"Authorization": "Bearer " + os.environ["COMETAPI_KEY"]},
                json={
                        "botType": "MID_JOURNEY",
                        "prompt": "a paper boat floating on calm water at sunrise --v 6.1",
                        "accountFilter": {
                                "modes": [
                                        "FAST"
                                ]
                        }
                },
            )


            task = response.json()

            print(task["code"], task.get("result"))  # code 1 means submitted;
            result is the task id
        - lang: JavaScript
          label: Default
          source: >
            const response = await
            fetch("https://api.cometapi.com/mj/submit/imagine", {
                method: "POST",
                headers: {
                    Authorization: `Bearer ${process.env.COMETAPI_KEY}`,
                    "Content-Type": "application/json",
                },
                body: JSON.stringify({
                        "botType": "MID_JOURNEY",
                        "prompt": "a paper boat floating on calm water at sunrise --v 6.1",
                        "accountFilter": {
                            "modes": [
                                "FAST"
                            ]
                        }
                    }),
            });


            const task = await response.json();

            console.log(task.code, task.result); // code 1 means submitted;
            result is the task id
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Bearer token authentication. Use your CometAPI key.

````