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

# 获取任务详情

> 查询 NanoBanana 任务执行详情和状态。

<Info>
  查询 NanoBanana 图像生成或编辑任务的状态和结果。
</Info>

### 状态说明

* **0: 生成中** - 任务正在处理中
* **1: 成功** - 任务完成成功
* **2: 创建任务失败** - 任务创建失败
* **3: 生成失败** - 任务创建成功但生成失败

### 使用指南

* 使用此接口检查生成任务的当前状态
* 通过 `successFlag` 字段监控任务进度
* 当任务成功完成时获取生成的图像 URL
* 使用 `errorCode` 和 `errorMessage` 字段处理错误情况

### 开发者注意事项

* 任务 ID 从生成或编辑图像接口的响应中获得
* 当 `successFlag` 为 1（成功）时，生成的图像 URL 可用
* BFL 的原始图像 URL（`originImageUrl`）仅在 10 分钟内有效
* 我们服务器上的结果图像 URL（`resultImageUrl`）有更长的可用时间


## OpenAPI

````yaml cn/nanobanana-api/nanobanana-api-cn.json get /api/v1/nanobanana/record-info
openapi: 3.0.0
info:
  title: NanoBanana API
  description: NanoBanana API 文档 - 图像生成和编辑 API
  version: 1.0.0
  contact:
    name: 技术支持
    email: support@nanobananaapi.ai
servers:
  - url: https://api.nanobananaapi.ai
    description: API 服务器
security:
  - BearerAuth: []
paths:
  /api/v1/nanobanana/record-info:
    get:
      summary: 获取任务详情
      description: |-
        查询 NanoBanana 任务执行详情和状态。

        ### 状态说明
        - 0: 生成中 - 任务正在处理中
        - 1: 成功 - 任务完成成功
        - 2: 创建任务失败 - 任务创建失败
        - 3: 生成失败 - 任务创建成功但生成失败
      operationId: get-task-details
      parameters:
        - in: query
          name: taskId
          description: 任务 ID（必填）
          required: true
          schema:
            type: string
          example: nanobanana_123456
      responses:
        '200':
          description: 请求成功
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    enum:
                      - 200
                      - 400
                      - 401
                      - 404
                      - 500
                    description: |-
                      响应状态码

                      - **200**: 成功
                      - **400**: 参数错误
                      - **401**: 未授权
                      - **404**: 任务不存在
                      - **500**: 服务器内部错误
                  msg:
                    type: string
                    description: 响应消息
                    example: success
                  data:
                    type: object
                    properties:
                      taskId:
                        type: string
                        description: 任务 ID
                        example: nanobanana_task_123456
                      paramJson:
                        type: string
                        description: 调用参数 JSON
                        example: ''
                      completeTime:
                        type: string
                        description: 任务完成时间
                        example: ''
                      response:
                        type: object
                        description: 生成结果
                        properties:
                          originImageUrl:
                            type: string
                            description: BFL 原始图片 URL（10分钟有效）
                            example: https://bfl.com/image/original.jpg
                          resultImageUrl:
                            type: string
                            description: 我们服务器的图片 URL
                            example: https://ourserver.com/image/result.jpg
                      successFlag:
                        type: integer
                        description: 生成状态：0-生成中，1-成功，2-创建任务失败，3-生成失败
                        enum:
                          - 0
                          - 1
                          - 2
                          - 3
                        example: 1
                      errorCode:
                        type: integer
                        description: 错误码
                        example: 0
                      errorMessage:
                        type: string
                        description: 错误信息
                        example: ''
                      createTime:
                        type: string
                        description: 创建时间
                        example: ''
              example:
                code: 200
                msg: success
                data:
                  taskId: nanobanana_task_123456
                  paramJson: ''
                  completeTime: ''
                  response:
                    originImageUrl: https://bfl.com/image/original.jpg
                    resultImageUrl: https://ourserver.com/image/result.jpg
                  successFlag: 1
                  errorCode: 0
                  errorMessage: ''
                  createTime: ''
        '400':
          description: 参数错误
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    example: 400
                  msg:
                    type: string
                    example: 参数错误
        '401':
          description: 未授权
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    example: 401
                  msg:
                    type: string
                    example: 未授权
        '404':
          description: 任务不存在
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    example: 404
                  msg:
                    type: string
                    example: 任务不存在
        '500':
          description: 服务器内部错误
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    example: 500
                  msg:
                    type: string
                    example: 服务器内部错误
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: |-
        所有 API 都需要通过 Bearer Token 进行身份验证。

        获取 API Key：
        1. 访问 [API Key 管理页面](https://nanobananaapi.ai/api-key) 获取您的 API Key

        使用方法：
        在请求头中添加：
        Authorization: Bearer YOUR_API_KEY

        注意：
        - 请保护您的 API Key 安全，不要与他人分享
        - 如果您怀疑 API Key 已泄露，请立即在管理页面重置

````