Rename Endpoints
AI-powered endpoints to rename PDF files and scanned images. Extract metadata like vendor names, dates, and document types to generate clean, consistent filenames.
Endpoint – Rename a file
POST /api/v1/renameRequest
Upload a PDF file or scanned image (JPG, PNG, TIFF) using multipart form-data. The service automatically analyzes the document content to extract metadata (vendor names, dates, invoice numbers, amounts, document types) and generates a descriptive filename. Scanned images use OCR to extract text content.
Request fields:
| Field | Type | Required | Description |
|---|---|---|---|
file | File | Yes | Max 25 MB. PDF files or scanned images (JPG, PNG, TIFF). The service analyzes the document content to extract metadata and generate the filename. Scanned images use OCR to extract text. |
strategy | string | No | Organization strategy for folder structure. See Organization Strategies section below for details. |
templateMode | string | No | Template selection mode. See Template Modes section below for details. Default: auto. |
templateId | string | No | Predefined template ID (required when templateMode=predefined). |
customTemplate | string | No | AI prompt for custom filename generation (required when templateMode=custom). Write natural language instructions describing how filenames should be formatted. Example: "Use format: YYYY-MM-DD_company-name_document-type_number" |
language | string | No | Output language for generated filenames. The service will use the specified language for issuer names and other text. Default: auto. See Language Options section below for all supported languages. |
Language Examples
Here are examples showing how filenames differ based on the language parameter:
// Request
POST /api/v1/rename
language=en
// Result
{
"suggestedFilename": "2025-01-15_AcmeCorp_Invoice_12345.pdf",
"folderPath": "2025/AcmeCorp"
}Common Mistakes
Got code: INVALID_MULTIPART_PAYLOAD?
This error means your request body could not be parsed as multipart/form-data. Common causes:
- Sending JSON body instead of form data (check Content-Type).
- Incorrect field name (must be exactly
file). - Missing filename or content-type in multipart payload (common in Python/Node.js).
- Using a proxy that modifies the request body.
Successful response (200)
The service analyzes your PDF file and returns a response with the generated filename based on extracted metadata:
{
"originalFilename": "invoice.pdf",
"suggestedFilename": "2025-01-15_invoice_1234_acme.pdf",
"folderPath": "2025/AcmeCorp/Invoices"
}Response Fields
originalFilename – The original filename as uploaded.
suggestedFilename – The generated filename with file extension. Created by analyzing the PDF content and extracting metadata like vendor name, date, invoice number, and document type.
folderPath – The suggested folder structure using forward slashes (/) as separators. Examples: 2025/AcmeCorp/Invoices or 2025/Invoices. This field will be an empty string ("") when the organization strategy is root or when no folder structure is needed. Folder names are sanitized to be filesystem-safe (special characters removed, length limited).
Organization Strategies
Organization strategies determine how files are organized into folder structures. The folder path uses forward slashes (/) as separators.
| Strategy | Description | Example Folder Path |
|---|---|---|
by_date | Organize by year | 2025 |
by_issuer | Organize by company/issuer | AcmeCorp |
by_type | Organize by document type | Invoices |
by_date_issuer | Year/Company | 2025/AcmeCorp |
by_date_type | Year/Document Type | 2025/Invoices |
by_issuer_type | Company/Document Type | AcmeCorp/Invoices |
by_all | Year/Company/Document Type | 2025/AcmeCorp/Invoices |
root | No folder structure (flat organization) | "" (empty string) |
follow_custom_prompt | Follow custom template instructions for folder structure | Varies based on custom template |
Template Modes
Template modes control how filenames are generated. Choose the mode that best fits your needs:
auto (Default)
AI automatically selects the best naming pattern based on document content and research-based best practices. Ideal for most use cases.
When to use: General purpose file renaming, when you want professional results without specifying format.
predefined
Use a predefined template with a specific structure. Requires templateId field.
Available templates: standard, date_first, company_first, minimal, detailed, department_focus.
When to use: When you need consistent, structured filenames following a specific pattern.
custom
Provide natural language instructions for filename generation. Requires customTemplate field with your instructions.
Example: "Use format: YYYY-MM-DD_company-name_document-type_number"
When to use: When you need specific formatting that doesn't match predefined templates or want to customize naming rules.
Language Options
Control the language used for generated filenames and folder names. The service will use the specified language for issuer names and other text extracted from documents. Document type names remain in English (e.g., "Invoice", "Receipt"), but company names, vendor names, and other metadata will be formatted in the selected language.
| Code | Language | Notes |
|---|---|---|
auto | Auto-detect | Default |
source | Document's source language | Uses language detected from document |
en | English | — |
de | Deutsch (German) | — |
fr | Français (French) | — |
es | Español (Spanish) | — |
it | Italiano (Italian) | — |
pt | Português (Portuguese) | — |
pt-BR | Português (Brasil) | — |
nl | Nederlands (Dutch) | — |
pl | Polski (Polish) | — |
sv | Svenska (Swedish) | — |
no | Norsk (Norwegian) | — |
da | Dansk (Danish) | — |
fi | Suomi (Finnish) | — |
cs | Čeština (Czech) | — |
tr | Türkçe (Turkish) | — |
zh-Hans | 简体中文 (Simplified Chinese) | — |
zh-Hant | 繁體中文 (Traditional Chinese) | — |
ja | 日本語 (Japanese) | — |
ko | 한국어 (Korean) | — |
ar | العربية (Arabic) | — |
hi | हिन्दी (Hindi) | — |
id | Bahasa Indonesia | — |
Error responses
| Status | Code | Description |
|---|---|---|
| 401 | unauthorized | Missing / invalid credentials or free batch exhausted. |
| 402 | payment_required | Account has 0 credits. |
| 413 | payload_too_large | File exceeds 25 MB limit. |
| 415 | unsupported_media_type | File type not supported. Only PDF files and scanned images (JPG, PNG, TIFF) are accepted. |
| 500 | server_error | Unhandled processing error. |
Error responses follow this format:
Python File Upload Requirements
Important: Python File Upload Format
When using Python's requests library, you must explicitly specify the filename and content-type when uploading files. The server requires this information to properly identify the file type.
Correct:
files = {'file': ('filename.pdf', file_handle, 'application/pdf')}Incorrect (will cause 415 error):
files = {'file': file_handle} # Missing filename and content-typeIf you don't specify the filename and content-type, you'll receive a 415 Unsupported Media Type error with the message: "File type not supported. Only PDF files and scanned images (JPG, PNG, TIFF) are accepted."
Code Examples
Production-ready examples with error handling, validation, and timeout support. The service automatically analyzes uploaded PDF files and scanned images to extract metadata and generate filenames. Choose the example that matches your environment:
Browser vs Node.js: Use browser examples for client-side applications and file uploads from user input. Use Node.js examples for server-side processing, batch operations, and automation scripts.
# Rename a messy invoice file
# The service analyzes the PDF content and extracts metadata (vendor, date, invoice number)
curl -X POST https://www.renamed.to/api/v1/rename \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-F file=@"Invoice_scan_IMG_20251215.pdf" \
-F strategy="by_date_issuer" \
-F language="en"
# Response:
# {
# "originalFilename": "Invoice_scan_IMG_20251215.pdf",
# "suggestedFilename": "2025-12-15_invoice_acme_corp_inv-12345.pdf",
# "folderPath": "2025/AcmeCorp/Invoices"
# }
# Use custom AI prompt for filename generation
curl -X POST https://www.renamed.to/api/v1/rename \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-F file=@"invoice.pdf" \
-F templateMode="custom" \
-F customTemplate="Use format: YYYY-MM-DD_company-name_document-type_number"Endpoint – Rename a file from URL
POST /api/v1/rename-from-urlRequest
Provide a publicly accessible URL to a PDF file. The service downloads the file, analyzes its content to extract metadata (vendor names, dates, invoice numbers, amounts, document types), and generates a descriptive filename. This endpoint is ideal for automation workflows where files are already hosted online.
Note: This endpoint requires authentication (API token or session). Credits are only deducted after successful processing to avoid charging for failed downloads or invalid files.
Request body (JSON):
| Field | Type | Required | Description |
|---|---|---|---|
fileUrl | string | Yes | Publicly accessible HTTP or HTTPS URL to a PDF file. Max 25 MB. Must not point to localhost or private network addresses. The service downloads and analyzes the PDF content to extract metadata and generate the filename. |
originalFilename | string | No | Optional filename override. If not provided, the filename is derived from the URL pathname. |
strategy | string | No | Organization strategy for folder structure. See Organization Strategies section in the Rename endpoint documentation for details. |
templateMode | string | No | Template selection mode. See Template Modes section in the Rename endpoint documentation for details. Default: auto. |
templateId | string | No | Predefined template ID (required when templateMode=predefined). |
customTemplate | string | No | AI prompt for custom filename generation (required when templateMode=custom). Write natural language instructions describing how filenames should be formatted. Example: "Use format: YYYY-MM-DD_company-name_document-type_number" |
language | string | No | Output language for generated filenames. The service will use the specified language for issuer names and other text. Default: auto. See Language Options section in the Rename endpoint documentation for all supported languages. |
Successful response (200)
The service downloads the PDF file from the provided URL, analyzes its content, and returns a response with the generated filename based on extracted metadata. The response format is identical to the Rename endpoint.
{
"originalFilename": "invoice.pdf",
"suggestedFilename": "2025-01-15_invoice_1234_acme.pdf",
"folderPath": "2025/AcmeCorp/Invoices"
}Error responses
| Status | Code | Description |
|---|---|---|
| 400 | invalid_url | Invalid URL format, URL points to localhost/private network, or URL does not use HTTP/HTTPS. |
| 401 | unauthorized | Missing or invalid credentials. |
| 402 | payment_required | Account has insufficient credits. |
| 413 | payload_too_large | File exceeds 25 MB limit. |
| 415 | unsupported_media_type | File type not supported. Only PDF files and scanned images (JPG, PNG, TIFF) are accepted. |
| 429 | rate_limit_exceeded | Daily rename limit exceeded. Check Retry-After header. |
| 502 | bad_gateway | Failed to download file from URL or DNS resolution failed. |
| 500 | server_error | Unhandled processing error. |
Security & URL validation
URL Security Restrictions
For security reasons, the service blocks URLs that point to:
- Localhost addresses (127.0.0.1, ::1, localhost)
- Private network addresses (10.x.x.x, 192.168.x.x, 172.16-31.x.x)
- Link-local addresses (169.254.x.x)
- IPv6 unique local addresses (fc00::/7, fd00::/7)
Only publicly accessible HTTP and HTTPS URLs are accepted. The service performs DNS resolution and IP address validation before downloading files.
Code Examples
Production-ready examples with error handling and validation. The service downloads the PDF from the URL, analyzes its content, and generates a filename:
# Rename a PDF file from a public URL
curl -X POST https://www.renamed.to/api/v1/rename-from-url \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"fileUrl": "https://example.com/invoices/invoice_2025.pdf",
"strategy": "by_date_issuer",
"language": "en"
}'Use Cases
Automation Workflows: Integrate with Zapier, Make, or n8n to automatically rename files from cloud storage URLs or webhook payloads.
Batch Processing: Process multiple files from a list of URLs without manually downloading and uploading each file.
Webhook Integration: Receive file URLs from external services and rename them automatically as part of your workflow.
Cloud Storage: Rename files that are already stored in S3, Google Cloud Storage, or other cloud providers by providing their public URLs.