TypeScript SDK
CLI and agents
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.
| Language | Package | Install | Runtime |
|---|---|---|---|
| Python | cosscom (PyPI), imported as coss | pip install cosscom | Python 3.10+ |
| Go | github.com/cosscom/coss-go | go get github.com/cosscom/coss-go | Go 1.21+ |
| Ruby | coss (RubyGems) | gem install coss | Ruby 3.3+ |
| PHP | coss/coss (Packagist) | composer require coss/coss | PHP 8.1+ |
| Java | com.coss:coss (Maven Central) | implementation("com.coss:coss:0.1.0") | Java 8+ |
| .NET | Coss (NuGet) | dotnet add package Coss | .NET 8+, .NET Framework 4.6.2+, .NET Standard 2.0 |
They all work the same way:
- One client for every product, with the API key from the client's options or the
COSS_API_KEYenvironment variable. Methods are grouped like the TypeScript SDK's:coss.email.suppressions.addisclient.email.suppressions.addin Python and Ruby,client.Email.Suppressions.Addin Go and so on. - API versions. Every request sends
Coss-Versionwith 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-Afteror an exponential backoff. EveryPOSTcarries anIdempotency-Keythat 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,issuesandrequest_id. - Lists return one page (
data,has_more). Pass the last item'sidasafterfor the next one, whilehas_moreis 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.