Volver al sitio

API Documentation

Integrate YAMLforge conversion capabilities directly into your applications. Our REST API provides fast, reliable YAML/JSON conversion with anchor and comment preservation.

Quick Start

1. Get API Key

Sign up for a free account and generate your API key from the dashboard.

2. Make Requests

Send POST requests to our API endpoints with your data and credentials.

3. Get Results

Receive converted data instantly with full metadata and error handling.

Authentication

All API requests require authentication using a Bearer token. Include your API key in the Authorization header:

Authorization: Bearer YOUR_API_KEY

Rate Limits

PlanRequests/HourMax File SizeFeatures
Free1001 MBBasic conversion
Pro10,00010 MBFull features + Priority support
EnterpriseUnlimited100 MBCustom + SLA

Endpoints

POST/api/convert

Convert between YAML and JSON formats

Request Body

{
  "input": "name: John\nage: 30",
  "inputType": "yaml",
  "outputType": "json",
  "preserveComments": true,
  "preserveAnchors": true
}

Response

{
  "success": true,
  "output": "{\n  \"name\": \"John\",\n  \"age\": 30\n}",
  "metadata": {
    "inputSize": 21,
    "outputSize": 32,
    "processingMs": 5,
    "anchorsCount": 0,
    "commentsCount": 0
  }
}
POST/api/validate

Validate YAML or JSON syntax

Request Body

{
  "input": "name: John\nage: 30",
  "type": "yaml"
}

Response

{
  "success": true,
  "valid": true,
  "errors": []
}
GET/api/health

Check API health status

Response

{
  "status": "healthy",
  "version": "1.0.0",
  "uptime": 86400
}

Code Examples

cURL
curl -X POST https://yamlforge.dev/api/convert \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "input": "name: John\nage: 30",
    "inputType": "yaml",
    "outputType": "json"
  }'
JavaScript
const response = await fetch('https://yamlforge.dev/api/convert', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer YOUR_API_KEY'
  },
  body: JSON.stringify({
    input: 'name: John\nage: 30',
    inputType: 'yaml',
    outputType: 'json'
  })
});

const data = await response.json();
console.log(data.output);
Python
import requests

response = requests.post(
    'https://yamlforge.dev/api/convert',
    headers={
        'Content-Type': 'application/json',
        'Authorization': 'Bearer YOUR_API_KEY'
    },
    json={
        'input': 'name: John\nage: 30',
        'inputType': 'yaml',
        'outputType': 'json'
    }
)

data = response.json()
print(data['output'])

Ready to get started?

Create a free account and start using the API today.