Skip to main content

Crate workos

Crate workos 

Source
Expand description

Official Rust SDK for the WorkOS API.

The SDK is built around a single Client that exposes one accessor per API surface (SSO, user management, organizations, audit logs, FGA-style authorization, feature flags, vault, …). Each accessor returns a typed resource API whose methods map 1:1 to WorkOS endpoints.

§Quick start

use workos::{Client, organizations::ListOrganizationsParams};

let client = Client::new(std::env::var("WORKOS_API_KEY").unwrap());

let orgs = client
    .organizations()
    .list_organizations(ListOrganizationsParams::default())
    .await?;

for org in orgs.data {
    println!("{}: {}", org.id, org.name);
}

§Custom HTTP transport

The default Client uses reqwest, gated behind the reqwest feature. For WASM, a shared connection pool, or custom retry/observability layers, disable default features and supply your own transport::HttpTransport via ClientBuilder::transport.

[dependencies]
workos = { version = "1", default-features = false }

§Modules

Re-exports§

pub use client::Client;
pub use client::ClientBuilder;
pub use client::DEFAULT_BASE_URL;
pub use client::RequestOptions;
pub use client::RequestStrategy;
pub use error::ApiError;
pub use error::Error;
pub use pagination::ListMetadata;
pub use pagination::Page;
pub use pagination::auto_paginate;
pub use secret::SecretString;
pub use enums::*;
pub use helpers::*;
pub use models::*;
pub use resources::*;

Modules§

client
enums
error
helpers
Hand-maintained helper layer.
models
pagination
Cursor-based pagination primitives.
query
Query-string encoding helpers shared by generated resource code.
resources
resources_api
secret
Redacted string wrapper for credentials, tokens, and other secret values.
transport
Pluggable HTTP transport.