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

# 查询任务

> 使用原始id查询任务，必须使用提交任务时的同一个平台API Key。任务状态为数字0/1/2/3，图片在urls中；查询不会再次生成图片。

状态含义、轮询代码与错误处理见 [Midjourney 图片生成与编辑示例](/api-reference/examples/images/midjourney)。


## OpenAPI

````yaml api-reference/youchuan-openapi.json GET /v1/tob/job/{jobId}
openapi: 3.1.0
info:
  title: TokenOPS 悠船 MJ 图片 API
  version: 1.0.0
  description: >-
    Midjourney 图片生成、任务查询与编辑接口。使用 Bearer 鉴权；直接生成请求指定
    model，二次编辑使用来源任务的模型；通过轮询获取结果。
servers:
  - url: https://model-api.skyengine.com.cn
    description: 平台API地址；模型须已开通。
security:
  - bearerAuth: []
tags:
  - name: 悠船 MJ 图片
paths:
  /v1/tob/job/{jobId}:
    get:
      tags:
        - 悠船 MJ 图片
      summary: 查询任务
      description: 使用原始id查询任务，必须使用提交任务时的同一个平台API Key。任务状态为数字0/1/2/3，图片在urls中；查询不会再次生成图片。
      operationId: youchuanGetJob
      parameters:
        - name: jobId
          in: path
          required: true
          schema:
            type: string
            minLength: 1
          description: 任务响应中的id。
      responses:
        '200':
          description: 返回当前任务状态；失败任务也通过status=3表达。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/YouchuanJob'
              examples:
                queued:
                  summary: 排队等待
                  value:
                    id: <job_id>
                    status: 0
                    urls: []
                    comment: JobStatusQueued
                running:
                  summary: 执行中
                  value:
                    id: <job_id>
                    status: 1
                    urls: []
                    comment: 执行中
                success:
                  summary: 生成成功
                  value:
                    id: <job_id>
                    status: 2
                    urls:
                      - https://example.com/result.png
                    comment: 成功
                failed:
                  summary: 生成失败，HTTP仍为200
                  value:
                    id: <job_id>
                    status: 3
                    urls: []
                    comment: JobStatusInvalidImagePromptLink
        '400':
          description: 任务不存在、已过期或不属于当前API Key。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/YouchuanError'
              example:
                error:
                  code: 2004
                  message: job not found
        '401':
          description: 认证失败。
        '424':
          description: 下游查询失败；继续查询同一任务id。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/YouchuanError'
              example:
                error:
                  code: 2002
                  message: query Youchuan job
        '500':
          description: 查询暂时失败。
components:
  schemas:
    YouchuanJob:
      type: object
      required:
        - id
        - status
        - urls
        - comment
      properties:
        id:
          type: string
          description: 原始任务ID。后续编辑作为jobId，查询作为路径参数。
        text:
          type: string
        status:
          type: integer
          enum:
            - 0
            - 1
            - 2
            - 3
          description: 0等待；1执行中；2成功；3失败。
        urls:
          type:
            - array
            - 'null'
          items:
            type: string
            format: uri
          description: 成功后的图片地址；等待中通常为空。
        comment:
          type: string
          description: 状态说明或任务失败原因。
        cost:
          type:
            - object
            - 'null'
          properties:
            jobId:
              type: string
            feeCost:
              type:
                - integer
                - 'null'
            fastCost:
              type: number
            relaxCost:
              type: number
            costAt:
              type: string
          description: 上游任务消耗信息；完成前可能变化，不等同于平台钱包流水或最终实付账单。
        audits:
          type: array
          items:
            type: string
        seed:
          type: integer
    YouchuanError:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          properties:
            code:
              type: integer
            message:
              type: string
            details:
              type: array
              items:
                type: object
                properties:
                  code:
                    type: integer
                  message:
                    type: string
            trace_id:
              type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 在 Authorization 请求头中传入 Bearer <API-KEY>。

````

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