Index an image
Pass an image URL as content. Etoile analyzes it and makes it searchable.
Supported formats: PNG, JPEG, WEBP, GIF (max 5MB).
import { Etoile } from "@etoile-dev/client";
const etoile = new Etoile({
apiKey: process.env.ETOILE_API_KEY,
});
await etoile.index({
id: "starry-night",
collection: "paintings",
title: "The Starry Night",
content: "https://art.org/starry-night.jpg",
});const response = await fetch("https://etoile.dev/api/v1/index", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.ETOILE_SECRET_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
id: "starry-night",
collection: "paintings",
title: "The Starry Night",
content: "https://art.org/starry-night.jpg",
}),
});curl -X POST "https://etoile.dev/api/v1/index" \
-H "Authorization: Bearer $ETOILE_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"id": "starry-night",
"collection": "paintings",
"title": "The Starry Night",
"content": "https://art.org/starry-night.jpg"
}'Related
- Index document (POST) — content types
- Index text — index plain text
- Index a website — index a URL