Sentroy API

Build on Sentroy

One platform for transactional mail, inboxes, and media storage — accessed through a single access token and a single SDK entry point.

Installation#

Pick the SDK that matches your runtime. Every SDK exposes the same resources and method shape — your code looks the same across languages.

Quick start#

Configure a client with your platform URL, company slug, and a Bearer access token. The same client handles mail and storage — the SDK routes calls to the right subdomain transparently.

import { Sentroy } from "@sentroy-co/client-sdk"

const sentroy = new Sentroy({
  baseUrl: "https://sentroy.com",
  companySlug: "my-company",
  accessToken: "stk_...",
})

// Send your first email
await sentroy.send.email({
  to: "user@example.com",
  from: "info@example.com",
  domainId: "domain-id",
  subject: "Hello from Sentroy",
  html: "<h1>It works.</h1>",
})

Authentication#

Every API request authenticates with a Bearer access token. Create one from Admin → Access Tokensin your Sentroy dashboard. Tokens are scoped to a single company and inherit that company's permissions.

Authorization: Bearer stk_...

SDK base URL

SDKs only need the platform root (https://sentroy.com) — the/api/companies/{slug} prefix is built automatically from yourcompanySlug config. Calls to mail or storage resources are routed to the correct subdomain by the gateway.

Raw HTTP base URL

GEThttps://sentroy.com/api/companies/{company-slug}

If you're calling the API directly with cURL or another HTTP client, every endpoint below is relative to this base.

Error handling#

All endpoints return a consistent envelope. SDKs throw a typed error class with the same fields.

{
  "data": null,
  "error": "Human-readable error message",
  "statusCode": 401
}

Catching errors in TypeScript

import { Sentroy, SentroyError } from "@sentroy-co/client-sdk"

try {
  await sentroy.send.email({ /* ... */ })
} catch (err) {
  if (err instanceof SentroyError) {
    console.error(err.statusCode) // 401, 403, 500, etc.
    console.error(err.message)    // Human-readable error
  }
}

Common status codes

  • 400 — invalid request payload
  • 401 — missing or invalid token
  • 403 — token lacks the required permission
  • 404 — resource (or company) not found
  • 409 — conflict (duplicate slug, non-empty bucket, etc.)
  • 429 — rate limit exceeded
  • 5xx — Sentroy-side error; safe to retry with backoff

For AI agents#

Plain-text mirrors of every SDK README, so coding agents can ingest the full surface in one fetch.