获取任务详情
curl --request GET \
--url https://api.nanobananaapi.ai/api/v1/nanobanana/record-info \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.nanobananaapi.ai/api/v1/nanobanana/record-info"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.nanobananaapi.ai/api/v1/nanobanana/record-info', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.nanobananaapi.ai/api/v1/nanobanana/record-info",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.nanobananaapi.ai/api/v1/nanobanana/record-info"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.nanobananaapi.ai/api/v1/nanobanana/record-info")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nanobananaapi.ai/api/v1/nanobanana/record-info")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"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": ""
}
}{
"code": 400,
"msg": "参数错误"
}{
"code": 401,
"msg": "未授权"
}{
"code": 404,
"msg": "任务不存在"
}{
"code": 500,
"msg": "服务器内部错误"
}NanoBanana API
获取任务详情
查询 NanoBanana 任务执行详情和状态。
GET
/
api
/
v1
/
nanobanana
/
record-info
获取任务详情
curl --request GET \
--url https://api.nanobananaapi.ai/api/v1/nanobanana/record-info \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.nanobananaapi.ai/api/v1/nanobanana/record-info"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.nanobananaapi.ai/api/v1/nanobanana/record-info', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.nanobananaapi.ai/api/v1/nanobanana/record-info",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.nanobananaapi.ai/api/v1/nanobanana/record-info"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.nanobananaapi.ai/api/v1/nanobanana/record-info")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nanobananaapi.ai/api/v1/nanobanana/record-info")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"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": ""
}
}{
"code": 400,
"msg": "参数错误"
}{
"code": 401,
"msg": "未授权"
}{
"code": 404,
"msg": "任务不存在"
}{
"code": 500,
"msg": "服务器内部错误"
}查询 NanoBanana 图像生成或编辑任务的状态和结果。
状态说明
- 0: 生成中 - 任务正在处理中
- 1: 成功 - 任务完成成功
- 2: 创建任务失败 - 任务创建失败
- 3: 生成失败 - 任务创建成功但生成失败
使用指南
- 使用此接口检查生成任务的当前状态
- 通过
successFlag字段监控任务进度 - 当任务成功完成时获取生成的图像 URL
- 使用
errorCode和errorMessage字段处理错误情况
开发者注意事项
- 任务 ID 从生成或编辑图像接口的响应中获得
- 当
successFlag为 1(成功)时,生成的图像 URL 可用 - BFL 的原始图像 URL(
originImageUrl)仅在 10 分钟内有效 - 我们服务器上的结果图像 URL(
resultImageUrl)有更长的可用时间
授权
所有 API 都需要通过 Bearer Token 进行身份验证。
获取 API Key:
- 访问 API Key 管理页面 获取您的 API Key
使用方法: 在请求头中添加: Authorization: Bearer YOUR_API_KEY
注意:
- 请保护您的 API Key 安全,不要与他人分享
- 如果您怀疑 API Key 已泄露,请立即在管理页面重置
查询参数
任务 ID(必填)
⌘I