Skip to content

Client

The SDK client is the entry point for all Tavora API operations. It handles authentication, request building, and response parsing.

import tavora "github.com/tavora-ai/tavora-sdk-go"
client := tavora.NewClient(
"http://localhost:8080", // Tavora server URL
"tvr_your_api_key", // Space API key
)

The API key determines which space all operations are scoped to. You can find API keys in the Tavora admin console under Space Settings.

All SDK requests are authenticated via the X-API-Key header. The API key is tied to a specific space — all operations through that client are automatically scoped to that space.

// This client operates on the space associated with the API key
client := tavora.NewClient(baseURL, "tvr_space1_key")
// To work with a different space, create a separate client
client2 := tavora.NewClient(baseURL, "tvr_space2_key")

SDK methods return errors that can be inspected for HTTP status details:

doc, err := client.Documents.Get("nonexistent-id")
if err != nil {
// err contains the HTTP status and response body
log.Printf("API error: %v", err)
}

In development, the server typically runs at http://localhost:8080. In production, use your deployed Tavora instance URL.