Transform - Encoding

Free Blink Encode API Endpoint

The free blink encode API endpoint turns a short text into an on and off signal in Morse timing. The answer holds the signal twice: as bits, one character per unit, and as the lengths of the on and off runs in milliseconds, ready for a screen, a lamp, a smart bulb, window shades or a buzzer to play.

  • No API key
  • Morse timing
  • GET or POST
  • Up to 128 bytes

Text to a blink

GET/blink_encode/{text}

POST/blink_encode

https://aisenseapi.com/services/v1/blink_encode

Call the free blink encode API endpoint

Put the text in the path:

curl https://aisenseapi.com/services/v1/blink_encode/SOS
{"coding":"morse","morse":"... --- ...","bits":"101010001110111011100010101","timing":[100,100,100,100,100,300,300,100,300,100,300,300,100,100,100,100,100],"unit_ms":100,"duration_ms":2700,"skipped":[]}

Or post it with a unit of your own, here 200 ms for a lamp seen across a room:

curl -X POST https://aisenseapi.com/services/v1/blink_encode \
  -H "Content-Type: application/json" \
  -d '{"data": "HELLO", "unit_ms": 200}'
{"coding":"morse","morse":".... . .-.. .-.. ---","bits":"1010101000100010111010100010111010100011101110111","timing":[200,200,200,200,200,200,200,600,200,600,200,200,600,200,200,200,200,600,200,200,600,200,200,200,200,600,600,200,600,200,600],"unit_ms":200,"duration_ms":9800,"skipped":[]}

The way back is the blink decode API endpoint.

The timing

Morse timing counts in units. The text becomes International Morse code first, as the Morse encode API endpoint writes it, with its code table.

PartLength
A dot1 unit on
A dash3 units on
The gap inside a letter1 unit off
The gap between letters3 units off
The gap between words7 units off

Pick the unit for what will see the signal. It needs at least three samples a unit.

ReaderUnit
A phone or webcam at 30 frames per second100 ms, the default; 150 ms or more when the picture flickers or moves
A camera at 60 frames per second50 ms
An LED switched by a small computer, read by a light sensor at 1 kHz or more5 ms and up
A person, or window shades seen from afar1000 to 5000 ms

Input and answer

  • GET /blink_encode/{text} takes the text as one path segment, percent-encoded: a space as %20, a slash as %2F. Two more segments may follow, the coding and the unit: /blink_encode/SOS/morse/200.
  • POST /blink_encode takes {"data": "...", "unit_ms": 100} with Content-Type: application/json, or the text as the raw request body with any other type. At most 128 bytes, in UTF-8. unit_ms is a whole number from 5 to 5000.
  • morse is the code. bits has one character per unit, 1 for on and 0 for off. timing lists the lengths of the runs in milliseconds, the first one on. duration_ms is the whole signal.
  • skipped lists each character without a code once, as the Morse encode endpoint does.

To play the signal, switch on for the first value of timing, off for the next, and so on. Leave it off for a few units before and after, so a reader sees where the message starts and ends.

curl -X POST https://aisenseapi.com/services/v1/blink_encode \
  -H "Content-Type: application/json" \
  -d '{"data": "OK #1"}'
{"coding":"morse","morse":"--- -.- / .----","bits":"11101110111000111010111000000010111011101110111","timing":[300,100,300,100,300,300,300,100,100,100,300,700,100,100,300,100,300,100,300,100,300],"unit_ms":100,"duration_ms":4700,"skipped":["#"]}

Errors

StatuserrorWhen
400No text to blink.No text in the path, no data string and no body
413Text over 128 bytes.More than 128 bytes of text in one request
400The data is not UTF-8 text.Bytes that are not UTF-8
400Nothing in the text has a Morse code.Only characters without a code; skipped lists them
400coding is morse.Another coding was asked for
400unit_ms is a whole number of milliseconds from 5 to 5000.A unit outside 5 to 5000, or one with a fraction

Each refusal also carries fix, a sentence saying what to send instead.

Common uses

A screen that speaks to a phone

Blink a square on a laptop, a kiosk or a sign, and read it back with a phone camera through the decode endpoint.

A lamp or a smart bulb

Switch a lamp by the timing to pass a short code, a room number or a status across a room.

Shades and slow signals

At a unit of a second or more, shades, a porch light or a flag can carry a word that a camera reads from far away.

Agents

Through the MCP server the same encoder is the tool encode_blink.

Privacy and limits

Nothing is stored. The blink encode answer is worked out while the request is open and the signal is gone with it. The access log records the path and the status. A text or bits sent in the path are part of that path, so post them when they should not be logged.

The base URL is https://aisenseapi.com/services/v1. There is no key, no account and no sign-up step. An encode takes at most 128 bytes of text and a decode at most 200,000 bits, run lengths or levels, and the service-wide limit is 5000 requests per IP address per day. Every endpoint in the collection is listed on the Free public REST APIs reference, and the encodings side by side on Encoding APIs.