apyhub
Back

Code & Data Formatting API

What it does

Code Formatting Tools gives you three small utilities for common text transforms: minify CSS or JavaScript, format JSON, and test regular expressions. Send code or text in the request body and get a structured result back, with validation details when the input is not usable.

Use /security/minify to shrink CSS or JS. Provide code and type, where type is css or js, and the response returns the minified result along with the echoed type and the tool name.

Use /security/json-format to check whether a JSON string is valid and format it. Send text and an optional indent value, or "minify" to compact it. When the input is valid, the response includes formatted JSON and stats with keys and depth; when it is not, you get valid: false and an error message.

Use /security/regex to verify a pattern against a text sample. Send pattern, text, and optional flags, and the response returns whether the regex is valid, plus matches and matchCount. That makes it useful for input validation, content cleanup, and quick debugging in developer tools or automation flows.

▣ ENDPOINT 01 / 03
POST
CSS & JavaScript Minifier
https://api.eu.apyhub.com/freedailypro/code-data-formatting-api/security/minify

QUICKSTART

GUIDE

Quickstart

Minify CSS or JavaScript by sending the code and its type in a JSON body.

curl -X POST "https://api.eu.apyhub.com/freedailypro/code-data-formatting-api/security/minify" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "code": "function greet(name) { console.log(\"Hello, \" + name); }",
    "type": "js"
  }'

What you'll get back

The live response to the request above:

{
  "tool": "Css js minifier client and server side from freedailypro",
  "type": "js",
  "result": "function greet(name) { console.log(\"Hello, \" + name); }"
}
TRY ITLIVE · 10 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
body*

About this endpoint

What it does

Minifies CSS or JavaScript code by removing comments and unnecessary whitespace. The request must include the code to minify and a type indicating whether the input is css or js.

Request Body

ParameterTypeMandatoryDescription
codeStringYesThe CSS or JavaScript source code to minify.
typeENUMYesThe input code type. Allowed values: css, js.

Response

A successful call returns a JSON object with these fields:

ParameterTypeDescription
toolStringName of the tool that produced the response.
typeStringThe code type that was minified (echoes the request).
resultStringThe minified code.
▣ ENDPOINT 02 / 03
POST
JSON Formatter & Validator
https://api.eu.apyhub.com/freedailypro/code-data-formatting-api/security/json-format

QUICKSTART

GUIDE

Quickstart

Format your JSON text with the default indentation by sending the required text field.

curl -X POST "https://api.eu.apyhub.com/freedailypro/code-data-formatting-api/security/json-format" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"text":"{\"name\":\"ApyHub\",\"active\":true}"}'

What you'll get back

The live response to the request above:

{
  "tool": "Json formatter client and server side from freedailypro",
  "valid": true,
  "formatted": "{\n  \"name\": \"ApyHub\",\n  \"active\": true\n}",
  "stats": {
    "keys": 2,
    "depth": 2
  }
}
TRY ITLIVE · 10 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
body*

About this endpoint

What it does

Formats JSON text sent in the request body. The endpoint accepts the JSON payload to format and can optionally apply a numeric indentation level or minify the output.

Request Body

ParameterTypeMandatoryDescription
textStringYesThe JSON text to format.
indentNumber
ENUM
NoFormatting mode for the output.
- Number: indentation level from 0 to 8
- minify: removes whitespace

Response

A successful call returns a JSON object with these fields:

ParameterTypeDescription
toolStringName of the tool that produced the response.
validBooleantrue if the input is valid JSON.
formattedStringThe formatted JSON. Present only when valid is true.
statsObjectStructure statistics. Present only when valid is true.
stats.keysNumberTotal number of keys.
stats.depthNumberMaximum nesting depth.
errorStringParse error message. Present only when valid is false.

If the input is not valid JSON, valid is false and error explains the problem.

▣ ENDPOINT 03 / 03
POST
Regex Match Tester
https://api.eu.apyhub.com/freedailypro/code-data-formatting-api/security/regex

QUICKSTART

GUIDE

Quickstart

Check whether a text matches a regular expression pattern.

curl -X POST "https://api.eu.apyhub.com/freedailypro/code-data-formatting-api/security/regex" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "pattern": "^\\d{3}-\\d{2}-\\d{4}quot;,
    "text": "123-45-6789"
  }'

What you'll get back

The live response to the request above:

{
  "tool": "Regex tester client and server side from freedailypro",
  "valid": true,
  "matches": [
    "123-45-6789"
  ],
  "matchCount": 1
}
TRY ITLIVE · 10 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
body*

About this endpoint

What it does

Tests a regular expression against a piece of text and returns every match and the number of matches. It uses JavaScript regex syntax and supports flags such as g, i and m. If the pattern is invalid, the response says so with valid: false and an error message instead of failing. Use it to check patterns before using them in code, or to extract values from text.

Request Body

ParameterTypeMandatoryDescription
patternStringYesThe regular expression pattern to test.
textStringYesThe text to evaluate against the pattern.
flagsStringNoRegular expression flags. Default: g (all matches). Your value replaces the default, so include g to get all matches, e.g. gi.

Response

A successful call returns a JSON object with these fields:

ParameterTypeDescription
toolStringName of the tool that produced the response.
validBooleantrue if the pattern is a valid regular expression.
matchesArray of String or AnyAll matches found in the text.
matchCountNumberNumber of matches.
errorStringError message. Present only when valid is false.
▣ COMMON ERRORS

Errors any endpoint can return

400bad_request

Required parameter missing or malformed body.

401unauthorized

API key missing, revoked, or not authorized for this service.

429rate_limited

Your plan's per-second rate exceeded. Retry with exponential backoff.

503upstream_busy

Backend temporarily unavailable. Try again in a few seconds.