← MP3 Converter
Your token

MP3 Converter API

Converting video or audio to MP3 runs free in the browser and needs no API: your files never leave your device. The API is for the one metered step: send the names of your files (and an optional note), get back the artist, title, album, track number and year for each, ready to write as ID3 tags.

Base URL: https://api.skillsafe.ai/v1/app-api. Every response is {"data": ...} or {"error": {"code", "message"}}; read error.code and error.message rather than the HTTP status alone.

The task field

This app has one task. Always send "task": "tag_files".

taskWhat it doesReply
tag_filesReads each file name (and your note) and splits it into artist, title, album, track and year, dropping clutter such as "(Official Audio)" or "320kbps". Uses only words that are in the file name or the note.One JSON object

Input fields

FieldTypeMeaning
taskstring, required"tag_files"
filesstring, requiredJSON text: a list of {"id", "name", "seconds"}, at most 40. name is the file name with its extension, at most 200 characters.
hintstringYour note about the files, at most 300 characters; may be empty. Words in it count as known, like words in a file name.

The reply

job.output.output is JSON text: {"task": "tag_files", "tags": [{"id", "artist", "title", "album", "track", "year"}]}, one entry per file in the order sent. artist, title and album are strings ("" when unknown); track is 1 to 999 or null; year is 1900 to 2099 or null. The page checks every word against the file name and the note and keeps its own reading of any field that uses another word. If the balance ran low, truncated is true and the object may stop early.

Worked example

Input (input.json), for the page's three example downloads:

{
  "task": "tag_files",
  "files": "[{\"id\":\"f1\",\"name\":\"01. Ella Rivers - Night Ferry (Lyric Video) HD.wav\",\"seconds\":6},{\"id\":\"f2\",\"name\":\"ella_rivers_-_harbour_lights_live_at_the_corn_exchange_2019.wav\",\"seconds\":6},{\"id\":\"f3\",\"name\":\"track 3 - salt & glass ft. mara lin [official visualizer].wav\",\"seconds\":6}]",
  "hint": "All from Ella Rivers' album Night Ferry (2019)"
}

Reply:

{
  "task": "tag_files",
  "tags": [
    {
      "id": "f1",
      "artist": "Ella Rivers",
      "title": "Night Ferry",
      "album": "Night Ferry",
      "track": 1,
      "year": 2019
    },
    {
      "id": "f2",
      "artist": "Ella Rivers",
      "title": "Harbour Lights (Live at the Corn Exchange)",
      "album": "Night Ferry",
      "track": null,
      "year": 2019
    },
    {
      "id": "f3",
      "artist": "Ella Rivers",
      "title": "Salt & Glass (ft. Mara Lin)",
      "album": "Night Ferry",
      "track": 3,
      "year": 2019
    }
  ]
}

On the page, the details go into each MP3 as ID3 tags and the files are named "Artist - Title.mp3".

Errors

HTTPWhat to do
401The token is missing, expired or a guest token on a run. Get a personal token on the token page.
402The balance is below what the run reserves. Top up at skillsafe.ai/account/billing.
400The body is not a JSON object of the fields above.
429Wait and retry with the same Idempotency-Key.

Step 1 — a tiny client helper

One function that sends JSON and unwraps the {data, error} envelope.

BASE="https://api.skillsafe.ai/v1/app-api"
TOKEN="paste-your-token-here"   # from https://mp3-converter.skillsafe.ai/tokens.html
api() { # api METHOD PATH [JSON-BODY]
  curl -s -X "$1" "$BASE$2" -H "Content-Type: application/json" \
    ${TOKEN:+-H "Authorization: Bearer $TOKEN"} ${3:+--data "$3"}
}

Step 2 — a token

A guest token is enough for /me and /estimate. A run is metered, so it needs your personal token: sign in on the token page and copy it.

# a guest token (enough for /me and /estimate); a run needs your personal token from /tokens.html
TOKEN=$(curl -s -X POST "$BASE/guest" -H "Content-Type: application/json" -d '{"slug":"mp3-converter"}' | jq -r '.data.token')

Step 3 — who am I, and my balance

subject_type is guest or user; credits is the balance (1 credit = $0.0001).

api GET /me | jq '.data | {subject_type, credits}' 

Step 4 — price a run for free

/estimate charges nothing and starts no job. hold_credits is the amount reserved while a run is in flight, not the price; the run is charged what it uses.

# input.json: the run input object - {"task": "tag_files", "files": "[...]", "hint": "..."}
api POST /estimate "$(cat input.json)" | jq '.data | {hold_credits, min_credits, model, model_alias, markup_bps, warnings}' 

Step 5 — run it and wait for the job

Send an Idempotency-Key derived from the input: a retry with the same key is never billed twice.

KEY="mp3-converter:tag_files:$(shasum -a 256 input.json | cut -c1-16):a1"
JOB=$(curl -s -X POST "$BASE/run" -H "Content-Type: application/json" -H "Authorization: Bearer $TOKEN" \
  -H "Idempotency-Key: $KEY" --data @input.json | jq -r '.data.job_id')
while :; do
  J=$(api GET "/jobs/$JOB"); S=$(echo "$J" | jq -r '.data.status')
  case "$S" in succeeded|failed|cancelled) break;; esac; sleep 2
done
echo "$J" | jq -r '.data.output.output' > reply.json   # one JSON object: task, tags
echo "$J" | jq '.data | {charged_credits, truncated}' 

Step 6 — or stream it

/run-stream sends Server-Sent Events while the job runs and the finished job at the end.

# Server-Sent Events: tick/delta events while the job runs, then a final event with the job
curl -N -s -X POST "$BASE/run-stream" -H "Content-Type: application/json" -H "Authorization: Bearer $TOKEN" \
  -H "Idempotency-Key: mp3-converter:tag_files:$(shasum -a 256 input.json | cut -c1-16):a1" --data @input.json