← CSV to JSON
Your token

CSV to JSON API

Converting CSV to JSON and back runs free in the browser and needs no API: the file never leaves your device. The API is for the one metered step: send a file's headers, up to 15 sample rows and the page's profile of each column, get back a column plan - a clean key and a type for every column - which you then check against every value, as the page does.

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": "plan_columns".

taskWhat it doesReply
plan_columnsGives every column a snake_case key and one of string, integer, number, boolean, date, never wider than what every value fits; codes with leading zeros, IDs and decimal commas stay string.One JSON object

Input fields

FieldTypeMeaning
taskstring"plan_columns"
filestringThe file name, at most 120 characters.
directionstringcsv_to_json or json_to_csv.
headersstringJSON text: the column names in order, at most 80.
samplestringJSON text: up to 15 whole rows {"line", "cells"}, the first rows and then rows spread over the file; cells cut to 60 characters.
profilestringJSON text, one entry per column over every row: column, values, empty, distinct, fits, leading_zeros, too_long_integers, sample.
factsstringJSON text: rows, columns, columns_sent, rows_sent, delimiter, encoding, issues.

The reply

job.output.output is JSON text: {"task": "plan_columns", "record_name", "columns": [{"column", "key", "type", "note"}]}. The page tidies keys to snake_case and makes them unique, keeps its own plan for any column the reply leaves out, and checks every value in the file: a column with a value that does not fit its type stays text, with the lines named. If the balance ran low, truncated is true and the object may stop early; complete column entries are still used.

Worked example

Input (input.json), for the page's example contacts CSV:

{
  "task": "plan_columns",
  "file": "contacts.csv",
  "direction": "csv_to_json",
  "headers": "[\"name\",\"email\",\"phone\",\"company\",\"zip\",\"signed_up\",\"newsletter\",\"visits\"]",
  "sample": "[{\"line\":2,\"cells\":[\"Maya Chen\",\"maya.chen@example.com\",\"+1 415 555 0142\",\"Chen, Ito & Partners\",\"02139\",\"2026-03-14\",\"true\",\"12\"]},{\"line\":3,\"cells\":[\"Omar Haddad\",\"omar@example.org\",\"+44 20 7946 0958\",\"Haddad Lighting\",\"10001\",\"2026-04-02\",\"false\",\"3\"]},{\"line\":4,\"cells\":[\"Lucia Romero\",\"lucia.romero@example.net\",\"\",\"Romero Studio\",\"00501\",\"2026-05-20\",\"true\",\"27\"]},{\"line\":5,\"cells\":[\"Tom Becker\",\"tom.becker@example.com\",\"+49 30 901820\",\"Becker \\\"Fahrrad\\\" GmbH\",\"80331\",\"2026-06-11\",\"true\",\"0\"]},{\"line\":6,\"cells\":[\"Aiko Tanaka\",\"aiko@example.jp\",\"+81 3 1234 5678\",\"Tanaka Tea\",\"07030\",\"2026-07-01\",\"false\",\"8\"]}]",
  "profile": "[{\"column\":\"name\",\"values\":5,\"empty\":0,\"distinct\":5,\"fits\":\"string\",\"leading_zeros\":0,\"too_long_integers\":0,\"sample\":[\"Maya Chen\",\"Omar Haddad\",\"Lucia Romero\"]},{\"column\":\"email\",\"values\":5,\"empty\":0,\"distinct\":5,\"fits\":\"string\",\"leading_zeros\":0,\"too_long_integers\":0,\"sample\":[\"maya.chen@example.com\",\"omar@example.org\",\"lucia.romero@example.net\"]},{\"column\":\"phone\",\"values\":5,\"empty\":1,\"distinct\":4,\"fits\":\"string\",\"leading_zeros\":0,\"too_long_integers\":0,\"sample\":[\"+1 415 555 0142\",\"+44 20 7946 0958\",\"+49 30 901820\"]},{\"column\":\"company\",\"values\":5,\"empty\":0,\"distinct\":5,\"fits\":\"string\",\"leading_zeros\":0,\"too_long_integers\":0,\"sample\":[\"Chen, Ito & Partners\",\"Haddad Lighting\",\"Romero Studio\"]},{\"column\":\"zip\",\"values\":5,\"empty\":0,\"distinct\":5,\"fits\":\"string\",\"leading_zeros\":3,\"too_long_integers\":0,\"sample\":[\"02139\",\"10001\",\"00501\"]},{\"column\":\"signed_up\",\"values\":5,\"empty\":0,\"distinct\":5,\"fits\":\"date\",\"leading_zeros\":0,\"too_long_integers\":0,\"sample\":[\"2026-03-14\",\"2026-04-02\",\"2026-05-20\"]},{\"column\":\"newsletter\",\"values\":5,\"empty\":0,\"distinct\":2,\"fits\":\"boolean\",\"leading_zeros\":0,\"too_long_integers\":0,\"sample\":[\"true\",\"false\",\"true\"]},{\"column\":\"visits\",\"values\":5,\"empty\":0,\"distinct\":5,\"fits\":\"integer\",\"leading_zeros\":0,\"too_long_integers\":0,\"sample\":[\"12\",\"3\",\"27\"]}]",
  "facts": "{\"rows\":5,\"columns\":8,\"columns_sent\":8,\"rows_sent\":5,\"delimiter\":\"comma\",\"encoding\":\"UTF-8\",\"issues\":[]}"
}

Reply:

{
  "task": "plan_columns",
  "record_name": "contact",
  "columns": [
    {
      "column": "name",
      "key": "name",
      "type": "string",
      "note": "Personal names."
    },
    {
      "column": "email",
      "key": "email",
      "type": "string",
      "note": "Email addresses."
    },
    {
      "column": "phone",
      "key": "phone",
      "type": "string",
      "note": "Phone numbers with + and spaces, kept as text; one is empty."
    },
    {
      "column": "company",
      "key": "company",
      "type": "string",
      "note": "Company names, some with commas and quotes."
    },
    {
      "column": "zip",
      "key": "zip",
      "type": "string",
      "note": "Postal codes with leading zeros (3 of 5), kept as text."
    },
    {
      "column": "signed_up",
      "key": "signed_up",
      "type": "date",
      "note": "Every value is a YYYY-MM-DD date."
    },
    {
      "column": "newsletter",
      "key": "newsletter",
      "type": "boolean",
      "note": "Every value is true or false."
    },
    {
      "column": "visits",
      "key": "visits",
      "type": "integer",
      "note": "Every value is a whole number."
    }
  ]
}

On the page, the JSON then has visits as whole numbers, newsletter as true/false and zip as text, and the JSON Schema download follows the plan.

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://csv-to-json.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":"csv-to-json"}' | 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": "plan_columns", "file": "data.csv", "direction": "csv_to_json", "headers": "[...]", "sample": "[...]", "profile": "[...]", "facts": "{...}"}
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="csv-to-json:plan_columns:$(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, record_name, columns}
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: csv-to-json:plan_columns:$(shasum -a 256 input.json | cut -c1-16):a1" --data @input.json