Overview

The coss.com SDKs for Python, Go, Ruby, PHP, Java and .NET, generated from the API's OpenAPI document.

Besides the TypeScript SDK, coss.com has an SDK for six more languages. They're generated from the API's OpenAPI document, so every endpoint is in every SDK, typed, as soon as it ships. Each endpoint's page in the API reference shows its call in every language.

They all work the same way:

  • One client for every product, with the API key from the client's options or the COSS_API_KEY environment variable. Methods are grouped like the TypeScript SDK's: coss.email.suppressions.add is client.email.suppressions.add in Python and Ruby, client.Email.Suppressions.Add in Go and so on.
  • API versions. Every request sends Coss-Version with the version the SDK was generated for. An SDK release that moves to a newer version says so in its changelog.
  • Retries. A request that gets a 408, 409, 429 or 5xx response is retried up to twice, after the response's Retry-After or an exponential backoff. Every POST carries an Idempotency-Key that its retries reuse, so a retried send never goes out twice. Pass your own key to make retries of your own safe too (idempotency_key, or the language's spelling of it). Requests the API can't deduplicate (creating a webhook endpoint, for example) are never retried.
  • Errors are exceptions (Go: errors) carrying the HTTP status and the API's error envelope: type, code, message, param, issues and request_id.
  • Lists return one page (data, has_more). Pass the last item's id as after for the next one, while has_more is true.
  • Webhooks. Each SDK can check a webhook's or a log drain batch's signature, like the TypeScript SDK's verifyWebhook.

The SDKs are MIT licensed. Their source is in the coss repository, generated by bun run sdks:generate with Fern's open-source generators.