Flowstates messaging platform logo
    Developer Docs

    Build with the Flowstates platform

    Authenticate with an API key, create branded URL short links, generate one-time passwords and validate them. More endpoints will be added as the platform expands.

    Quickstart

    All endpoints are served from a single base URL. Every request needs your API key in the x-api-key header and JSON requests use Content-Type: application/json.

    Base URL
    https://cpt.cx
    Required headers
    x-api-key: YOUR_API_KEY
    Content-Type: application/json
    Create a short link
    curl -X POST "https://cpt.cx/shortlink/public-generate" \
      -H "x-api-key: YOUR_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "name": "BBC News",
        "url": "https://www.bbc.com/news",
        "domain": "cpt.cx",
        "tags": ["News", "BBC"]
      }'

    Authentication

    Every public endpoint is authenticated with an API key sent in the x-api-key header. Keys are scoped to your account, the domains registered against it and the providers configured for your channels. Treat keys as secrets — never embed them in client-side code.

    Required header
    x-api-key: YOUR_API_KEY

    OTP API

    Generate one-time passwords for SMS or email delivery and validate them later with the returned otpId. The OTP value is never returned by the API — it is delivered to the recipient and stored only as a hash with a TTL.

    POST/otp/generate
    Generate an OTP

    Request body

    • channelrequired, email or sms
    • providerrequired, the provider configured for that channel on your account (e.g. generic, twilio, sendgrid)
    • destinationrequired, email address or E.164 phone number
    • typerequired, numeric or alphanumeric
    • lengthrequired, between 4 and 12
    • expiresInSecondsrequired, must be greater than 0
    Request
    {
      "channel": "email",
      "provider": "generic",
      "destination": "test@example.com",
      "type": "alphanumeric",
      "length": 8,
      "expiresInSeconds": 300
    }
    200 OK
    {
      "otpId": "51a6fcc7-efc8-4e69-8bc1-ebb999befb2c",
      "destination": "test@example.com",
      "createdAt": "2025-09-10T14:05:41Z",
      "expiresAt": "2025-09-10T14:10:41Z"
    }
    POST/otp/validate
    Validate an OTP

    Send the otpId returned by /otp/generate together with the OTP value the user supplied. A successful validation consumes the OTP — codes are single-use.

    Request
    {
      "otpId": "c4f8814c-7a9d-4e13-b7d8-d4e66d272611",
      "otp": "z4dGyBPQ"
    }
    200 OK
    {
      "success": true,
      "message": "OTP validated successfully."
    }

    After repeated failed attempts, validation will return Too many failed attempts. Try again later. until the temporary lock expires.

    Errors & known gaps

    Validation errors are returned with descriptive messages such as Invalid URL format. or Provider not found for this client and channel.. The following details are not yet documented publicly — treat them as TODOs and contact us if you need a definitive answer for production use:

    • Auth failure payloads and exact 4xx/5xx response shapes
    • Rate limits per endpoint and per account
    • Maximum batch size for short-link creation
    • Per-item failure structure inside a partially successful batch
    • Whether short-link expiry can be customised beyond the default 30 days
    • OTP temporary lock duration after too many failed attempts

    Machine-readable assets

    Files for AI agents, LLM crawlers, API client generation and technical discovery. Linked from the site's HTML head and robots.txt for reliable discoverability.

    Need an API key or a sandbox?

    We will provision keys, register your domains and configure your providers — usually within a day.