Skip to content

OpenAPI and other languages

The full API is described by an OpenAPI 3.1 document. It drives the API reference on this site and can generate clients for languages without an official SDK.

Set the base URL to https://api.spacepost.dev and configure bearer authentication with your sp_live_ key.

Types and a fetch client with openapi-typescript and openapi-fetch:

Terminal window
npx openapi-typescript https://api.spacepost.dev/openapi.json -o spacepost.d.ts
npm install openapi-fetch
import createClient from "openapi-fetch";
import type { paths } from "./spacepost";
const client = createClient<paths>({
baseUrl: "https://api.spacepost.dev",
headers: { Authorization: `Bearer ${process.env.SPACEPOST_API_KEY}` },
});
const { data, error } = await client.POST("/emails", {
body: { from: "Acme <hello@acme.com>", to: ["user@example.com"], subject: "Hi", html: "<p>Hi</p>" },
});

Import the spec URL into Postman, Insomnia, Bruno or Hoppscotch. Set a collection variable for the bearer token.

Because SpacePost is Resend-compatible, official Resend SDKs in other languages often work by overriding their base URL. See Migrating from Resend.