Go API Library

The Trinsic API Go library provides convenient access to the Trinsic API from applications written in Go.

Trinsic API Go Library

Go Reference
Build Status

The Trinsic API Go library provides convenient access to the Trinsic API from
applications written in Go.

Documentation

See the Trinsic docs for more detailed information on how to start integrating with our identity acceptance network.

Installation

Install the package with:

go get github.com/trinsic-id/sdk-go-api

Usage

The package needs to be configured with your app's access token, which is
available in the Trinsic Dashboard.

import "github.com/trinsic-id/sdk-go-api"

func main() {
	config := trinsic_api.NewConfiguration()
	config.AddDefaultHeader("Authorization", "Bearer "+"your-access-token")

	api := trinsic_api.NewAPIClient(config)

    attachments := api.AttachmentsAPI;
    network := api.NetworkAPI;
    sessions := api.SessionsAPI;
}

You can find a full Go example in the samples folder.

Construct models using field names:

request := trinsic_api.CreateHostedProviderSessionRequest{
    Provider: "provider-id",
    VerificationProfileId: "profile-id",
    RedirectUrl: "https://example.com/return",
    EnableRedirectBackwardsCompatibility: false,
}

Positional NewModel(field1, field2, ...) factories have been removed, and an
unexported marker prevents unkeyed struct literals outside the SDK package.
NewModelWithDefaults() and named setters remain available when schema defaults
are needed. Keyed literals use Go zero values for omitted fields and do not
enforce required API fields at compile time. Nullable value wrappers and client
constructors retain their existing signatures.

This is a breaking change intended for the next major SDK release.

Data residency

By default, the SDK communicates with https://api.trinsic.id. If you have a Verification Profile configured for EU data residency, point the SDK at the EU endpoint by setting the configuration Servers.

config := trinsic_api.NewConfiguration()
config.Servers = trinsic_api.ServerConfigurations{
	{URL: "https://api.eu.trinsic.id"}, // omit to use the default endpoint
}
config.AddDefaultHeader("Authorization", "Bearer "+"your-access-token")

api := trinsic_api.NewAPIClient(config)
sessions := api.SessionsAPI

Unknown enum values

The API can add enum values after this SDK version was released. A value this
version does not know is read as the enum's UNKNOWN_DEFAULT_OPEN_API member
instead of failing the response:

if session.GetErrorCode() == trinsic_api.SESSIONERRORCODE_UNKNOWN_DEFAULT_OPEN_API {
    // An error code newer than this SDK version.
}

Upgrade the SDK to read the new value. Do not send the fallback member in
requests; the API does not accept it.

SDK Versioning

Our SDKs follow the Semantic Versioning ("SemVer") scheme.

For example, the version number 1.13.0 has a major version of 1, a minor version of 13, and a patch version of 0.

Breaking changes are only introduced alongside a new major version.

Support

Any issues, inquiries, and feature requests can be sent to [email protected], or feel free to open a GitHub issue here.

More Information