# Morse Code API

> Morse Code is a Morse code translator and decoder API: it converts plain text to Morse code dots and dashes and translates Morse back into text. It provides character counts, dit and dah totals, and validation status, while paid plans add downloadable audio tones.

**Endpoint:** `POST https://api.apiverve.com/v1/morsecode`  
**Category:** Data Processing  
**Cost:** 1 credit per call  
**Canonical page:** https://apiverve.com/marketplace/morsecode

## Overview

Send text to receive dot-and-dash sequences separated by spaces and slashes, along with total counts of dits, dahs, and characters. Decoding parses Morse strings back into text and isolates any unrecognized symbols. Paid plans can generate downloadable audio tone files with duration, frequency, and sample rate metadata.

## Authentication

Every call carries your key in an `x-api-key` header. The same key works across the whole
APIVerve catalog — there are no per-API subscriptions. Responses always use the same three
top-level keys: `status`, `error`, and `data`.

## Example request

```bash
curl -X POST "https://api.apiverve.com/v1/morsecode" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"This Is A Message","audio":true}'
```

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `text` | string | Yes | The text to encode or decode in Morse code |
| `audio` | boolean | No | Set to true to include an audio file of the Morse code. Audio is generated only when the encoded morse is 300 characters or fewer (roughly 60-80 characters of text); longer input returns audio: null with an audioError. default false. Premium field |

## Response fields

- `text` — string · Original input text converted to Morse code
- `morse` — string · Encoded Morse code representation with spaces and slashes
- `stats` — object · Statistics about the Morse code encoding
  - `stats.characters` — number · Total number of characters in original text
  - `stats.dits` — number · Total count of dits (dots) in Morse code
  - `stats.dahs` — number · Total count of dahs (dashes) in Morse code
- `valid` — boolean · Whether the Morse code is valid and properly formatted
- `audio` — object · Audio file information including URL and metadata; null when audio was requested but could not be generated · (premium)
  - `audio.audioFile` — string · Unique identifier for the generated audio file · (premium)
  - `audio.format` — string · Audio file format (e.g., .wav, .mp3) · (premium)
  - `audio.downloadURL` — string · Signed URL to download the generated audio file · (premium)
  - `audio.duration` — string · Duration of the audio file in seconds · (premium)
  - `audio.frequency` — string · Frequency of the Morse code tone in Hz · (premium)
  - `audio.sampleRate` — string · Sample rate of the audio file in Hz · (premium)
  - `audio.expires` — number · Unix timestamp when the audio download URL expires · (premium)

## Sample response

```json
{
  "status": "ok",
  "error": null,
  "data": {
    "text": "This Is A Message",
    "morse": "- .... .. ... / .. ... / .- / -- . ... ... .- --. . ",
    "stats": {
      "characters": 17,
      "dits": 25,
      "dahs": 7
    },
    "valid": true,
    "audio": {
      "audioFile": "a11f9d7f-1fd2-4b10-86de-82defaf18c57.wav",
      "format": ".wav",
      "downloadURL": "https://storage.googleapis.com/apiverve/APIData/morsecode/a11f9d7f-1fd2-4b10-86de-82defaf18c57.wav?GoogleAccessId=635500398038-compute%40developer.gserviceaccount.com&Expires=1765925804&Signature=TiktgUsHV0ipCaRwNNiEihtD5e1SacBHBwWLGvsrnLJTkH%2BH5fRsII5hxk7nEqTypya05Dg4BHTxu672tRU%2Bhb3F8g%2BQYL7u3PMaCHzcnrrpcjSh0hH7%2BWVfEyHxPf5cCuKliISePCOlpbVsU8xtFL8p1DfgTV2FeD8Rmwo3SVpCG4LHpYXJWoZVET2IbS4dZS%2Brn9kvnoBvApgDJgc5EEufOZHYLba6278g0HTgQaOIhdSNhpeSpCwPuSw6q3eK%2FGqzhD5PtzTBMPN1hMvXIZPX11EYRG%2FLbqvltu6gVgbYL5khcG5zQbDse2vXphAys8fMq7PiZSGe1ODf63Gakw%3D%3D",
      "duration": "13.20s",
      "frequency": "600Hz",
      "sampleRate": "8000Hz",
      "expires": 1765925804517
    }
  }
}
```

## Use cases

- **Ham Radio Training** — Amateur radio training apps convert practice call signs and sentences into Morse strings to help students verify their manual keying.
- **Escape Room Puzzles** — Game designers translate clue strings into dot-and-dash puzzles and count character lengths to calibrate challenge difficulty for players.
- **Assistive Communication Tools** — Decode user input from single-switch sip-and-puff hardware into text while flagging invalid or unrecognized signal sequences immediately.
- **STEM Classroom Demonstrations** — When teaching telecommunications history, physics teachers translate student messages into Morse code sequences to display exact dit and dah counts.

## SDKs

- **npm** — `npm install @apiverve/morsecode` (https://www.npmjs.com/package/@apiverve/morsecode)
- **NuGet** — `dotnet add package APIVerve.API.MorseCode` (https://www.nuget.org/packages/APIVerve.API.MorseCode)
- **Source** — https://github.com/apiverve/morsecode-api

## More

- Full reference: https://docs.apiverve.com/ref/morsecode
- Get an API key: https://dashboard.apiverve.com
- Full catalog: https://apiverve.com/marketplace
