Documentation

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/rename

Request

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:

FieldTypeRequiredDescription
fileFileYesMax 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.
strategystringNoOrganization strategy for folder structure. See Organization Strategies section below for details.
templateModestringNoTemplate selection mode. See Template Modes section below for details. Default: auto.
templateIdstringNoPredefined template ID (required when templateMode=predefined).
customTemplatestringNoAI 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"
languagestringNoOutput 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.

StrategyDescriptionExample Folder Path
by_dateOrganize by year2025
by_issuerOrganize by company/issuerAcmeCorp
by_typeOrganize by document typeInvoices
by_date_issuerYear/Company2025/AcmeCorp
by_date_typeYear/Document Type2025/Invoices
by_issuer_typeCompany/Document TypeAcmeCorp/Invoices
by_allYear/Company/Document Type2025/AcmeCorp/Invoices
rootNo folder structure (flat organization)"" (empty string)
follow_custom_promptFollow custom template instructions for folder structureVaries 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.

CodeLanguageNotes
autoAuto-detectDefault
sourceDocument's source languageUses language detected from document
enEnglish
deDeutsch (German)
frFrançais (French)
esEspañol (Spanish)
itItaliano (Italian)
ptPortuguês (Portuguese)
pt-BRPortuguês (Brasil)
nlNederlands (Dutch)
plPolski (Polish)
svSvenska (Swedish)
noNorsk (Norwegian)
daDansk (Danish)
fiSuomi (Finnish)
csČeština (Czech)
trTürkçe (Turkish)
zh-Hans简体中文 (Simplified Chinese)
zh-Hant繁體中文 (Traditional Chinese)
ja日本語 (Japanese)
ko한국어 (Korean)
arالعربية (Arabic)
hiहिन्दी (Hindi)
idBahasa Indonesia

Error responses

StatusCodeDescription
401unauthorizedMissing / invalid credentials or free batch exhausted.
402payment_requiredAccount has 0 credits.
413payload_too_largeFile exceeds 25 MB limit.
415unsupported_media_typeFile type not supported. Only PDF files and scanned images (JPG, PNG, TIFF) are accepted.
500server_errorUnhandled 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-type

If 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-url

Request

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):

FieldTypeRequiredDescription
fileUrlstringYesPublicly 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.
originalFilenamestringNoOptional filename override. If not provided, the filename is derived from the URL pathname.
strategystringNoOrganization strategy for folder structure. See Organization Strategies section in the Rename endpoint documentation for details.
templateModestringNoTemplate selection mode. See Template Modes section in the Rename endpoint documentation for details. Default: auto.
templateIdstringNoPredefined template ID (required when templateMode=predefined).
customTemplatestringNoAI 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"
languagestringNoOutput 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

StatusCodeDescription
400invalid_urlInvalid URL format, URL points to localhost/private network, or URL does not use HTTP/HTTPS.
401unauthorizedMissing or invalid credentials.
402payment_requiredAccount has insufficient credits.
413payload_too_largeFile exceeds 25 MB limit.
415unsupported_media_typeFile type not supported. Only PDF files and scanned images (JPG, PNG, TIFF) are accepted.
429rate_limit_exceededDaily rename limit exceeded. Check Retry-After header.
502bad_gatewayFailed to download file from URL or DNS resolution failed.
500server_errorUnhandled 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.