Skip to main content

Install Speakeasy's SDK

The Speakeasy SDK is the primary mechanism for passing API data to Speakeasy. With the data collected from API requests, Speakeasy is able to power a number of use cases. For more details on what you can use Speakeasy for, see the Use Speakeasy section. SDKs are available for a number of languages and frameworks. They are open-sourced under Apache 2.0.

Full Documentation available on pkg.go.dev

The Speakeasy Go SDK for evaluating API requests/responses. Compatible with any API framework implemented on top of Go's native http library.

Requirements

Supported routers:

  • gorilla/mux
  • go-chi/chi
  • http.DefaultServerMux

We also support custom HTTP frameworks:

  • gin-gonic/gin
  • labstack/echo

Usage

Speakeasy uses Go Modules to manage dependencies.

go get github.com/speakeasy-api/speakeasy-go-sdk

Minimum configuration

  1. Sign up for free on our platform. Create a workspace and generate an API key

  2. Import and configure the Speakeasy SDK as below. Note:

    • APIKey: enter the key you generated above
    • ApiID and VersionID: these are labels that you can specify. Requests from your API will show up in the web application using this ApiID (name) and version label.
    import "github.com/speakeasy-api/speakeasy-go-sdk"

    func main() {
    // Configure the Global SDK
    speakeasy.Configure(speakeasy.Config {
    APIKey: "YOUR API KEY HERE", // retrieve from Speakeasy API dashboard.
    ApiID: "YOUR API ID HERE", // enter a name that you'd like to associate captured requests with.
    // This name will show up in the Speakeasy dashboard. e.g. "PetStore" might be a good ApiID for a Pet Store's API.
    // No spaces allowed.
    VersionID: "YOUR VERSION ID HERE", // enter a version that you would like to associate captured requests with.
    // The combination of ApiID (name) and VersionID will uniquely identify your requests in the Speakeasy Dashboard.
    // e.g. "v1.0.0". You can have multiple versions for the same ApiID (if running multiple versions of your API)
    })

    // Associate the SDK's middleware with your router
    r := mux.NewRouter()
    r.Use(speakeasy.Middleware)
    }
  3. Build and deploy your app.

That's it! Go to your dashboard to view and manage your API Ops.

Visit our docs site to learn more.

Supported Versions

VersionFeature
v1.2.0https://github.com/speakeasy-api/speakeasy-go-sdk/releases/tag/v1.2.0
v1.1.1

https://github.com/speakeasy-api/speakeasy-go-sdk/releases/tag/v1.1.1

https://github.com/speakeasy-api/speakeasy-go-sdk/releases/tag/v1.1.0

v1.0.3
  • Request Capture