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
| Plan | Requests/Hour | Max File Size | Features |
|---|---|---|---|
| Free | 100 | 1 MB | Basic conversion |
| Pro | 10,000 | 10 MB | Full features + Priority support |
| Enterprise | Unlimited | 100 MB | Custom + SLA |
Endpoints
POST
/api/convertConvert 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/validateValidate YAML or JSON syntax
Request Body
{
"input": "name: John\nage: 30",
"type": "yaml"
}Response
{
"success": true,
"valid": true,
"errors": []
}GET
/api/healthCheck 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.