Documentación
Todo lo que necesitas para integrar DocumenTo.MD
Quickstart
-
1
Crea una cuenta en documento.md y entra al dashboard.
-
2
Genera una API Key desde Dashboard → API Keys. Copia el valor completo (solo se muestra una vez).
-
3
Haz tu primera llamada usando el header
Authorization: Bearer dtmd_live_...
Autenticación
Todas las peticiones a /v1/* requieren una API Key. Usa Bearer token (preferido) o el header X-API-Key:
# Preferido Authorization: Bearer dtmd_live_xxxxxxxxxxxxx # Alternativa X-API-Key: dtmd_live_xxxxxxxxxxxxx
⚠️ Las peticiones sin API Key reciben 401 missing_api_key.
POST /v1/convert
Convierte un documento a Markdown. Sube el archivo como multipart/form-data.
cURL
curl -X POST "https://documento.md/v1/convert" \ -H "Authorization: Bearer dtmd_live_xxxxx" \ -F "file=@documento.pdf" \ -F "wait=true"
Python
import requests with open("documento.pdf", "rb") as f: resp = requests.post( "https://documento.md/v1/convert", headers={"Authorization": "Bearer dtmd_live_xxxxx"}, files={"file": f}, data={"wait": "true"}, ) print(resp.json()["markdown"])
Node.js
const form = new FormData(); form.append("file", fs.createReadStream("documento.pdf")); form.append("wait", "true"); const resp = await fetch("https://documento.md/v1/convert", { method: "POST", headers: { Authorization: "Bearer dtmd_live_xxxxx" }, body: form, });
Parámetros: file (obligatorio), output=markdown, wait=true|false.
GET /v1/conversions/{id}
Consulta el estado de una conversión asíncrona:
curl "https://documento.md/v1/conversions/{id}" \ -H "Authorization: Bearer dtmd_live_xxxxx"
Respuesta
{
"id": "conv_123",
"status": "completed",
"markdown": "# Resultado...",
"download_url": "https://documento.md/v1/conversions/conv_123/download"
}
GET /v1/me
Inspecciona tu key, plan y uso actual:
{
"user_id": "usr_123",
"plan": "free",
"limits": { "rate_limit_per_minute": 5, "daily_conversions": 50 },
"usage": { "conversions_today": 12, "remaining_today": 38 }
}
Formatos soportados
csv
docx
html
md
pdf
pptx
rtf
txt
xlsx
Rate limiting
Cada respuesta incluye estos headers:
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 42
X-RateLimit-Reset: 1710000000
# Solo cuando se excede:
Retry-After: 30
| Plan | Por minuto | Por día | Max archivo |
|---|---|---|---|
| Free | 5 | 50 | 10 MB |
| Pro | 60 | 5.000 | 50 MB |
| Enterprise | 300 | 50.000 | 200 MB |
Códigos de error
Todos los errores usan el mismo formato JSON:
{
"error": {
"code": "invalid_file_type",
"message": "File type not allowed.",
"details": { "allowed_extensions": ["pdf", "docx", ...] }
}
}
missing_api_key
401
invalid_api_key
401
revoked_api_key
401
disabled_api_key
401
email_not_verified
403
forbidden
403
user_suspended
403
ip_not_allowed
403
origin_not_allowed
403
rate_limit_exceeded
429
daily_limit_exceeded
429
monthly_limit_exceeded
429
missing_file
400
file_too_large
413
invalid_file_type
415
invalid_mime_type
415
conversion_failed
422
conversion_timeout
504
conversion_not_found
404
result_expired
410
api_disabled
503
internal_error
500
not_implemented
501
validation_error
422
Privacidad y retención
- ✓ Los archivos originales no se guardan después de la conversión.
- ✓ Los resultados se retienen 24 horas y luego expiran.
- ✓ Puedes borrar un resultado en cualquier momento con
DELETE /v1/conversions/{id}. - ✓ Las API Keys se almacenan hasheadas (sha256), nunca en texto plano.