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.
- Spec:
https://api.spacepost.dev/openapi.json - Source file in the repository:
openapi/openapi.yaml
Generate a client
Section titled “Generate a client”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:
npx openapi-typescript https://api.spacepost.dev/openapi.json -o spacepost.d.tsnpm install openapi-fetchimport 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>" },});pipx install openapi-python-clientopenapi-python-client generate --url https://api.spacepost.dev/openapi.jsongo install github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen@latestcurl -s https://api.spacepost.dev/openapi.json -o openapi.jsonoapi-codegen -package spacepost -generate types,client openapi.json > spacepost.gen.goUse OpenAPI Generator:
npx @openapitools/openapi-generator-cli generate \ -i https://api.spacepost.dev/openapi.json \ -g ruby -o ./spacepost-rubyGenerators exist for PHP, Ruby, Java, Kotlin, Swift, C#, Rust and dozens more.
Postman and API tools
Section titled “Postman and API tools”Import the spec URL into Postman, Insomnia, Bruno or Hoppscotch. Set a collection variable for the bearer token.
Use the Resend SDKs
Section titled “Use the Resend SDKs”Because SpacePost is Resend-compatible, official Resend SDKs in other languages often work by overriding their base URL. See Migrating from Resend.
API referenceEvery endpoint with request and response schemas.