Email that sends in one typed call.
Install samva, pass your key, and call email.send. Requests and responses are typed end to end, webhooks are signed, and templates are versioned.
import { createClient } from "samva";
const samva = createClient({ apiKey: process.env.SAMVA_API_KEY });
const { data } = await samva.email.send({
to: "ada@example.com",
subject: "Your order shipped",
html: "<p>Order #1042 is on its way.</p>",
});Send, verify, and generate against one contract.
POST /v1/messages
X-API-Key: samva_sk_live_...
{ "channel": "email",
"to": [{ "email": "ada@example.com" }],
"email": { "subject": "Your order shipped" } }
202 { "id": "msg_01hv8kq2", "status": "queued" }One POST, or one typed call. Requests and responses are typed end to end, so the compiler catches a bad payload before production does.
SENDING AN EMAILPOST /webhooks/samva
X-Webhook-Signature: sha256=9f2ab1c4...
X-Webhook-Event: message.delivered
{ "event": "message.delivered", "messageId": "msg_01hv8kq2" }
verify: timingSafeEqual(sig, "sha256=" + hmacSha256(secret, body))Delivery, bounce, and inbound events arrive as HMAC-SHA256 signed webhooks, retried with backoff. Verify the X-Webhook-Signature against the raw body in constant time.
WEBHOOK REFERENCE# the typed TypeScript SDK
npm install samva
# the whole API, as one spec
GET https://api.samva.app/v1/openapi.json
200 · openapi 3.0 · every endpoint, typedInstall the typed TypeScript SDK, or work from the OpenAPI 3.0 spec at /v1/openapi.json in any other language. Both describe the same contract.
OPENAPI SPEC{
"mcpServers": {
"samva": {
"url": "https://mcp.samva.app/mcp",
"headers": { "X-API-Key": "samva_sk_live_..." }
}
}
}Point an OAuth-capable client at mcp.samva.app/mcp and your agent gets templates, contacts, and delivery status as tools. API key or OAuth, your call.
HOSTED MCPThere is an Effect-native client too.
Import from samva/effect and calls return Effects that compose into your program. Same email API, expressed in Effect v4 primitives.
import { Effect } from "effect";
import { createClient } from "samva/effect";
const send = Effect.gen(function* () {
const samva = yield* createClient({ apiKey });
return yield* samva.email.send({ to, subject, html });
}).pipe(
Effect.catchTags({
RateLimitedError: (e) => Effect.sleep(e.retryAfterSeconds),
ValidationError: (e) => Effect.log(e.fields),
}),
);- Typed errors
- Failures arrive as tagged errors you narrow with catchTags. RateLimitedError carries retryAfterSeconds, ValidationError carries the offending fields.
- Layer-based services
- SamvaClient is a service. Build the layer once with SamvaClient.layerFetch and read the client wherever you need it.
- Schema-driven
- Requests and responses are decoded through Schema, so a malformed payload fails at the boundary, not three calls later.
Hand the integration to your agent.
Samva publishes machine-readable setup at /auth.md, so a coding agent picks the right credential before it acts. Point it at hosted MCP, or paste the brief below.
Read the docs before you write a line.
API key to first send in one call.
REFERENCEAPI referenceEvery resource, verb, and payload.
EVENTSWebhooksRegister endpoints and verify signatures.
SDKTypeScript SDKPromise and Effect entrypoints, typed end to end.
HTTPREST APIAuth, pagination, and errors over raw HTTP.
AGENTSHosted MCPGive an OAuth-capable client the tools.
Send the first email from your editor.
Install samva, pass your key, and call email.send. The first email goes out in minutes.