Client
The SDK client is the entry point for all Tavora API operations. It handles authentication, request building, and response parsing.
Creating a client
Section titled “Creating a client”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.
Authentication
Section titled “Authentication”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 keyclient := tavora.NewClient(baseURL, "tvr_space1_key")
// To work with a different space, create a separate clientclient2 := tavora.NewClient(baseURL, "tvr_space2_key")Error handling
Section titled “Error handling”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)}Base URL
Section titled “Base URL”In development, the server typically runs at http://localhost:8080. In production, use your deployed Tavora instance URL.