← All tool references

Developer Tools · not_available

SVG Optimizer

SVG Optimizer with transparent inputs and reviewable results.

Open public tool

Overview

Category
Developer Tools
API mode
not_available
Processing
client-side
Privacy
no-data-stored

Public descriptor

The descriptor is available without an API key and supplies this tool’s metadata, schemas, modes, and examples.

GET /api/v1/tools/svg-optimizer

View this descriptor as JSON

Execute availability

This tool is documented as a browser capability. Its execute route does not produce a server-side result; when execution is enabled, it responds with browser_interaction_required and points callers to the public tool page.

POST /api/v1/tools/svg-optimizer/execute

Authentication is not issued during the preview. A bearer API key is planned for execution after launch.

Input schema

object object; additional properties are not accepted.

svg · string · required
Enter svg source.
remove_comments · string · required
Enter remove comments. Accepted values: yes, no.
collapse_whitespace · string · required
Enter collapse whitespace. Accepted values: yes, no.
{
    "type": "object",
    "properties": {
        "svg": {
            "type": "string",
            "description": "Enter svg source."
        },
        "remove_comments": {
            "type": "string",
            "description": "Enter remove comments.",
            "enum": [
                "yes",
                "no"
            ]
        },
        "collapse_whitespace": {
            "type": "string",
            "description": "Enter collapse whitespace.",
            "enum": [
                "yes",
                "no"
            ]
        }
    },
    "required": [
        "svg",
        "remove_comments",
        "collapse_whitespace"
    ],
    "additionalProperties": false
}

Output schema

On a successful execution, schema values appear in data.result.values.

optimized · string
Optimized SVG produced by the tool.
bytes_before · number
Bytes before produced by the tool.
bytes_after · number
Bytes after produced by the tool.
savings · number
Size reduction produced by the tool.
{
    "type": "object",
    "properties": {
        "optimized": {
            "type": "string",
            "description": "Optimized SVG produced by the tool."
        },
        "bytes_before": {
            "type": "number",
            "description": "Bytes before produced by the tool."
        },
        "bytes_after": {
            "type": "number",
            "description": "Bytes after produced by the tool."
        },
        "savings": {
            "type": "number",
            "description": "Size reduction produced by the tool."
        }
    },
    "additionalProperties": false
}

SVG Optimizer worked example

The request body follows the published input schema. The response below shows the success-envelope shape returned after execution is available.

curl -X POST "https://utilitypages.org/api/v1/tools/svg-optimizer/execute" \
  -H "Content-Type: application/json" \
  -d '{
    "svg": "<svg viewBox=\"0 0 100 100\"><!-- demo --><circle cx=\"50\" cy=\"50\" r=\"40\" fill=\"#2288cc\" /></svg>",
    "remove_comments": "yes",
    "collapse_whitespace": "yes"
}'
{
    "ok": true,
    "data": {
        "slug": "svg-optimizer",
        "result": {
            "values": {
                "optimized": "<svg viewBox=\"0 0 100 100\"><circle cx=\"50\" cy=\"50\" r=\"40\" fill=\"#2288cc\" /></svg>",
                "bytes_before": 94,
                "bytes_after": 81,
                "savings": 13.8300000000000000710542735760100185871124267578125
            },
            "display": {
                "display": "<svg viewBox=\"0 0 100 100\"><circle cx=\"50\" cy=\"50\" r=\"40\" fill=\"#2288cc\" /></svg>"
            },
            "warnings": [],
            "assumptions": [],
            "steps": []
        }
    },
    "meta": [],
    "request_id": "req_example_123"
}

Errors

api_not_launched · 503
Returned by the current launch gate for every execute request.
invalid_json · 400
Returned when an enabled execute request does not contain valid JSON.
validation_failed · 422
Returned when a request does not satisfy the input schema.
browser_interaction_required · 422
Returned for browser capability tools instead of inventing a server-side result.
tool_not_found · 404
Returned when a requested descriptor slug does not exist.
execution_failed · 503
Returned when an enabled server-side execution cannot complete.