API Reference & Troubleshooting
Error codes, rate limits, troubleshooting guides, and frequently asked questions. Everything you need to debug and optimize your API integration.
Use Case Examples
Real-world examples showing how to integrate the Renamed.to API into common workflows. Each example includes complete code samples you can adapt for your needs.
1. Automated Invoice Processing
Process invoices from email attachments or file uploads, automatically organizing them by vendor and date for accounting software integration.
async function processInvoice(file: File) {
const formData = new FormData();
formData.append('file', file);
formData.append('strategy', 'by_date_issuer'); // Organize by year/vendor
formData.append('templateMode', 'predefined');
formData.append('templateId', 'standard'); // YYYY-MM-DD_Vendor_INV-Number.pdf
const response = await fetch('https://www.renamed.to/api/v1/rename', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.RENAMED_TO_API_TOKEN}`
},
body: formData
});
if (!response.ok) {
throw new Error(`API error: ${response.status}`);
}
const result = await response.json();
// Example result:
// {
// "originalFilename": "invoice.pdf",
// "suggestedFilename": "2025-01-15_AcmeCorp_INV-12345.pdf",
// "folderPath": "2025/AcmeCorp",
// "confidence": 0.96
// }
return result;
}2. Legal Document Organization
Organize legal contracts and discovery documents by matter code, counterparty, and document type for compliance and easy retrieval.
3. Multi-language Filename Generation
Generate filenames in specific languages for international document management. Document types remain in English, but issuer names and other text use the specified language.
async function renameWithLanguage(file: File, language: string) {
const formData = new FormData();
formData.append('file', file);
formData.append('language', language); // 'de', 'fr', 'es', etc.
formData.append('strategy', 'by_date_issuer');
const response = await fetch('https://www.renamed.to/api/v1/rename', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.RENAMED_TO_API_TOKEN}`
},
body: formData
});
const result = await response.json();
// With language='de':
// {
// "originalFilename": "rechnung.pdf",
// "suggestedFilename": "2025-01-15_Musterfirma_Rechnung_12345.pdf",
// "folderPath": "2025/Musterfirma",
// "confidence": 0.95
// }
return result;
}
// Process files for different regions
const files = [
{ file: germanInvoice, language: 'de' },
{ file: frenchInvoice, language: 'fr' },
{ file: spanishInvoice, language: 'es' }
];
for (const { file, language } of files) {
const result = await renameWithLanguage(file, language);
console.log(`Renamed (${language}): ${result.suggestedFilename}`);
}4. Receipt Management for Expense Reports
Automatically rename receipts with date, vendor, and amount for easy expense report preparation and reconciliation.
5. Webhook Integration Pattern
Process files uploaded via webhook from cloud storage services, automatically renaming and organizing them.
Have a specific use case? Check our full documentation or contact support for integration assistance.
Error Handling
The API uses standard HTTP status codes and returns errors in a consistent JSON format. All errors include an error field with a human-readable message.
Standard Error Response Format
All error responses follow this structure:
{
"error": "Error message describing what went wrong"
}HTTP Status Codes
| Status Code | Meaning | Retryable | Example |
|---|---|---|---|
| 400 | Bad Request – Invalid input or malformed request | No | Missing required field, invalid file type |
| 401 | Unauthorized – Missing or invalid authentication | No | Invalid or expired API token |
| 402 | Payment Required – Insufficient credits | No | Account has 0 credits |
| 404 | Not Found – Resource doesn't exist | No | User not found, file not found |
| 413 | Payload Too Large – File exceeds size limit | No | File larger than 25 MB |
| 415 | Unsupported Media Type – Invalid file type | No | Non-PDF file uploaded, or Python requests missing filename/content-type |
| 429 | Too Many Requests – Rate limit exceeded | Yes (with backoff) | Too many requests in time window |
| 500 | Internal Server Error – Server-side error | Yes (with backoff) | Processing failure, external service error |
| 502 | Bad Gateway – External service error | Yes (with backoff) | AI service unavailable, storage service error |
Error Response Examples
{
"error": "No file uploaded."
}Retry Logic
Some errors are transient and can be retried. Follow these guidelines:
Retryable Errors
- 429 (Rate Limited): Retry after the time specified in
Retry-Afterheader orX-RateLimit-Resettimestamp - 500 (Server Error): Retry with exponential backoff (1s, 2s, 4s, 8s, 16s)
- 502 (Bad Gateway): Retry with exponential backoff (1s, 2s, 4s, 8s, 16s)
Non-Retryable Errors
- 400 (Bad Request): Fix the request before retrying
- 401 (Unauthorized): Check authentication credentials
- 402 (Payment Required): Add credits to your account
- 404 (Not Found): Resource doesn't exist, don't retry
- 413 (Payload Too Large): Reduce file size
- 415 (Unsupported Media Type): Use a supported file type (PDF files or scanned images: JPG, PNG, TIFF)
Idempotency
API requests are not idempotent by default. Each request consumes credits and processes files. If you need to retry a failed request:
- For 429 (Rate Limited) errors: Wait for the specified time, then retry the same request
- For 500/502 errors: Retry the same request with exponential backoff. Credits are only consumed on successful processing
- For 402 (Insufficient Credits): Add credits before retrying
- Note: If a file processing request fails after credits are deducted, credits are not automatically refunded. Contact support if you believe credits were incorrectly consumed.
Error Handling Best Practices
async function renameFileWithRetry(file: File, maxRetries = 3) {
let lastError: Error | null = null;
for (let attempt = 0; attempt < maxRetries; attempt++) {
try {
const formData = new FormData();
formData.append('file', file);
const response = await fetch('https://www.renamed.to/api/v1/rename', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.RENAMED_TO_TOKEN}`
},
body: formData
});
if (response.ok) {
return await response.json();
}
const error = await response.json();
// Don't retry non-retryable errors
if ([400, 401, 402, 404, 413, 415].includes(response.status)) {
throw new Error(`Non-retryable error: ${error.error}`);
}
// Handle rate limiting
if (response.status === 429) {
const retryAfter = response.headers.get('Retry-After');
const waitTime = retryAfter ? parseInt(retryAfter) * 1000 : Math.pow(2, attempt) * 1000;
console.log(`Rate limited. Waiting ${waitTime}ms before retry...`);
await new Promise(resolve => setTimeout(resolve, waitTime));
continue;
}
// Retry server errors with exponential backoff
if ([500, 502].includes(response.status)) {
const waitTime = Math.pow(2, attempt) * 1000; // 1s, 2s, 4s
console.log(`Server error. Waiting ${waitTime}ms before retry...`);
await new Promise(resolve => setTimeout(resolve, waitTime));
continue;
}
throw new Error(`Unexpected error: ${error.error}`);
} catch (error) {
lastError = error instanceof Error ? error : new Error(String(error));
if (attempt === maxRetries - 1) {
throw lastError;
}
}
}
throw lastError || new Error('Max retries exceeded');
}Troubleshooting
Common issues and solutions when working with the Renamed.to API. If you encounter problems not covered here, contact support for assistance.
Common Issues and Solutions
Invalid Multipart Payload (400 Bad Request)
Problem:
Receiving 400 Bad Request with error code INVALID_MULTIPART_PAYLOAD.
Possible Causes:
- Sending JSON payload instead of
multipart/form-data - Using an incorrect field name (must be
file) - Missing filename or content-type in the multipart boundary (common in Python/Node.js)
- Using a proxy or middleware that modifies the request body
Solution:
Ensure your HTTP client is correctly configured to send multipart/form-data. Do not manually set the Content-Type header unless you know the correct boundary string; most clients set this automatically when you provide a file object.
415 Unsupported Media Type (Python)
Problem:
Receiving 415 Unsupported Media Type error when uploading files with Python.
Solution:
Ensure you're including the filename and content-type when uploading files:
import requests
import os
with open('document.pdf', 'rb') as f:
# Include filename and content-type
files = {'file': ('document.pdf', f, 'application/pdf')}
headers = {'Authorization': f'Bearer {os.getenv("RENAMED_TO_TOKEN")}'}
response = requests.post(
'https://www.renamed.to/api/v1/rename',
files=files,
headers=headers
)
response.raise_for_status()See the Python File Upload Requirements section for more details.
401 Unauthorized on User/Credits/Team Endpoints
Problem:
Receiving 401 Unauthorized errors on /api/v1/user, /api/v1/credits, or /api/v1/team endpoints.
Possible Causes:
- Invalid or expired API token
- Missing Authorization header
- Incorrect token format (should be
Bearer <token>) - For team endpoint: Account may not be part of a team (endpoint returns
nullif not in a team)
Solution:
- Verify your API token is correct and not expired
- Ensure the Authorization header is included:
Authorization: Bearer rt_your_token_here - For team endpoint: Verify your account is part of a team (endpoint returns
nullif not in a team, not a 401 error)
File Upload Not Working
Problem:
File uploads fail or return unexpected errors.
Checklist:
- ✅File is a PDF (not other formats)
- ✅File size is under 25 MB
- ✅Using multipart/form-data encoding
- ✅For Python: Including filename and content-type in file upload (see Python File Upload Requirements)
- ✅API token is correct and not expired
- ✅Request includes
Authorization: Bearer <token>header
Rate Limit Errors
Problem:
Receiving 429 Too Many Requests errors.
Solution:
- Wait for the rate limit window to reset (check the Retry-After header)
- Implement exponential backoff in your retry logic
- Consider batching requests or reducing request frequency
- Contact support if you need higher rate limits
See the Error Handling section for retry logic examples.
Insufficient Credits
Problem:
Receiving 402 Payment Required errors, or cloud integration jobs are paused due to insufficient credits.
Solution:
- Check your credit balance using the
/api/v1/creditsendpoint - Purchase additional credits through your account settings
- Automatic retry: For cloud integrations (OneDrive, Dropbox, Google Drive), jobs that were paused due to insufficient credits will automatically resume processing when you add credits. No manual intervention needed.
- Note: Jobs older than 30 days will not be automatically retried. You can manually retry these if needed.
- Monitor credit usage to avoid running out
Still having issues? Contact support with details about your error, including the HTTP status code, error message, and your request details (without sensitive information like API tokens).
Limits & Quotas
The following limits apply to all API requests. Limits are enforced per account and reset on a rolling 24-hour window.
| Limit Type | Value | Notes |
|---|---|---|
| Daily Renames | 10,000 / 24h | Soft limit per account. Contact us for higher limits. |
| File Size | 25 MB | Maximum file size per upload. |
| Concurrent Requests | 20 | Maximum simultaneous requests per account. |
| Rate Limit Burst | 200 / minute | Maximum requests per minute before throttling. |
Rate Limiting
Rate limits use rolling windows, not fixed daily limits. This means limits reset continuously based on when requests are made, not at midnight UTC.
Rate Limit Headers
All API responses include rate limit information in headers. Check these headers to monitor your usage and handle rate limits gracefully:
| Header | Description | Example |
|---|---|---|
X-RateLimit-Limit | Maximum number of requests allowed in the current window | 200 |
X-RateLimit-Remaining | Number of requests remaining in the current window | 150 |
X-RateLimit-Reset | Unix timestamp (milliseconds) when the current rate limit window resets | 1733925600000 |
Retry-After | Number of seconds to wait before retrying (only present on 429 responses) | 60 |
Handling Rate Limits
When you receive a 429 Too Many Requests response:
- Check the
Retry-Afterheader for the number of seconds to wait - Alternatively, calculate wait time from
X-RateLimit-Resettimestamp - Wait for the specified duration before retrying
- Implement exponential backoff if you continue to hit rate limits
Rate Limit Examples
const response = await fetch('https://www.renamed.to/api/v1/rename', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.RENAMED_TO_TOKEN}`
},
body: formData
});
// Read rate limit headers
const limit = response.headers.get('X-RateLimit-Limit');
const remaining = response.headers.get('X-RateLimit-Remaining');
const reset = response.headers.get('X-RateLimit-Reset');
console.log(`Rate limit: ${remaining}/${limit} remaining`);
console.log(`Resets at: ${new Date(parseInt(reset || '0')).toISOString()}`);
if (response.status === 429) {
const retryAfter = response.headers.get('Retry-After');
const waitSeconds = retryAfter ? parseInt(retryAfter) : 60;
console.log(`Rate limited. Wait ${waitSeconds} seconds before retrying.`);
}Need higher limits? Contact us to discuss custom rate limits for your use case.
Frequently Asked Questions
Common questions about the Renamed.to REST API for programmatic file renaming.
- How do I rename PDF files and scanned images using the API?
- Upload a PDF file or scanned image (JPG, PNG, TIFF) via POST /api/v1/rename endpoint with Bearer token authentication. The service extracts metadata and returns a suggested filename with vendor, date, invoice number, and other relevant information. Scanned images use OCR to extract text content.
- What file formats does the API support?
- The API supports PDF files and scanned images (JPG, PNG, TIFF) up to 25 MB in size. Metadata extraction works with both native PDFs and scanned documents. Scanned images use OCR (Optical Character Recognition) to extract text content.
- How many API calls can I make per day?
- The API is rate-limited to 10,000 renames per day per account. Rate limits reset daily at midnight UTC. See the Limits section for more details.
- Does the API support multiple languages?
- Yes, the API supports 20+ languages for filename generation, including English, German, French, Spanish, Japanese, Chinese, Arabic, and more. Document types remain in English (e.g., "Invoice", "Receipt"), but issuer names and other text use the specified language. See the Language Options section for the complete list.
- How do I get an API token?
- Generate API tokens in Settings → API Tokens. Tokens are shown only once when created—make sure to save them securely. See the Authentication section for details.
- How does automated file renaming work?
- Automated file renaming extracts metadata from PDF documents (like vendor names, dates, invoice numbers, amounts, document types) and generates descriptive, consistent filenames. The service analyzes document content, structure, and context to identify key information without manual configuration.
- Can I customize the filename format?
- Yes, you can use predefined templates or provide custom prompts to control filename generation. The API supports three template modes: auto (service selects best pattern), predefined (use standard templates), and custom (provide natural language instructions). See the Template Modes section for details.
- How accurate is the metadata extraction?
- The service achieves high accuracy for most document types. Each response includes a confidence score so you can validate results before applying them. The API processes millions of documents including invoices, receipts, contracts, and legal documents.
- What happens if I run out of credits?
If your account has 0 credits, API requests will return a
402 Payment Requirederror. You can check your credit balance using the Credits endpoint or purchase additional credits through your account settings.Cloud integrations (OneDrive, Dropbox, Google Drive): If you run out of credits while files are being processed, those jobs will be automatically paused and marked as "pending credits." When you add credits to your account (via purchase or admin grant), processing will automatically resume for all pending jobs. Jobs older than 30 days will not be automatically retried to avoid processing outdated files.
Have more questions? Check our Troubleshooting section or contact support for assistance.
Changelog
2025-11-11 – v1
- Changed configuration options from query parameters to POST body form fields (breaking change).
- Added
folderPathto rename response. - Added endpoints: GET /api/v1/user, GET /api/v1/credits, GET /api/v1/team. All endpoints support API token authentication.
- Enhanced documentation with examples for custom AI prompts and form fields.
2025-06-14 – v1 Initial Release
- Initial release – single
renameendpoint.
Continue exploring
Discover related documentation, integrations, and use cases