API reference
Meta
The API itself, its status and this document.
For your agent
https://imgsearch.com/llms.txt
GET
/
What this API is and where its documents are #
index- No key needed
Responses
- 200 The API's index. (Api)
- Error Error envelope (error codes)
Examples
curl
# What this API is and where its documents are.
curl -sS \
"${IMGSEARCH_API_BASE:-https://imgsearch.com/api/v2}"
Python
# What this API is and where its documents are.
import json
import os
import httpx
base = os.environ.get("IMGSEARCH_API_BASE", "https://imgsearch.com/api/v2")
r = httpx.get(f"{base}", timeout=60)
print(r.status_code)
print(json.dumps(r.json(), indent=2))
JavaScript
// What this API is and where its documents are.
const base = process.env.IMGSEARCH_API_BASE ?? "https://imgsearch.com/api/v2";
const r = await fetch(`${base}`);
console.log(r.status);
console.log(JSON.stringify(await r.json(), null, 2));
Response 200
{
"object": "api",
"name": "ImgSearch API",
"version": "2.0.0",
"docs_url": null,
"openapi_url": "https://imgsearch.com/api/v2/openapi.json",
"status_url": "https://imgsearch.com/api/v2/status",
"authentication": "API key (Account → API keys) or OAuth 2.1 with PKCE, as Authorization: Bearer"
}
Try it
The try-it panel needs JavaScript.
GET
/status
Whether the AI Generator takes work now, and which models are paused #
status- No key needed
Responses
- 200 The current status. Cached for 15 seconds. (Status)
- Error Error envelope (error codes)
Examples
curl
# Whether the AI Generator takes work now, and which models are paused.
curl -sS \
"${IMGSEARCH_API_BASE:-https://imgsearch.com/api/v2}/status"
Python
# Whether the AI Generator takes work now, and which models are paused.
import json
import os
import httpx
base = os.environ.get("IMGSEARCH_API_BASE", "https://imgsearch.com/api/v2")
r = httpx.get(f"{base}/status", timeout=60)
print(r.status_code)
print(json.dumps(r.json(), indent=2))
JavaScript
// Whether the AI Generator takes work now, and which models are paused.
const base = process.env.IMGSEARCH_API_BASE ?? "https://imgsearch.com/api/v2";
const r = await fetch(`${base}/status`);
console.log(r.status);
console.log(JSON.stringify(await r.json(), null, 2));
Response 200
{
"object": "status",
"api": {
"version": "2.0.0"
},
"generator": {
"enabled": true,
"workers": true
},
"models_paused": []
}
Try it
The try-it panel needs JavaScript.
GET
/openapi.json
This document as JSON #
openapi.json- No key needed
Responses
- 200 The OpenAPI document.
- Error Error envelope (error codes)
Examples
curl
# Saves the OpenAPI document as openapi.json.
curl -sS -o openapi.json \
"${IMGSEARCH_API_BASE:-https://imgsearch.com/api/v2}/openapi.json"
Python
# Saves the OpenAPI document as openapi.json.
import os
import httpx
base = os.environ.get("IMGSEARCH_API_BASE", "https://imgsearch.com/api/v2")
r = httpx.get(f"{base}/openapi.json", timeout=60)
if r.status_code == 200:
open("openapi.json", "wb").write(r.content)
print(r.status_code, len(r.content), "bytes")
JavaScript
// Saves the OpenAPI document as openapi.json.
import { writeFile } from "node:fs/promises";
const base = process.env.IMGSEARCH_API_BASE ?? "https://imgsearch.com/api/v2";
const r = await fetch(`${base}/openapi.json`);
const bytes = Buffer.from(await r.arrayBuffer());
if (r.status === 200) await writeFile("openapi.json", bytes);
console.log(r.status, bytes.length, "bytes");
Try it
The try-it panel needs JavaScript.
GET
/openapi.yaml
This document as YAML #
openapi.yaml- No key needed
Responses
- 200 The OpenAPI document, byte for byte as published.
- Error Error envelope (error codes)
Examples
curl
# Saves the OpenAPI document as openapi.yaml.
curl -sS -o openapi.yaml \
"${IMGSEARCH_API_BASE:-https://imgsearch.com/api/v2}/openapi.yaml"
Python
# Saves the OpenAPI document as openapi.yaml.
import os
import httpx
base = os.environ.get("IMGSEARCH_API_BASE", "https://imgsearch.com/api/v2")
r = httpx.get(f"{base}/openapi.yaml", timeout=60)
if r.status_code == 200:
open("openapi.yaml", "wb").write(r.content)
print(r.status_code, len(r.content), "bytes")
JavaScript
// Saves the OpenAPI document as openapi.yaml.
import { writeFile } from "node:fs/promises";
const base = process.env.IMGSEARCH_API_BASE ?? "https://imgsearch.com/api/v2";
const r = await fetch(`${base}/openapi.yaml`);
const bytes = Buffer.from(await r.arrayBuffer());
if (r.status === 200) await writeFile("openapi.yaml", bytes);
console.log(r.status, bytes.length, "bytes");
Try it
The try-it panel needs JavaScript.