Rust · Integration

Add E-Signatures to Rust (Axum)

Send documents for legally binding e-signature from your Rust (Axum) application. One endpoint, no SDK required.

Quick start

  1. Get an API key from signb.ee (free, no credit card)
  2. Set SIGNBEE_API_KEY in your environment
  3. Add the code below to your app

Rust (Axum) example

Rust
use axum::{Json, extract::State};
use reqwest::Client;
use serde::{Deserialize, Serialize};

#[derive(Deserialize, Serialize)]
struct ContractReq {
    content: String,
    sender_name: String,
    sender_email: String,
    recipient_name: String,
    recipient_email: String,
}

async fn send_contract(
    State(client): State<Client>,
    Json(req): Json<ContractReq>,
) -> Json<serde_json::Value> {
    let res = client.post("https://signb.ee/api/send")
        .bearer_auth(std::env::var("SIGNBEE_API_KEY").unwrap())
        .json(&req)
        .send().await.unwrap();
    Json(res.json().await.unwrap())
}

What happens

  1. Your app sends markdown or a PDF URL to Signbee
  2. Signbee generates a PDF (if markdown) and emails the recipient a signing link
  3. Recipient signs — both parties receive the signed PDF with SHA-256 certificate

Also works with AI agents

Install the MCP server to let Claude, Cursor, or Windsurf send documents directly:

npx -y signbee-mcp

Integration details

Rust with Axum is the highest-performance option for e-signature integration. Axum's async-first design and Rust's zero-cost abstractions make it ideal for services handling thousands of concurrent signing requests.

Axum + Reqwest: The example uses Axum for the web framework and reqwest for the HTTP client. Both are async-native and integrate with Tokio, Rust's async runtime. The reqwest::Client should be shared (via Axum's State extractor) to enable connection pooling.

Type safety: Rust's type system ensures contract requests are validated at compile time. The ContractReq struct with serde derives provides automatic JSON serialisation/deserialisation with compile-time guarantees. No runtime validation code needed.

Error handling: Replace .unwrap() with proper error handling in production. Use Axum's IntoResponse trait with custom error types, or the anyhow crate for ergonomic error propagation. Return appropriate HTTP status codes (400, 401, 500) for different failure modes.

Tower middleware: Axum is built on Tower, which provides composable middleware. Add rate limiting (tower::limit), request tracing (tower_http::trace), timeouts (tower::timeout), and authentication as middleware layers.

Docker deployment: Rust binaries are statically compiled. Use a multi-stage Docker build — compile in a rust:slim builder stage, then copy the binary to a minimal base image (scratch or distroless). The final image is typically under 20MB.

FAQs

How do I add e-signatures to Rust (Axum)?

Get an API key from signb.ee (free, no credit card), set SIGNBEE_API_KEY in your environment, and add a single POST request to your Rust (Axum) application. The recipient receives a signing link by email, signs on any device, and both parties get a SHA-256 certified PDF.

Does Signbee work with Rust (Axum)?

Yes. Signbee is a REST API that works with any language or framework including Rust (Axum). Send a POST request with your document content, sender and recipient details, and Signbee handles the entire signing ceremony. No SDK required.

Why use Rust for e-signature integration?

Rust offers zero-cost abstractions, memory safety without garbage collection, and the highest throughput per server resource. If your e-signature service handles thousands of concurrent requests, Rust with Axum provides the best performance-per-dollar.

Should I share the reqwest::Client in Axum?

Yes. Create the client once and share it via Axum's State extractor. This enables connection pooling (reusing TCP connections across requests), which significantly reduces latency compared to creating a new client per request.

How do I handle errors properly in the Rust example?

Replace .unwrap() with proper error handling. Use Axum's IntoResponse trait with custom error types, or the anyhow crate for ergonomic error propagation. Map different failure modes to appropriate HTTP status codes (400, 401, 500).

Related resources

Try Signbee — free, no credit card.