AI-ready API

Integrate SMS with your AI assistant

Our whole REST API fits in one machine-readable file. Hand it to your assistant - Claude, ChatGPT, Copilot, Cursor, any of them - and get working send-SMS code in your language, usually in minutes.

1

Give it the spec

Point your assistant at cosmicsms.com/cosmic-sms-api.md - or paste the file in if it can't fetch URLs. It covers every endpoint, the XML shapes and the error codes.

2

Ask for the code

Use the prompt below, or your own words. Name your language and framework - the spec has enough detail that assistants rarely need a follow-up question.

3

Run it on free credit

Sign up free, use your username and API password from Settings, and the generated code sends a real text on your starter credit.

A prompt that works

Fetch https://www.cosmicsms.com/cosmic-sms-api.md and read the API summary.

Write a small, production-sensible module in [YOUR LANGUAGE] that:
1. sends an SMS via the Cosmic SMS REST API to a given mobile number,
2. reads the username and API password from environment variables,
3. returns the batch id from the response, and
4. handles non-200 responses with clear errors.

Then show me a one-line example of calling it.
Copied

Why this works so well

Most SMS providers document their APIs across dozens of pages written for humans. Assistants do better with something they can swallow whole: our spec file is a single compact page - base URL, authentication, all five endpoints, the XML request and response shapes, status values and segment rules - exactly the context a model needs to produce correct code first time.

The API itself helps too: plain HTTP Basic authentication and small XML bodies, no SDKs to version-match, no OAuth dance. Anything that can make an HTTP request can send a text - which is why the code samples fit in a page per language.

If you'd rather not involve an assistant

What about sending, not coding?

If you just want to send texts from a browser - no code at all - that's the web app. Same account, same credit.

Ready to try it?

Free test credits on signup, your API password in Settings, and the first text usually arrives before the kettle's boiled. UK texts from 3.6p; credit never expires.

Sign up free → Get the spec