Go SDK
truto-go-sdk is a Go client for the Truto API. It covers the Unified, Proxy, and Custom APIs, MCP, and most of the Admin API in the Truto API Reference. It doesn't wrap webhook event history, configuration version history, notification destinations, SSO connections, SCIM, or group mappings yet; call those with client.Do. Admin API responses and most request bodies are typed structs generated from Truto's OpenAPI spec (see Typed models); a few admin methods, such as Workflows.Update and Environments.Update, take a truto.Record.
Package: pkg.go.dev/github.com/trutohq/truto-go-sdk. Source: github.com/trutohq/truto-go-sdk.
Requirements
Go 1.23+. The SDK uses only the standard library.
Installation
go get github.com/trutohq/truto-go-sdk@latestimport truto "github.com/trutohq/truto-go-sdk"Quick start
Create an API token, then:
package main
import (
"context"
"fmt"
"log"
"os"
truto "github.com/trutohq/truto-go-sdk"
)
func main() {
ctx := context.Background()
client := truto.NewClient(os.Getenv("TRUTO_API_TOKEN"))
// Installed integrations in the environment
for integration, err := range client.EnvironmentIntegrations.List(ctx).Seq() {
if err != nil {
log.Fatal(err)
}
fmt.Println(*integration.ID)
}
// Integrated accounts for a tenant
accounts, err := client.IntegratedAccounts.List(ctx,
truto.WithQuery(truto.Params{"tenant_id": "acme-1"})).All()
if err != nil {
log.Fatal(err)
}
if len(accounts) == 0 {
log.Fatal("no integrated accounts for acme-1")
}
// A Unified API call
contacts := client.Unified.List(ctx, truto.UnifiedResource{
Model: "crm",
Resource: "contacts",
IntegratedAccountID: *accounts[0].ID,
})
for contact, err := range contacts.Seq() {
if err != nil {
log.Fatal(err)
}
fmt.Println(contact["id"], contact["first_name"])
}
}How the client works
- Context first, options last. Every method takes a
context.Contextas its first argument and acceptstruto.Options at the end. Options passed toNewClientapply to every call; options passed to a method apply to that call only. - Resources. Each Admin API resource is a field on
*truto.Client, such asclient.Tenantsorclient.SyncJobs. Most exposeList,Get,Create,Update, andDelete. - Typed models. Admin API methods take and return generated structs, such as
truto.TenantCreateRequestandtruto.IntegratedAccountResponse. Optional fields are pointers; set them withtruto.Ptr(see Typed models). - Records. Unified, Proxy, and MCP results depend on the integration, so they come back as
truto.Record(map[string]any). Decode one into your own type withtruto.Decode(see Decode into your own types). - Query parameters go in
truto.WithQuery(truto.Params{...}). Nested maps and slices are encoded the way the API expects (filter[status]=open,ids[0]=a). Admin list filters on related fields use a dotted key, such as"integration.name": "hubspot". - Errors. A non-2xx response returns a
*truto.Errorcarrying the status, the parsed body, and the response headers (see Errors). - Base URL. It defaults to
https://api.truto.one. Passtruto.WithBaseURL(url)toNewClientto use a different one.
| Option | What it does |
|---|---|
WithQuery(truto.Params{...}) |
Query parameters for the call |
WithTimeout(d) |
Time limit per attempt (default 30s; 0 turns it off) |
WithMaxRetries(n) / WithNoRetry() |
Number of retries (default 3), or none |
WithRetryStatusCodes(codes...) |
Extra status codes to retry, added to the defaults |
WithDefaultRetryAfter(d) |
Wait before retrying a 429 without Retry-After (default 10s) |
WithOnRetry(fn) / WithOnRateLimited(fn) |
Hooks called before a retry or a rate-limit wait |
WithHeader(k, v) |
Extra request header |
WithBaseURL(url), WithHTTPClient(c) |
Client setup |
client := truto.NewClient(os.Getenv("TRUTO_API_TOKEN"),
truto.WithTimeout(20*time.Second),
truto.WithMaxRetries(5),
)To log requests or route them through a proxy, pass your own *http.Client with WithHTTPClient, for example one whose Transport logs each request.
Errors
_, err := client.IntegratedAccounts.Get(ctx, "missing-id")
var apiErr *truto.Error
switch {
case truto.IsNotFound(err): // also truto.IsUnauthorized, truto.IsRateLimited
fmt.Println("not found")
case errors.Is(err, truto.ErrTimeout):
fmt.Println("timed out")
case errors.As(err, &apiErr):
fmt.Println(apiErr.StatusCode, apiErr.Message(), apiErr.Body)
}*truto.Error has StatusCode, Status, Body (the parsed JSON body, or a string when the body isn't JSON), RawBody, Header, and the request's Method and Path. Message() returns the message (or error) field of the JSON body, so Truto's error text is available without parsing it yourself. DecodeBody(&v) decodes the body into your own struct.
A 401 is not always your API token. With truto_is_remote_error: true in the body, the provider refused the integrated account's credentials; with truto_error_code: integrated_account_needs_reauth, the account is stale. Both need the account reconnected, not a new token. See Errors.
if truto.IsUnauthorized(err) && errors.As(err, &apiErr) {
var body struct {
TrutoIsRemoteError bool `json:"truto_is_remote_error"`
TrutoErrorCode string `json:"truto_error_code"`
}
if apiErr.DecodeBody(&body) == nil && body.TrutoIsRemoteError {
// The integrated account needs reconnecting.
// body.TrutoErrorCode is "integrated_account_needs_reauth" when it is stale.
}
}Retries and timeouts
The Go SDK retries failed requests for you. Keep the rate limits in mind: per API token, 100 requests per second and 500 per 10 seconds; per integrated account, 50 requests per 10 seconds.
- Retried statuses.
408,409,425,429,502,503, and504, plus any added withWithRetryStatusCodes. Network errors are retried too.409is retried by default, unlike the retry strategy advice. Usetruto.WithNoRetry()where a conflict is expected, such asTenants.Createwith an ID that may exist. - Waits. A
429waits for theRetry-Afterheader, or 10 seconds when it is missing. Other retryable statuses back off with full jitter: a random wait up to 500 ms, with the ceiling doubling each time, capped at 10 seconds. - Retries. Up to 3 by default.
WithMaxRetries(n)changes it;WithNoRetry()sends the request once. - Timeout. 30 seconds per attempt by default;
WithTimeout(0)turns it off. A timed-out attempt returnstruto.ErrTimeoutand is not retried. Cancelling the context stops any further attempt.
account, err := client.IntegratedAccounts.Get(ctx, "ia-id",
truto.WithTimeout(5*time.Second),
truto.WithMaxRetries(5),
truto.WithOnRetry(func(r truto.RetryInfo) {
log.Printf("retry %d after status %d, waiting %s", r.RetryCount, r.StatusCode, r.Wait)
}),
truto.WithOnRateLimited(func(r truto.RateLimitInfo) {
log.Printf("rate limited, waiting %s", r.RetryAfter)
}),
)The request body is sent again on every attempt, and a 502 or 504 can arrive after the provider has already applied a write. Send an Idempotency-Key header on Unified and Proxy writes (create, update, and custom methods). For 24 hours, a retry with the same key, path, and integrated account that is sent after the first response gets that stored response, even a 502, instead of calling the provider again. Use a new key after you fix a 4xx. Delete calls and the Custom API don't support it; pass truto.WithNoRetry() there.
contacts := truto.UnifiedResource{Model: "crm", Resource: "contacts", IntegratedAccountID: "766cc1ee-..."}
_, err := client.Unified.Create(ctx, contacts, map[string]any{"first_name": "Ada"},
truto.WithHeader("Idempotency-Key", "contact-ada-0001"), // one key per write
)Pagination
List methods return a lazy *truto.Iterator[T] that follows next_cursor for you. No request is sent until you read from it.
Range over it with Seq():
runs := client.SyncJobRuns.List(ctx, truto.WithQuery(truto.Params{"sync_job_id": "sync-job-id"}))
for run, err := range runs.Seq() {
if err != nil {
log.Fatal(err)
}
fmt.Println(*run.ID, *run.Status)
}Collect every page with All(), or take the first item with First():
tenants, err := client.Tenants.List(ctx).All()
first, err := client.Tenants.List(ctx).First() // truto.Done if there are noneOr fetch one page at a time:
it := client.Tenants.List(ctx, truto.WithQuery(truto.Params{"limit": 50}))
for {
page, err := it.NextPage() // page.Items, page.NextCursor
if errors.Is(err, truto.Done) {
break
}
if err != nil {
log.Fatal(err)
}
fmt.Println(len(page.Items))
}Or one item at a time:
it := client.Tenants.List(ctx)
for {
tenant, err := it.Next()
if errors.Is(err, truto.Done) {
break
}
if err != nil {
log.Fatal(err)
}
fmt.Println(*tenant.ID)
}Use either Next or NextPage on one iterator, not both.
Files
Unified and Proxy calls, and client.Do, only read JSON responses; a file response returns an error. For a file, use client.Custom against the provider's path, which returns the bytes, or call the API with net/http.
The SDK sends JSON bodies only; multipart uploads need a direct HTTP call.
Unified API
Accessible via client.Unified. Each call takes a truto.UnifiedResource naming the model, the resource, and the integrated account. Each unified model has its own API reference, for example CRM. Query parameters every Unified call accepts: Querying.
contacts := truto.UnifiedResource{Model: "crm", Resource: "contacts", IntegratedAccountID: "766cc1ee-..."}
it := client.Unified.List(ctx, contacts, truto.WithQuery(truto.Params{"limit": 50}))
contact, err := client.Unified.Get(ctx, contacts, "123")
created, err := client.Unified.Create(ctx, contacts, map[string]any{"first_name": "Ada"})
_, err = client.Unified.Update(ctx, contacts, "123", map[string]any{"first_name": "Grace"})
_, err = client.Unified.Delete(ctx, contacts, "123")
// Custom methods: POST /unified/{model}/{resource}/{method}
results, err := client.Unified.CustomMethod(ctx, contacts, "search", map[string]any{"query": "acme"})| Method | Endpoint |
|---|---|
List(ctx, r, opts...) |
GET /unified/{model}/{resource} |
Get(ctx, r, id, opts...) |
GET /unified/{model}/{resource}/{id} |
Create(ctx, r, body, opts...) |
POST /unified/{model}/{resource} |
Update(ctx, r, id, body, opts...) |
PATCH /unified/{model}/{resource}/{id} |
Delete(ctx, r, id, opts...) |
DELETE /unified/{model}/{resource}/{id} |
CustomMethod(ctx, r, method, body, opts...) |
POST /unified/{model}/{resource}/{method} |
Meta(ctx, model, resource, integrationName, method, opts...) |
GET /unified/{model}/{resource}/{integration_name}/meta/{method} |
ModelMeta(ctx, model, integrationName, opts...) |
GET /unified/meta/{model}/{integration_name} |
Meta returns an integration's mapping metadata (schema and supported parameters) for one unified method. ModelMeta returns the resources and methods of a unified model that an integration supports.
meta, err := client.Unified.Meta(ctx, "crm", "contacts", "hubspot", "list")
crmOnHubSpot, err := client.Unified.ModelMeta(ctx, "crm", "hubspot")Decode into your own types
truto.Decode converts a truto.Record into your own struct, and truto.DecodeAll converts a slice of them:
type Contact struct {
ID string `json:"id"`
FirstName string `json:"first_name"`
}
record, err := client.Unified.Get(ctx, contacts, "123")
c, err := truto.Decode[Contact](*record)
records, err := client.Unified.List(ctx, contacts).All()
all, err := truto.DecodeAll[Contact](records)Proxy API
Accessible via client.Proxy. Calls go to the integration's own API through Truto, with resource names as defined on the integration. Each call takes a truto.ProxyResource.
tickets := truto.ProxyResource{Resource: "tickets", IntegratedAccountID: "766cc1ee-..."}
it := client.Proxy.List(ctx, tickets)
ticket, err := client.Proxy.Get(ctx, tickets, "123")
_, err = client.Proxy.Create(ctx, tickets, map[string]any{"subject": "Help"})
_, err = client.Proxy.Update(ctx, tickets, "123", map[string]any{"status": "closed"})
_, err = client.Proxy.Delete(ctx, tickets, "123")
_, err = client.Proxy.CustomMethod(ctx, tickets, "merge", map[string]any{"ids": []string{"1", "2"}})| Method | Endpoint |
|---|---|
List(ctx, r, opts...) |
GET /proxy/{resource} |
Get(ctx, r, id, opts...) |
GET /proxy/{resource}/{id} |
Create(ctx, r, body, opts...) |
POST /proxy/{resource} |
Update(ctx, r, id, body, opts...) |
PATCH /proxy/{resource}/{id} |
Delete(ctx, r, id, opts...) |
DELETE /proxy/{resource}/{id} |
CustomMethod(ctx, r, method, body, opts...) |
POST /proxy/{resource}/{method} |
Custom API
Accessible via client.Custom. Sends a request to any path of the integration's API, with the integrated account's credentials, at /custom/{path}. The provider can answer with anything, so these calls return a *truto.RawResponse with StatusCode, ContentType, and Body ([]byte).
res, err := client.Custom.Get(ctx, "766cc1ee-...", "my/custom/path")
fmt.Println(res.ContentType, string(res.Body))
_, err = client.Custom.Post(ctx, "766cc1ee-...", "my/custom/path", map[string]any{"key": "value"})| Method | Endpoint |
|---|---|
Get(ctx, integratedAccountID, path, opts...) |
GET /custom/{path} |
Post(ctx, integratedAccountID, path, body, opts...) |
POST /custom/{path} |
Put(ctx, integratedAccountID, path, body, opts...) |
PUT /custom/{path} |
Patch(ctx, integratedAccountID, path, body, opts...) |
PATCH /custom/{path} |
Delete(ctx, integratedAccountID, path, opts...) |
DELETE /custom/{path} |
MCP
Accessible via client.MCP. Talks to an integrated account's MCP server, using the token from Create MCP server. See MCP servers.
mcpToken := "your-mcp-token"
_, err := client.MCP.Initialize(ctx, mcpToken, "my-client", "1.0.0")
tools, err := client.MCP.ListTools(ctx, mcpToken)
// a name returned by ListTools
result, err := client.MCP.CallTool(ctx, mcpToken, "list_all_zendesk_tickets", map[string]any{"status": "open"})
// Any other JSON-RPC message
_, err = client.MCP.Call(ctx, mcpToken, map[string]any{"jsonrpc": "2.0", "method": "tools/list", "id": 3})| Method | Description |
|---|---|
Initialize(ctx, token, clientName, clientVersion, opts...) |
Sends initialize |
ListTools(ctx, token, opts...) |
Sends tools/list |
CallTool(ctx, token, name, args, opts...) |
Sends tools/call |
Call(ctx, token, payload, opts...) |
Sends a raw JSON-RPC payload to POST /mcp/{token} |
Integrated accounts
Accessible via client.IntegratedAccounts. API reference.
it := client.IntegratedAccounts.List(ctx, truto.WithQuery(truto.Params{"tenant_id": "acme-1"}))
account, err := client.IntegratedAccounts.Get(ctx, "ia-id")
_, err = client.IntegratedAccounts.Validate(ctx, "ia-id")
_, err = client.IntegratedAccounts.BulkDelete(ctx, truto.Record{"tenant_id": "acme-1"})
capabilities, err := client.IntegratedAccounts.Capabilities(ctx, "ia-id")| Method | Endpoint |
|---|---|
List(ctx, opts...) |
GET /integrated-account |
Get(ctx, id, opts...) |
GET /integrated-account/{id} |
Create(ctx, body, opts...) |
POST /integrated-account (import an account with existing credentials) |
Update(ctx, id, body, opts...) |
PATCH /integrated-account/{id} |
Delete(ctx, id, opts...) |
DELETE /integrated-account/{id} |
UpdateCredentials(ctx, id, body, opts...) |
PATCH /integrated-account/{id}/credentials |
BulkDelete(ctx, body, opts...) |
POST /integrated-account/bulk-delete (by ids or tenant_id) |
CreateToken(ctx, id, opts...) |
POST /integrated-account/token |
RefreshCredentials(ctx, id, opts...) |
POST /integrated-account/refresh-credentials |
RefreshMappingCache(ctx, body, opts...) |
POST /integrated-account/refresh-mapping-cache |
CreateFormToken(ctx, id, opts...) |
POST /integrated-account/form-token (tenant session tokens only; an API token gets 403) |
RunPostInstallActions(ctx, id, opts...) |
POST /integrated-account/run-post-install-actions |
Validate(ctx, id, opts...) |
POST /integrated-account/{id}/validate |
Capabilities(ctx, id, opts...) |
GET /integrated-account/{id}/capabilities |
Tools(ctx, id, filter, opts...) |
GET /integrated-account/{id}/tools (for AI tool calling; use Capabilities to list what an account supports) |
Tools takes a truto.ToolsFilter{Methods: []string{"list", "get"}, Tags: []string{...}}; pass an empty truto.ToolsFilter{} for every tool.
MCP servers
Each integrated account can have MCP servers. API reference.
server, err := client.IntegratedAccounts.CreateMCPServer(ctx, "ia-id", truto.IntegratedAccountMcpCreateRequest{
Name: "Support agent",
Config: truto.IntegratedAccountMcpCreateRequestConfig{Methods: []string{"list", "get"}},
})
servers, err := client.IntegratedAccounts.ListMCPServers(ctx, "ia-id").All()| Method | Endpoint |
|---|---|
ListMCPServers(ctx, iaID, opts...) (an iterator) |
GET /integrated-account/{ia_id}/mcp |
CreateMCPServer(ctx, iaID, body, opts...) |
POST /integrated-account/{ia_id}/mcp |
GetMCPServer(ctx, iaID, id, opts...) |
GET /integrated-account/{ia_id}/mcp/{id} |
UpdateMCPServer(ctx, iaID, id, body, opts...) |
PATCH /integrated-account/{ia_id}/mcp/{id} |
DeleteMCPServer(ctx, iaID, id, opts...) |
DELETE /integrated-account/{ia_id}/mcp/{id} |
Link tokens
Accessible via client.LinkTokens. API reference.
token, err := client.LinkTokens.Create(ctx, truto.LinkTokenRequest{TenantID: truto.Ptr("acme-1")})
fmt.Println(*token.LinkToken)| Method | Endpoint |
|---|---|
Create(ctx, body, opts...) |
POST /link-token |
Session tokens
Short-lived tokens scoped to one tenant, used by the connections widget. Accessible via client.SessionTokens. API reference.
session, err := client.SessionTokens.Create(ctx, truto.SessionTokenRequest{TenantID: "acme-1"})| Method | Endpoint |
|---|---|
Create(ctx, body, opts...) |
POST /session-token |
Revoke(ctx, body, opts...) |
DELETE /session-token |
Renew(ctx, opts...) |
POST /session-token/renew (call it from a client built with the session token: truto.NewClient(sessionToken)) |
Me(ctx, opts...) |
GET /session-token/me (works with any token; describes the one the client uses) |
Tenants
Accessible via client.Tenants. API reference.
_, err := client.Tenants.Create(ctx, truto.TenantCreateRequest{ID: "acme-1", Name: truto.Ptr("Acme")})
_, err = client.Tenants.Update(ctx, "acme-1", truto.TenantUpdateRequest{Name: truto.Ptr("Acme Inc")})| Method | Endpoint |
|---|---|
List, Get, Create, Update, Delete |
/tenant, /tenant/{id} |
BulkCreate(ctx, body, opts...) |
POST /tenant/bulk |
Integrations
Accessible via client.Integrations. API reference.
integration, err := client.Integrations.Get(ctx, "integration-id")
capabilities, err := client.Integrations.Capabilities(ctx, "hubspot") // ID or name
_, err = client.Integrations.Install(ctx, "integration-id", true)
_, err = client.Integrations.Uninstall(ctx, "integration-id")| Method | Endpoint |
|---|---|
List, Get, Create, Update, Delete |
/integration, /integration/{id} |
Capabilities(ctx, idOrName, opts...) |
GET /integration/{id}/capabilities |
Tools(ctx, idOrName, opts...) |
GET /integration/{id}/tools (deprecated; use Capabilities) |
UnifiedAPIs(ctx, idOrName, opts...) |
GET /integration/{id}/unified-apis (deprecated; use Capabilities) |
Install(ctx, integrationID, isEnabled, opts...) |
POST /environment-integration |
Uninstall(ctx, integrationID, opts...) |
Finds the integration's environment integration and deletes it |
Environment integrations
Integrations installed in your environment. Accessible via client.EnvironmentIntegrations. API reference.
| Method | Endpoint |
|---|---|
List(ctx, opts...) |
GET /environment-integration |
Get(ctx, id, opts...) |
GET /environment-integration/{id} |
Create(ctx, body, opts...) |
POST /environment-integration |
Update(ctx, id, body, opts...) |
PATCH /environment-integration/{id} |
Delete(ctx, id, opts...) |
DELETE /environment-integration/{id} |
Unified models
Accessible via client.UnifiedModels. API reference.
| Method | Endpoint |
|---|---|
List, Get, Create, Update, Delete |
/unified-model, /unified-model/{id} |
Install(ctx, unifiedModelID, opts...) |
POST /environment-unified-model |
Uninstall(ctx, unifiedModelID, opts...) |
Finds the model's environment unified model and deletes it |
Environment unified models
Unified models installed in your environment. Accessible via client.EnvironmentUnifiedModels. API reference.
| Method | Endpoint |
|---|---|
List, Get, Create, Update, Delete |
/environment-unified-model, /environment-unified-model/{id} |
Unified model mappings
How a unified model's resource methods map to an integration. Both resources expose List, Get, Create, Update, and Delete.
| Field | Endpoint | Reference |
|---|---|---|
client.UnifiedModelResourceMethods |
/unified-model-resource-method |
Unified model mappings |
client.EnvironmentUnifiedModelResourceMethods |
/environment-unified-model-resource-method |
Environment unified model mappings |
overrides := client.EnvironmentUnifiedModelResourceMethods.List(ctx,
truto.WithQuery(truto.Params{"environment_unified_model_id": "..."}))
for override, err := range overrides.Seq() {
if err != nil {
log.Fatal(err)
}
fmt.Println(*override.ID)
}Sync jobs
Each resource below exposes List, Get, Create, Update, and Delete.
| Field | Endpoint | Extra methods | Reference |
|---|---|---|---|
client.SyncJobs |
/sync-job |
Sync jobs | |
client.SyncJobRuns |
/sync-job-run |
Sync job runs | |
client.SyncJobCronTriggers |
/sync-job-cron-trigger |
Schedule(ctx, id): POST /sync-job-cron-trigger/{id}/schedule |
Sync job cron triggers |
client.SyncJobTemplates |
/sync-job-template |
Sync job templates | |
client.SyncJobRunStates |
/sync-job-run-state |
Sync job run state |
run, err := client.SyncJobRuns.Create(ctx, truto.SyncJobRunCreateRequest{
SyncJobID: "sync-job-id",
IntegratedAccountID: "766cc1ee-...",
WebhookID: truto.Ptr("webhook-id"), // V1–V3 jobs need a destination; V4 jobs don't
})
_, err = client.SyncJobRuns.Delete(ctx, *run.ID) // stops the runA run of a V1–V3 sync job needs one of webhook_id, daemon_group_key, or super_query.
Webhooks
Accessible via client.Webhooks. API reference.
webhook, err := client.Webhooks.Create(ctx, truto.WebhookCreateRequest{TargetURL: "https://example.com/truto"})
_, err = client.Webhooks.Test(ctx, truto.WebhookTestRequest{ID: *webhook.ID})| Method | Endpoint |
|---|---|
List, Get, Create, Update, Delete |
/webhook, /webhook/{id} |
Test(ctx, body, opts...) |
POST /webhook/test |
Workflows
Accessible via client.Workflows and client.WorkflowRuns. API reference: Workflows, Workflow runs.
runs := client.WorkflowRuns.List(ctx, truto.WithQuery(truto.Params{"workflow_id": "workflow-id"}))
for run, err := range runs.Seq() {
if err != nil {
log.Fatal(err)
}
fmt.Println(run.Status)
}| Field | Methods | Endpoint |
|---|---|---|
client.Workflows |
List, Get, Create, Update, Delete |
/workflow, /workflow/{id} |
client.WorkflowRuns |
List, Get, Delete |
/workflow-run, /workflow-run/{id} |
Datastores
Accessible via client.Datastores. API reference.
| Method | Endpoint |
|---|---|
List, Get, Create, Update, Delete |
/datastore, /datastore/{id} |
Test(ctx, id, method, body, opts...) |
POST /datastore/{id}/test/{method} |
Static gates
Accessible via client.StaticGates. API reference.
| Method | Endpoint |
|---|---|
List, Get, Create, Update, Delete |
/static-gate, /static-gate/{id} |
Observability destinations
Accessible via client.ObservabilityDestinations. API reference.
_, err := client.ObservabilityDestinations.Test(ctx, "observability-destination-id",
truto.ObservabilityDestinationTestRequest{})| Method | Endpoint |
|---|---|
List, Get, Create, Update, Delete |
/observability-destination, /observability-destination/{id} |
Test(ctx, id, body, opts...) |
POST /observability-destination/{id}/test |
Documentation
Accessible via client.Documentation. API reference.
| Method | Endpoint |
|---|---|
List, Get, Create, Update, Delete |
/documentation, /documentation/{id} |
Batch requests
Accessible via client.BatchRequests. API reference.
| Method | Endpoint |
|---|---|
Create(ctx, body, opts...) |
POST /batch-request |
Analytics
Accessible via client.Analytics. API reference. Pass query parameters with truto.WithQuery.
dashboard, err := client.Analytics.Dashboard(ctx, truto.WithQuery(truto.Params{"range": "7d"}))
series, err := client.Analytics.Timeseries(ctx, truto.WithQuery(truto.Params{
"environment_id": "environment-id",
"metric": "api_calls",
"from": time.Now().UTC().AddDate(0, 0, -7).Format("2006-01-02"),
"to": time.Now().UTC().Format("2006-01-02"),
}))from and to are YYYY-MM-DD dates within the last 90 days.
| Method | Endpoint |
|---|---|
Status(ctx, opts...) |
GET /analytics/status |
Metrics(ctx, opts...) |
GET /analytics/metrics |
Dashboard(ctx, opts...) |
GET /analytics/dashboard |
Timeseries(ctx, opts...) |
GET /analytics/timeseries |
Breakdown(ctx, opts...) |
GET /analytics/breakdown |
Environments, API tokens, categories, and logs
| Field | Methods | Endpoint | Reference |
|---|---|---|---|
client.Environments |
List, Get, Update |
/environment |
Environments |
client.APITokens |
List, Get |
/api-token |
API tokens |
client.Categories |
List |
/category |
Categories |
client.Logs |
List |
/log |
Logs |
client.Logs.List needs a log_type query parameter: unified_proxy_api, rapid_bridge, webhook, mcp, or sync_job_cron_trigger.
logs := client.Logs.List(ctx, truto.WithQuery(truto.Params{"log_type": "unified_proxy_api"}))client.Ping(ctx) calls GET /ping to check that your token works.
Daemons
Truto does not publish a daemon client. Contact Truto support before you run sync job runs or daemon jobs on your own workers — see the daemon guide. These use truto.Record instead of typed models.
| Field | Methods | Endpoint | Reference |
|---|---|---|---|
client.Daemons |
List, Get, Create, Update, Delete |
/daemon, /daemon/{id} |
Daemons |
client.DaemonJobs |
List, Get, Create, Update, Delete |
/daemon-job, /daemon-job/{id} |
Daemon jobs |
client.DaemonJobRuns |
List, Get, Create, Update, Delete |
/daemon-job-run, /daemon-job-run/{id} |
Daemon job runs |
client.DaemonJobCronTriggers |
List, Get, Create, Update, Delete, Schedule |
/daemon-job-cron-trigger, /daemon-job-cron-trigger/{id} |
Daemon job cron triggers |
Other resources
These resources are in the SDK but not in the public API reference. They use truto.Record instead of typed models.
| Field | Methods | Endpoint |
|---|---|---|
client.Users |
List, Get |
/user, /user/{id} |
client.Teams |
List, Get, Update |
/team, /team/{id} |
client.IntegratedAccountWebhooks and client.EnvironmentIntegrationWebhooks post to the URLs vendors call (Receiving vendor webhooks). A payload you forward yourself fails the vendor's signature check for integrations that sign webhooks.
Calling any endpoint
For an endpoint the SDK doesn't wrap yet, client.Do sends a request with the same auth, retries, and error handling, and decodes the JSON response into out:
var out map[string]any
err := client.Do(ctx, "GET", "/some/path", nil, &out, truto.WithQuery(truto.Params{"a": 1}))Typed models
Admin API types such as truto.IntegratedAccountResponse, truto.SyncJobCreateRequest, and truto.WebhookSchema are generated from Truto's OpenAPI spec.
- Optional fields are pointers. Set them with
truto.Ptr:truto.TenantUpdateRequest{Name: truto.Ptr("Acme")}. - Enums are open string types with constants, such as
truto.IntegratedAccountStatus. A value the SDK doesn't know yet still decodes unchanged. - Union types, such as
truto.DatastoreConfig, hold the raw JSON. Decode a specific shape with theAs...methods (cfg.AsDatastoreS3Config()), and build one with thetruto.DatastoreConfigFrom...functions. - Unknown JSON fields are ignored, so new API fields don't break decoding.
The typed models were generated from the API as it was in early November 2026. Fields added since then are not on them: they are dropped when decoding and can't be sent in a typed request. Examples are is_active on sync job cron triggers, stale_since on integrated accounts, super_query on sync job runs, and tool_exposure in an MCP server's config. Use client.Do with a truto.Record for those:
// Pause a sync job cron trigger
var trigger truto.Record
err := client.Do(ctx, "PATCH", "/sync-job-cron-trigger/"+triggerID, truto.Record{"is_active": false}, &trigger)
// Read fields the typed model doesn't have
var account truto.Record
err = client.Do(ctx, "GET", "/integrated-account/"+accountID, nil, &account)
fmt.Println(account["stale_since"])