# "Lấy trạng thái tác vụ theo ID"

Nguồn: https://docs.openaihub.net/api-45208857/

> API origin: `https://api.openaihub.net`. Chọn đúng nhóm API và model. Thông số dưới đây là bản tham chiếu kỹ thuật; chưa phải kết quả kiểm thử từng endpoint bằng tài khoản của bạn.


## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /mj/task/{id}/fetch:
    get:
      summary: Lấy trạng thái tác vụ theo ID
      deprecated: false
      description: >-
        Truy vấn trạng thái/kết quả hiện tại của một tác vụ được gửi qua `POST
        /mj/submit/imagine`, `/mj/submit/action`, v.v. Khi `status` là
        `SUCCESS`, `imageUrl` hợp lệ và `buttons` liệt kê các thao tác tiếp theo
        khả dụng (`customId`).
      operationId: mj_task_fetch
      tags:
        - OpenAiHub Việt Nam/OpenAiHub Tiếng Việt/Hình ảnh/Midjourney
        - Midjourney
      parameters:
        - name: id
          in: path
          description: Mã tác vụ
          required: true
          example: '1743326750223591'
          schema:
            type: string
        - name: Authorization
          in: header
          description: Khóa API Bearer
          required: false
          example: Bearer {{YOUR_API_KEY}}
          schema:
            type: string
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties: {}
            examples: {}
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                required:
                  - id
                  - action
                  - customId
                  - botType
                  - prompt
                  - promptEn
                  - description
                  - state
                  - submitTime
                  - startTime
                  - finishTime
                  - imageUrl
                  - status
                  - progress
                  - failReason
                  - buttons
                  - maskBase64
                  - properties
                properties:
                  action:
                    type: string
                    description: Loại hành động
                  botType:
                    type: string
                    description: Loại bot
                  buttons:
                    type: array
                    items:
                      type: object
                      required:
                        - customId
                        - emoji
                        - label
                        - type
                        - style
                      properties:
                        customId:
                          type: string
                          description: Mã định danh chuyển tiếp tùy chỉnh
                        emoji:
                          type: string
                          description: Định danh biểu tượng cảm xúc
                        label:
                          type: string
                          description: Nhãn hiển thị
                        style:
                          type: integer
                          description: Tham số phong cách
                        type:
                          type: integer
                          description: Kiểu
                      x-apifox-orders:
                        - customId
                        - emoji
                        - label
                        - style
                        - type
                      x-apidog-orders:
                        - customId
                        - emoji
                        - label
                        - style
                        - type
                    description: Danh sách các nút / hành động có thể thực hiện tiếp theo
                  customId:
                    type: string
                    description: Mã định danh chuyển tiếp tùy chỉnh
                  description:
                    type: string
                    description: Mô tả
                  failReason:
                    type: string
                    description: Ly do that bai
                  finishTime:
                    type: integer
                    description: Thời gian hoàn thành
                  id:
                    type: string
                    description: ID tài nguyên hoặc tác vụ
                  imageUrl:
                    type: string
                    description: URL hình ảnh kết quả
                  maskBase64:
                    type: string
                    description: Base64 của ảnh mặt nạ
                  progress:
                    type: string
                    description: Tiến trình (0-100 hoặc 0-1, tùy thuộc vào nền tảng)
                  prompt:
                    type: string
                    description: Lời nhắc văn bản
                  promptEn:
                    type: string
                    description: Lời nhắc bằng tiếng Anh
                  properties:
                    type: object
                    required:
                      - finalPrompt
                      - finalZhPrompt
                    properties:
                      finalPrompt:
                        type: string
                        description: Lời nhắc cuối cùng thực sự được sử dụng
                      finalZhPrompt:
                        type: string
                        description: Lời nhắc cuối cùng bằng tiếng Trung
                    description: Thuộc tính mở rộng
                    x-apifox-orders:
                      - finalPrompt
                      - finalZhPrompt
                    x-apidog-orders:
                      - finalPrompt
                      - finalZhPrompt
                  startTime:
                    type: integer
                    description: Thời gian bắt đầu
                  state:
                    type: string
                    description: Trạng thái chuyển tiếp tùy chỉnh
                  status:
                    type: string
                    description: Trạng thái
                  submitTime:
                    type: integer
                    description: Thời gian gửi
                refName: GetMjTaskFetchResponse
                x-apifox-orders:
                  - action
                  - botType
                  - buttons
                  - customId
                  - description
                  - failReason
                  - finishTime
                  - id
                  - imageUrl
                  - maskBase64
                  - progress
                  - prompt
                  - promptEn
                  - properties
                  - startTime
                  - state
                  - status
                  - submitTime
                x-apidog-orders:
                  - action
                  - botType
                  - buttons
                  - customId
                  - description
                  - failReason
                  - finishTime
                  - id
                  - imageUrl
                  - maskBase64
                  - progress
                  - prompt
                  - promptEn
                  - properties
                  - startTime
                  - state
                  - status
                  - submitTime
              examples:
                '1':
                  summary: '1'
                  value: '[long payload omitted: 2,247 units]'
          headers: {}
          x-apidog-name: ''
        '400':
          description: Yêu cầu không hợp lệ hoặc xác thực thất bại
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                properties:
                  error:
                    type: object
                    required:
                      - message
                      - type
                    properties:
                      message:
                        type: string
                        description: Thông báo lỗi (thường kết thúc bằng mã yêu cầu)
                      type:
                        type: string
                        description: Loại lỗi; các lỗi cổng cục bộ thường là new_api_error
                        examples:
                          - new_api_error
                    x-apifox-orders:
                      - message
                      - type
                    x-apidog-orders:
                      - message
                      - type
                refName: NewApiError
                x-apifox-orders:
                  - error
                x-apidog-orders:
                  - error
              examples:
                example:
                  summary: example
                  value:
                    error:
                      message: >-
                        Yêu cầu không hợp lệ (mã yêu cầu:
                        20260805120000123456789AbCdEfGh)
                      type: new_api_error
          headers: {}
          x-apidog-name: Yêu cầu không hợp lệ hoặc xác thực thất bại
        '401':
          description: Khóa API bị thiếu hoặc không hợp lệ
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                properties:
                  error:
                    type: object
                    required:
                      - message
                      - type
                    properties:
                      message:
                        type: string
                        description: Thông báo lỗi (thường kết thúc bằng mã yêu cầu)
                      type:
                        type: string
                        description: Loại lỗi; các lỗi cổng cục bộ thường là new_api_error
                        examples:
                          - new_api_error
                    x-apifox-orders:
                      - message
                      - type
                    x-apidog-orders:
                      - message
                      - type
                refName: NewApiError
                x-apifox-orders:
                  - error
                x-apidog-orders:
                  - error
              examples:
                example:
                  summary: example
                  value:
                    error:
                      message: >-
                        Mã thông báo không hợp lệ (request id:
                        20260805120000123456789AbCdEfGh)
                      type: new_api_error
          headers: {}
          x-apidog-name: Khóa API bị thiếu hoặc không hợp lệ
      security: []
      x-apidog-folder: OpenAiHub Việt Nam/OpenAiHub Tiếng Việt/Hình ảnh/Midjourney
      x-apidog-status: released
      x-run-in-apidog: https://app.apidog.com/web/project/1218648/apis/api-45208857-run
components:
  schemas: {}
  securitySchemes: {}
servers:
  - url: https://api.openaihub.net
    description: Prod Env
security: []

```
