On this page

Client libraries

Beta

There are no official SDKs yet — generate one from the contract, in whatever language you work in.

2 min read

We do not publish hand-written SDKs. What we publish is the contract, which is enough to get a typed client in most languages in about a minute — and one that cannot fall behind the API, because it is generated from the same document the reference is.

https://api.ghostsms.io/v1/openapi.json

No key is needed to fetch it. It is OpenAPI 3.1, which lets it describe the events we post as well as the endpoints you call — generators build the calls, and the event bodies come out as ordinary types.

Generating a client

With OpenAPI Generator:

npx @openapitools/openapi-generator-cli generate \
  -i https://api.ghostsms.io/v1/openapi.json \
  -g typescript-fetch \
  -o ./ghostsms

Swap -g for the language you want — python, go, java, csharp, php, ruby and others are supported by the same tool.

Use a current release: 3.1 support has been filled in over the 7.x series, and 7.25.0 generates a complete client from this document. The npx wrapper runs the generator as a Java program, so Java must be installed; on Node 22 it needs 22.12 or later, and fails with ERR_REQUIRE_ESM before that.

Importing it instead

The same URL works anywhere an OpenAPI document does: Postman (Import → Link), Insomnia, Bruno, or an HTTP client in your editor. That is usually the fastest way to make the first call by hand before you write any code.

Two things to set in whatever you use

A timeout. Buying a number talks to a supplier; 30 seconds is a sensible ceiling.

A retry policy that respects idempotency. Retry 429 and 5xx with backoff, honour Retry-After, and send the same idempotency key on every retry of the same purchase. A generated client will not do this for you, and it is the one piece of glue worth writing by hand.

If you would rather we published one

Say which language. We would rather maintain a generator configuration than a hand-written library, but a thin wrapper around a generated client — the timeout, the retries, the key — is a reasonable thing for us to own.