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.
When installing the SDK you will need a few values to include in the configuration:
- APIKey: This key identifies your account within the Speakeasy platform. If you need a key, head over to the API Keys tab in the Speakeasy platform and click "New API Key".
- ApiID: This is an arbitrary ID to help you identify you API within the platform. Use something that is meaningful to your team. Supports any string up to 128 characters, using Alphanumeric characters or the following symbols (. - _ ~). For example: test-api
- VersionID: Use this field to demarcate the version of the API that you are tracking. Supports any string up to 128 characters, using Alphanumeric characters or the following symbols (. - _ ~). For example: v1.0.0
- Go
- Java
- Typescript
- Rust
- Ruby
- Python
- Cloudflare Workers
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
Sign up for free on our platform. Create a workspace and generate an API key
Import and configure the Speakeasy SDK as below. Note:
APIKey
: enter the key you generated aboveApiID
andVersionID
: 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)
}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
Full documentation available on github.
This is the Speakeasy JVM SDK for evaluating API requests/responses. Currently only supports the Springboot API Framework. If you are integrating for the first time please start at the Quickstart on our docs home.
Requirements
- Spring Boot 2.7.X
- Java 8+ (Also works with Kotlin, official support coming soon)
Usage
Add the Speakeasy SDK to your project's build.gradle file:
dependencies {
implementation 'dev.speakeasyapi:speakeasyapi-jvm-springboot-sdk:1.2.1'
}
Please check on maven central for the latest release of the SDK.
Minimum configuration
Sign up for free on our platform. Create a workspace and generate an API key
Import and configure the Speakeasy SDK as below. Note:
APIKey
: enter the key you generated aboveApiID
andVersionID
: 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.
@EnableConfigurationProperties(EnableSpeakeasy.class)
public class SpringWebApp {
// ...
}Add your api key to
application.properties
:speakeasy-api.apiKey=[your-api-key]
speakeasy-api.apiID=[your-api-id]
speakeasy-api.versionID=[your-api-version-id]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.
(Optional) Building our SDK from source
gradle clean build
Running the Java Example Service (Coming Soon!)
Supported Versions
Version | Features |
---|---|
v1.1.0 | https://github.com/speakeasy-api/speakeasy-jvm-springboot-sdk/releases/tag/1.1.0 |
v1.0.4 | https://github.com/speakeasy-api/speakeasy-jvm-springboot-sdk/releases/tag/1.0.4 |
Full documentation available on npm.
The Speakeasy Typescript SDK for evaluating API requests/responses.
Requirements
Supported frameworks:
- Express
- NestJs
Usage
The Speakeasy Typescript SDK is hosted on NPM and can be installed with the following command:
npm install @speakeasy-api/speakeasy-typescript-sdk
Minimum configuration
Sign up for free on our platform. Create a workspace and generate an API key
Import and configure the Speakeasy SDK as below. Note:
APIKey
: enter the key you generated aboveApiID
andVersionID
: 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.
Express
Configure Speakeasy in your middleware chain as follows:
import speakeasy, { Config } from "@speakeasy-api/speakeasy-typescript-sdk";
import express from "express";
const app = express();
// Configure the global speakeasy SDK instance
const cfg: 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)
port: 3000, // The port number your express app is listening on (required to build full URLs on non-standard ports)
};
speakeasy.configure(cfg);
// Add the speakeasy middleware to your express app
app.use(speakeasy.expressMiddleware());
// Rest of your express app setup codeNestJS
Configure Speakeasy in your NestJS app as follows:
import speakeasy, { Config } from '@speakeasy-api/speakeasy-typescript-sdk';
import { MiddlewareConsumer, Module, NestModule } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
@Module({
imports: [],
controllers: [AppController],
providers: [AppService],
})
export class AppModule implements NestModule {
configure(consumer: MiddlewareConsumer) {
// Configure the global speakeasy SDK instance
const cfg: 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)
port: 3000, // The port number your express app is listening on (required to build full URLs on non-standard ports)
};
speakeasy.configure(cfg);
// Configure the NestJS middleware for the routes of you Controller
consumer.apply(speakeasy.nestJSMiddleware()).forRoutes(AppController);
}
}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.
Full Documentation also available on crates and docs.rs
Requirements
Supported Frameworks:
- Actix 3
Usage
Available on crates: crates.io/crates/speakeasy-rust-sdk
Documentation available at: docs.rs/speakeasy-rust-sdk
Run:
cargo add speakeasy-rust-sdk --features actix3
Or add it directly to your Cargo.toml
speakeasy-rust-sdk = {version = "0.1.0", features = ["actix3"]}
Minimum configuration
Sign up for free on our platform. After you've created a workspace and generated an API key enable Speakeasy in your API as follows:
Configure Speakeasy at the start of your main()
function:
use actix_web::{
get, post,
web::{self, ReqData},
App, HttpResponse, HttpServer, Responder,
};
use speakeasy_rust_sdk::{middleware::actix3::Middleware, Config, SpeakeasySdk};
#[actix_web::main]
async fn main() -> std::io::Result<()> {
HttpServer::new(|| {
let config = Config {
// retrieve from Speakeasy API dashboard.
api_key: "YOUR API KEY HERE".to_string(),
// 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.
api_id: "YOUR API ID HERE".to_string(),
// 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)
version_id: "YOUR VERSION ID HERE".to_string(),
};
// Create a new Speakeasy SDK instance
let mut sdk = SpeakeasySdk::try_new(config).expect("API key is valid");
// create middleware
let speakeasy_middleware = Middleware::new(sdk);
let (request_capture, response_capture) = speakeasy_middleware.into();
App::new()
.wrap(request_capture)
.wrap(response_capture)
...
})
.bind(("127.0.0.1", 35290))?
.run()
.await
}
Build and deploy your app and that's it. Your API is being tracked in the Speakeasy workspace you just created and will be visible on the dashboard next time you log in. Visit our docs site to learn more.