---
title: "Code & Data Formatting API"
slug: code-data-formatting-api
url: https://apyhub.com/freedailypro/service/code-data-formatting-api
provider: FreeDailyPro
tags: [json-formatter, minifier, regex, code-formatting, developer-tools]
auth: api_key
version: 1.0.0
service_type: sync
endpoints: 3
atoms: 10
mcp: true
---

# Code & Data Formatting API

Easily format JSON, test regex and minify code using the Code & Data Formatting API. Validate JSON and minify CSS and JavaScript.

## Endpoints

| Method | URL | Description | Atoms |
| --- | --- | --- | --- |
| POST | `https://api.eu.apyhub.com/freedailypro/code-data-formatting-api/security/minify` | What it does Minifies CSS or JavaScript code by removing comments and unnecessary whitespace. The r… | 10 |
| POST | `https://api.eu.apyhub.com/freedailypro/code-data-formatting-api/security/json-format` | What it does Formats JSON text sent in the request body. The endpoint accepts the JSON payload to f… | 10 |
| POST | `https://api.eu.apyhub.com/freedailypro/code-data-formatting-api/security/regex` | What it does Tests a regular expression against a piece of text and returns every match and the num… | 10 |

## Endpoint reference

### CSS & JavaScript Minifier

`POST https://api.eu.apyhub.com/freedailypro/code-data-formatting-api/security/minify` · 10 atoms · accepts `application/json` · returns `application/json`

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `code` | body | string | yes |  |
| `type` | body | string | yes | One of: css, js. |

#### Quickstart

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

```bash
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:

```json
{
  "tool": "Css js minifier client and server side from freedailypro",
  "type": "js",
  "result": "function greet(name) { console.log(\"Hello, \" + name); }"
}
```

### JSON Formatter & Validator

`POST https://api.eu.apyhub.com/freedailypro/code-data-formatting-api/security/json-format` · 10 atoms · accepts `application/json` · returns `application/json`

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `text` | body | string | yes |  |
| `indent` | body | any | no |  |

#### Quickstart

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

```bash
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:

```json
{
  "tool": "Json formatter client and server side from freedailypro",
  "valid": true,
  "formatted": "{\n  \"name\": \"ApyHub\",\n  \"active\": true\n}",
  "stats": {
    "keys": 2,
    "depth": 2
  }
}
```

### Regex Match Tester

`POST https://api.eu.apyhub.com/freedailypro/code-data-formatting-api/security/regex` · 10 atoms · accepts `application/json` · returns `application/json`

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `text` | body | string | yes |  |
| `flags` | body | string | no |  |
| `pattern` | body | string | yes |  |

#### Quickstart

Check whether a text matches a regular expression pattern.

```bash
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}$",
    "text": "123-45-6789"
  }'
```

#### What you'll get back

The live response to the request above:

```json
{
  "tool": "Regex tester client and server side from freedailypro",
  "valid": true,
  "matches": [
    "123-45-6789"
  ],
  "matchCount": 1
}
```

## About

## 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.

## Usage

Base URL: `https://api.eu.apyhub.com` (default region — see
`GET https://apyhub.com/api/public/regions` for the rest).

Authenticate with an ApyHub API key in the `apy-token` header.
Full docs and a live playground: https://apyhub.com/freedailypro/service/code-data-formatting-api
