Skip to content

SDKs & Multi-Language Code Examples

The .fotobots.dev addresses on this page are staging examples. Use the URL and API key for your own environment.

Fotobots provides RESTful OpenAPI 3.1 endpoints. You can integrate directly using standard HTTP clients in any programming language.


1. Node.js / TypeScript

Photo Ingestion Example

import axios from 'axios';
import fs from 'fs';
const API_BASE = 'https://api.fotobots.dev/openapi';
const API_KEY = 'fb_test_YOUR_KEY';
const ALBUM_ID = 'YOUR_ALBUM_UUID';
async function uploadPhoto(filePath: string) {
// 1. Request presigned upload URL
const { data: signData } = await axios.post(
`${API_BASE}/photos/photo/signed`,
{
albumId: ALBUM_ID,
filename: 'runner_001.jpg',
contentType: 'image/jpeg',
},
{ headers: { 'x-api-key': API_KEY } }
);
// 2. Upload image binary directly to storage
const fileBuffer = fs.readFileSync(filePath);
await axios.put(signData.uploadUrl, fileBuffer, {
headers: { 'Content-Type': 'image/jpeg' },
});
// 3. Confirm upload to trigger AI processing
const { data: successData } = await axios.post(
`${API_BASE}/photos/photo/success`,
{
albumId: ALBUM_ID,
photoId: signData.photoId,
},
{ headers: { 'x-api-key': API_KEY } }
);
console.log('Photo queued for AI indexing:', successData);
}

2. Python 3

Face Search Integration

import requests
API_BASE = "https://api.fotobots.dev/openapi"
API_KEY = "fb_test_YOUR_KEY"
ALBUM_ID = "YOUR_ALBUM_UUID"
def search_face(probe_image_path: str):
# 1. Request presigned upload for search probe
sign_res = requests.post(
f"{API_BASE}/photos/search/face/signed",
headers={"x-api-key": API_KEY},
json={"albumId": ALBUM_ID, "filename": "probe.jpg"}
).json()
# 2. Upload probe image
with open(probe_image_path, "rb") as f:
requests.put(sign_res["uploadUrl"], data=f)
# 3. Query face vector matching
results = requests.post(
f"{API_BASE}/photos/search/face/list",
headers={"x-api-key": API_KEY},
json={
"albumId": ALBUM_ID,
"searchPhotoId": sign_res["searchPhotoId"],
"threshold": 0.80
}
).json()
print(f"Found {len(results.get('photos', []))} matching photos!")
return results

3. Go (Golang)

package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
url := "https://api.fotobots.dev/openapi/photos/search/text/list"
payload, _ := json.Marshal(map[string]string{
"albumId": "YOUR_ALBUM_UUID",
"text": "10492",
})
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(payload))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("x-api-key", "fb_test_YOUR_KEY")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println("Search status:", resp.Status)
}