Skip to navigation

SDKs & Code Examples

Integrate ETERA with TypeScript, Python, and any HTTP client

Direct API Access

ETERA APIs are standard REST endpoints — use any HTTP client to integrate. All endpoints accept JSON and return JSON responses.

const ETERA_BASE = "https://api.etera.dev";
async function eteraFetch(path: string, options: RequestInit = {}) {
const res = await fetch(`${ETERA_BASE}${path}`, {
...options,
headers: {
Authorization: `Bearer ${process.env.ETERA_TOKEN}`,
"Content-Type": "application/json",
...options.headers,
},
});
if (!res.ok) {
const error = await res.json();
throw new Error(error.error?.message || `HTTP ${res.status}`);
}
return res.json();
}

Common Operations

Search Restaurants
const restaurants = await eteraFetch(
"/restaurant/search/recommendations/"
);
const hotels = await eteraFetch(
"/hotel/search/v2/search?city=dubai&checkIn=2025-03-01&checkOut=2025-03-05"
);
const flights = await eteraFetch(
"/flight/search/search?from=DXB&to=LHR&date=2025-03-01"
);
const booking = await eteraFetch("/restaurant/booking/bookings/", {
method: "POST",
body: JSON.stringify({
restaurantId: "rest_123",
date: "2025-03-01",
time: "19:00",
partySize: 4,
}),
});
// List available tools
const tools = await eteraFetch("/restaurant/mcp/mcp/tools");
// Execute a tool
const result = await eteraFetch(
"/restaurant/mcp/mcp/execute/search_restaurants",
{
method: "POST",
body: JSON.stringify({ query: "Italian in Dubai Marina" }),
}
);
const conversation = await eteraFetch("/ai/input", {
method: "POST",
body: JSON.stringify({
inputType: "text",
text: "Find me a beachfront hotel in Dubai for next weekend",
context: {
location: { type: "pinned", city: "Dubai" },
},
}),
});
// Check status
const status = await eteraFetch(
`/ai/status/${conversation.conversationId}`
);

OpenAPI Specs & Code Generation

All ETERA services expose OpenAPI 3.0.3 specs for automated client generation.

Generate a TypeScript Client

1

Install the generator

npm install -D openapi-typescript
2

Generate types from a spec

npx openapi-typescript https://api-dev.etera.dev/restaurant/search/swagger/json \
-o ./src/types/restaurant-search.ts
3

Use the generated types

import type { paths } from "./types/restaurant-search";
type SearchResponse =
paths["/recommendations/"]["get"]["responses"]["200"]["content"]["application/json"];

Error Handling

try {
const data = await eteraFetch("/restaurant/search/recommendations/");
} catch (error) {
if (error.message.includes("401")) {
// Re-authenticate
} else if (error.message.includes("429")) {
// Rate limited — back off and retry
} else {
console.error("ETERA API error:", error.message);
}
}

Next Steps