{"openapi":"3.0.0","info":{"title":"Renamed.to API","version":"1.0.0","description":"The Renamed.to API allows you to programmatically rename PDF files using AI and split PDFs into logical parts.\n\n## Authentication\n\nAll API endpoints require authentication using a Bearer token. Get your API token from [your account settings](https://www.renamed.to/account).\n\nInclude the token in the Authorization header:\n\n```\nAuthorization: Bearer your_api_token_here\n```\n\n## Rate Limits\n\nAPI requests are subject to rate limiting. When you exceed the limit, you'll receive a 429 response with headers indicating when you can retry.\n\n## Credits\n\nMost operations consume credits. Check your balance with the `/api/v1/credits` endpoint before performing operations.","contact":{"name":"Renamed.to Support","url":"https://www.renamed.to"}},"servers":[{"url":"https://www.renamed.to","description":"Production"},{"url":"http://localhost:3000","description":"Local development"}],"tags":[{"name":"Credits","description":"Credit balance management"},{"name":"User","description":"User profile information"},{"name":"Team","description":"Team management"},{"name":"Rename","description":"AI-powered PDF renaming"},{"name":"PDF Split","description":"PDF splitting operations"},{"name":"Templates","description":"Filename template management"},{"name":"Files","description":"File listing and downloads"},{"name":"Web Rename","description":"Async rename job management"}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","description":"API token authentication. Get your token at https://www.renamed.to/account"}},"responses":{"UnauthorizedError":{"description":"Authentication required or invalid API token","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Unauthorized"},"message":{"type":"string","example":"API key required. Get your key at https://www.renamed.to/account"}},"required":["error"]}}}},"InsufficientCredits":{"description":"Not enough credits to perform this operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InsufficientCreditsError"}}}},"RateLimitExceeded":{"description":"Rate limit exceeded","headers":{"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"string"}},"X-RateLimit-Limit":{"description":"Maximum requests allowed","schema":{"type":"string"}},"X-RateLimit-Remaining":{"description":"Remaining requests in window","schema":{"type":"string"}},"X-RateLimit-Reset":{"description":"ISO timestamp when limit resets","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimitError"}}}},"InternalServerError":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Internal server error"}},"required":["error"]}}}}},"schemas":{"CreditsResponse":{"type":"object","properties":{"credits":{"type":"number","description":"Current credit balance"}},"required":["credits"]},"UserResponse":{"type":"object","properties":{"id":{"type":"string","description":"User ID"},"email":{"type":"string","format":"email","description":"User email address"},"name":{"type":"string","nullable":true,"description":"User display name"}},"required":["id","email","name"]},"TeamResponse":{"type":"object","properties":{"id":{"type":"string","description":"Team ID"},"name":{"type":"string","description":"Team name"},"teamMembers":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Team member record ID"},"userId":{"type":"string","description":"User ID"},"teamId":{"type":"string","description":"Team ID"},"user":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string","nullable":true},"email":{"type":"string","format":"email"}},"required":["id","name","email"]}},"required":["id","userId","teamId","user"]},"description":"List of team members"}},"required":["id","name","teamMembers"]},"FilesListResponse":{"type":"object","properties":{"files":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"File storage key"},"filename":{"type":"string","description":"Original filename"},"size":{"type":"number","description":"File size in bytes"},"createdAt":{"type":"string","description":"Upload timestamp"}},"required":["key","filename"]},"description":"List of uploaded files"}},"required":["files"]},"RenameResponse":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"],"description":"Operation status"},"originalFilename":{"type":"string","description":"Original filename"},"suggestedFilename":{"type":"string","description":"AI-generated filename"},"extractedInfo":{"type":"object","properties":{"date":{"type":"string","nullable":true,"description":"Document date"},"issuer":{"type":"string","nullable":true,"description":"Document issuer"},"invoice_number":{"type":"string","nullable":true,"description":"Invoice or document number"},"document_type":{"type":"string","nullable":true,"description":"Type of document"}},"required":["date","issuer","invoice_number","document_type"],"description":"Information extracted from the document"},"folderPath":{"type":"string","description":"Suggested folder path"},"organizationStrategy":{"type":"string","enum":["by_date","by_issuer","by_type","by_date_issuer","by_date_type","by_issuer_type","by_all","root","follow_custom_prompt"],"description":"Organization strategy used"},"templateUsed":{"type":"string","description":"Template that was applied"},"error":{"type":"string","description":"Error message if status is error"},"errorCode":{"type":"string","enum":["ENCRYPTED","MALFORMED","UNKNOWN"],"description":"Error code for specific failures"},"isFirstRename":{"type":"boolean","description":"True if this is the user's first rename"},"remainingAnonRenames":{"type":"number","description":"Remaining free renames for anonymous users"}},"required":["originalFilename","suggestedFilename"]},"RenameFromUrlRequest":{"type":"object","properties":{"fileUrl":{"type":"string","format":"uri","description":"URL of the PDF file to rename (http or https)"},"originalFilename":{"type":"string","description":"Override the original filename"},"language":{"type":"string","enum":["auto","source","en","de","fr","es","it","pt","pt-BR","nl","pl","sv","no","da","fi","cs","tr","zh-Hans","zh-Hant","ja","ko","ar","hi","id"],"description":"Output language for the generated filename"},"strategy":{"type":"string","enum":["by_date","by_issuer","by_type","by_date_issuer","by_date_type","by_issuer_type","by_all","root","follow_custom_prompt"],"description":"Folder organization strategy"},"templateMode":{"type":"string","enum":["auto","predefined","custom"],"description":"Template selection mode"},"templateId":{"type":"string","description":"ID of a predefined template (when templateMode is \"predefined\")"},"customTemplate":{"type":"string","description":"Custom template string (when templateMode is \"custom\")"}},"required":["fileUrl"]},"PdfSplitJobResponse":{"type":"object","properties":{"status":{"type":"string","enum":["processing"],"description":"Job status"},"jobId":{"type":"string","description":"Job ID for status polling"},"estimatedCompletionTime":{"type":"string","description":"Estimated time to complete"},"statusUrl":{"type":"string","format":"uri","description":"URL to poll for job status"},"creditsReserved":{"type":"number","description":"Credits reserved for this job"},"totalPages":{"type":"number","description":"Total pages across all files"}},"required":["status","jobId","estimatedCompletionTime","statusUrl","creditsReserved","totalPages"]},"PdfSplitStatusResponse":{"type":"object","properties":{"jobId":{"type":"string","description":"Job ID"},"status":{"type":"string","enum":["pending","processing","completed","failed"],"description":"Current job status"},"createdAt":{"type":"string","description":"Job creation timestamp"},"progress":{"type":"number","minimum":0,"maximum":100,"description":"Progress percentage"},"message":{"type":"string","nullable":true,"description":"Status message"},"results":{"type":"object","properties":{"results":{"type":"array","items":{"type":"object","properties":{"originalFilename":{"type":"string","description":"Original filename"},"splits":{"type":"array","items":{"type":"object","properties":{"filename":{"type":"string","description":"Generated filename for this split"},"downloadUrl":{"type":"string","format":"uri","description":"Signed URL to download this split"},"expiresAt":{"type":"string","description":"Expiration time for the download URL"},"pages":{"type":"number","description":"Number of pages in this split"},"reason":{"type":"string","description":"Reason for this split (in smart mode)"}},"required":["filename","downloadUrl","expiresAt","pages"]},"description":"Split files generated"}},"required":["originalFilename","splits"]}},"creditsUsed":{"type":"number"}},"required":["results","creditsUsed"],"description":"Split results (when completed)"},"creditsUsed":{"type":"number","description":"Actual credits used"}},"required":["jobId","status","createdAt"]},"PdfSplitEstimateResponse":{"type":"object","properties":{"totalPages":{"type":"number","description":"Total pages across all files"},"creditsRequired":{"type":"number","description":"Credits required for this operation"},"estimatedProcessingTime":{"type":"string","description":"Estimated processing time"},"breakdown":{"type":"object","properties":{"creditsPerPage":{"type":"number","description":"Credits charged per page"},"files":{"type":"array","items":{"type":"object","properties":{"pages":{"type":"number"},"credits":{"type":"number"}},"required":["pages","credits"]}}},"required":["creditsPerPage","files"]}},"required":["totalPages","creditsRequired","estimatedProcessingTime","breakdown"]},"PdfSplitEstimateRequest":{"type":"object","properties":{"url":{"type":"string","format":"uri","description":"URL of a single PDF to estimate"},"urls":{"type":"array","items":{"type":"string","format":"uri"},"description":"URLs of multiple PDFs to estimate"},"pageCount":{"type":"number","description":"Manually specify page count for estimation"}}},"PdfSplitFromUrlRequest":{"type":"object","properties":{"url":{"type":"string","format":"uri","description":"URL of a single PDF to split"},"urls":{"type":"array","items":{"type":"string","format":"uri"},"description":"URLs of multiple PDFs to split"},"mode":{"type":"string","enum":["smart","every-n-pages","by-bookmarks"],"default":"smart","description":"Split mode"},"instructions":{"type":"string","maxLength":5000,"description":"Instructions for smart mode (max 5000 chars)"},"pagesPerSplit":{"type":"number","minimum":1,"maximum":1000,"description":"Pages per split (required for every-n-pages mode)"},"callback":{"type":"string","format":"uri","description":"Webhook URL for completion notification"}}},"TemplatesListResponse":{"type":"object","properties":{"templates":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Template ID"},"userId":{"type":"string","description":"Owner user ID"},"name":{"type":"string","description":"Template name"},"prompt":{"type":"string","nullable":true,"description":"Custom prompt for this template"},"strategy":{"type":"string","description":"Organization strategy"},"template":{"type":"string","description":"Filename template pattern"},"createdAt":{"type":"string","description":"Creation timestamp"},"updatedAt":{"type":"string","description":"Last update timestamp"}},"required":["id","userId","name","prompt","strategy","template","createdAt","updatedAt"]},"description":"List of saved templates"}},"required":["templates"]},"CreateTemplateResponse":{"type":"object","properties":{"template":{"type":"object","properties":{"id":{"type":"string","description":"Template ID"},"userId":{"type":"string","description":"Owner user ID"},"name":{"type":"string","description":"Template name"},"prompt":{"type":"string","nullable":true,"description":"Custom prompt for this template"},"strategy":{"type":"string","description":"Organization strategy"},"template":{"type":"string","description":"Filename template pattern"},"createdAt":{"type":"string","description":"Creation timestamp"},"updatedAt":{"type":"string","description":"Last update timestamp"}},"required":["id","userId","name","prompt","strategy","template","createdAt","updatedAt"]}},"required":["template"]},"CreateTemplateRequest":{"type":"object","properties":{"name":{"type":"string","minLength":1,"description":"Template name (required)"},"prompt":{"type":"string","description":"Custom prompt"},"strategy":{"type":"string","default":"root","description":"Organization strategy"},"template":{"type":"string","default":"auto","description":"Filename template pattern"}},"required":["name"]},"UpdateTemplateRequest":{"type":"object","properties":{"name":{"type":"string","description":"Template name"},"prompt":{"type":"string","description":"Custom prompt"},"strategy":{"type":"string","description":"Organization strategy"},"template":{"type":"string","description":"Filename template pattern"}}},"DeleteTemplateResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]},"WebRenameEnqueueResponse":{"type":"object","properties":{"jobId":{"type":"string","description":"Job ID for status polling"},"isAnonFree":{"type":"boolean","description":"Whether this is a free anonymous rename"},"anonRenameCount":{"type":"number","description":"Remaining anonymous renames"}},"required":["jobId"]},"WebRenameEnqueueRequest":{"type":"object","properties":{"key":{"type":"string","description":"R2 object key of the uploaded file"},"originalFilename":{"type":"string","description":"Original filename"},"options":{"type":"object","properties":{"strategy":{"type":"string","enum":["by_date","by_issuer","by_type","by_date_issuer","by_date_type","by_issuer_type","by_all","root","follow_custom_prompt"],"description":"Folder organization strategy"},"templateMode":{"type":"string","enum":["auto","predefined","custom"],"description":"Template selection mode"},"templateId":{"type":"string","description":"Predefined template ID"},"customTemplate":{"type":"string","description":"Custom template string"},"language":{"type":"string","enum":["auto","source","en","de","fr","es","it","pt","pt-BR","nl","pl","sv","no","da","fi","cs","tr","zh-Hans","zh-Hant","ja","ko","ar","hi","id"],"description":"Output language"}},"description":"Rename options"}},"required":["key"]},"WebRenameJobStatus":{"type":"object","properties":{"jobId":{"type":"string","description":"Job ID"},"status":{"type":"string","enum":["pending","processing","succeeded","failed","invalid_pdf","password_protected"],"description":"Job status"},"originalFilename":{"type":"string","description":"Original filename"},"suggestedFilename":{"type":"string","description":"AI-generated filename (when succeeded)"},"objectKey":{"type":"string","description":"Storage key (when succeeded)"},"folderPath":{"type":"string","description":"Suggested folder path (when succeeded)"},"templateUsed":{"type":"string","description":"Template applied (when succeeded)"},"error":{"type":"string","description":"Error message (when failed)"},"errorCode":{"type":"string","enum":["MALFORMED","ENCRYPTED"],"description":"Error code"},"createdAt":{"type":"string","description":"Job creation timestamp"},"updatedAt":{"type":"string","description":"Last update timestamp"}},"required":["jobId","status","createdAt","updatedAt"]}},"parameters":{}},"paths":{"/api/v1/credits":{"get":{"tags":["Credits"],"summary":"Get credit balance","description":"Returns the current credit balance for the authenticated user or team.","security":[{"BearerAuth":[]}],"responses":{"200":{"description":"Current credit balance","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditsResponse"}}}},"401":{"$ref":"#/components/responses/UnauthorizedError"},"404":{"description":"User not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"User not found"}}}}}},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/api/v1/user":{"get":{"tags":["User"],"summary":"Get current user","description":"Returns profile information for the authenticated user.","security":[{"BearerAuth":[]}],"responses":{"200":{"description":"User profile","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserResponse"}}}},"401":{"$ref":"#/components/responses/UnauthorizedError"},"404":{"description":"User not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"User not found"}}}}}},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/api/v1/team":{"get":{"tags":["Team"],"summary":"Get current team","description":"Returns the authenticated user's team information including all team members.","security":[{"BearerAuth":[]}],"responses":{"200":{"description":"Team information with members","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TeamResponse"}}}},"401":{"$ref":"#/components/responses/UnauthorizedError"},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/api/v1/files":{"get":{"tags":["Files"],"summary":"List uploaded files","description":"Returns a list of files uploaded in the current session.","security":[{"BearerAuth":[]}],"responses":{"200":{"description":"List of files","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FilesListResponse"}}}},"401":{"$ref":"#/components/responses/UnauthorizedError"},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/api/v1/download":{"get":{"tags":["Files"],"summary":"Download a file","description":"Download a processed file using a signed token. Tokens are returned in rename and split responses.","parameters":[{"schema":{"type":"string","description":"Signed download token"},"required":true,"description":"Signed download token","name":"token","in":"query"}],"responses":{"200":{"description":"File download","headers":{"Content-Disposition":{"description":"Attachment filename","schema":{"type":"string"}}},"content":{"application/pdf":{"schema":{"type":"string","format":"binary"}}}},"400":{"description":"Missing token","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"missing_token"},"message":{"type":"string","example":"Download token required"}}}}}},"401":{"description":"Invalid or expired token","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"invalid_token"},"message":{"type":"string","example":"Invalid or expired download token"}}}}}},"404":{"description":"File not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"not_found"},"message":{"type":"string","example":"File not found or expired"}}}}}},"410":{"description":"File expired","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"expired"},"message":{"type":"string","example":"File expired"}}}}}}}}},"/api/v1/rename":{"post":{"tags":["Rename"],"summary":"Rename a file (PDF, images, Office)","description":"Upload a PDF, image (JPG, PNG, TIFF), or Office document (DOCX, DOC, PPTX, XLSX, XLS) and get an AI-generated filename suggestion. Accepts multipart/form-data with a file field.","security":[{"BearerAuth":[]}],"requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary","description":"File to rename (PDF, JPG, PNG, TIFF, DOCX, DOC, PPTX, XLSX, XLS)"},"language":{"type":"string","description":"Output language for filename"},"strategy":{"type":"string","description":"Folder organization strategy"},"templateMode":{"type":"string","enum":["auto","predefined","custom"]},"templateId":{"type":"string","description":"Template ID for predefined mode"},"customTemplate":{"type":"string","description":"Custom template string"}},"required":["file"]}}}},"responses":{"200":{"description":"Rename suggestion","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RenameResponse"}}}},"401":{"$ref":"#/components/responses/UnauthorizedError"},"402":{"$ref":"#/components/responses/InsufficientCredits"},"413":{"description":"File too large","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"File too large"}}}}}},"415":{"description":"Unsupported file type","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Unsupported file type"}}}}}},"429":{"$ref":"#/components/responses/RateLimitExceeded"},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/api/v1/rename-from-url":{"post":{"tags":["Rename"],"summary":"Rename a file from URL","description":"Provide a URL to a file (PDF, image, or Office document) and get an AI-generated filename suggestion. The file is downloaded and processed on the server.","security":[{"BearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RenameFromUrlRequest"}}}},"responses":{"200":{"description":"Rename suggestion","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RenameResponse"}}}},"400":{"description":"Invalid request (bad URL, validation failed)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"details":{"type":"array","items":{"type":"object"}}}}}}},"401":{"$ref":"#/components/responses/UnauthorizedError"},"402":{"$ref":"#/components/responses/InsufficientCredits"},"413":{"description":"Remote file too large","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"File exceeds maximum size limit"}}}}}},"415":{"description":"Unsupported file type","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}},"429":{"$ref":"#/components/responses/RateLimitExceeded"},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/api/v1/pdf-split":{"post":{"tags":["PDF Split"],"summary":"Split PDF files","description":"Upload PDF file(s) and split them using AI-powered smart splitting, fixed page intervals, or by bookmarks. Returns a job ID for polling status.","security":[{"BearerAuth":[]}],"requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary","description":"Single PDF file to split"},"files[]":{"type":"array","items":{"type":"string","format":"binary"},"description":"Multiple PDF files to split"},"mode":{"type":"string","enum":["smart","every-n-pages","by-bookmarks"],"default":"smart","description":"Split mode"},"instructions":{"type":"string","maxLength":5000,"description":"Instructions for smart mode"},"pagesPerSplit":{"type":"integer","minimum":1,"maximum":1000,"description":"Pages per split (required for every-n-pages mode)"}}}}}},"responses":{"200":{"description":"Job created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PdfSplitJobResponse"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}}}}}},"401":{"$ref":"#/components/responses/UnauthorizedError"},"402":{"$ref":"#/components/responses/InsufficientCredits"},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/api/v1/pdf-split/status/{jobId}":{"get":{"tags":["PDF Split"],"summary":"Get split job status","description":"Poll for the status of a PDF split job. When complete, includes download URLs for each split file.","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"Job ID from the split request"},"required":true,"description":"Job ID from the split request","name":"jobId","in":"path"}],"responses":{"200":{"description":"Job status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PdfSplitStatusResponse"}}}},"401":{"$ref":"#/components/responses/UnauthorizedError"},"403":{"description":"Not authorized to view this job","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"forbidden"},"message":{"type":"string","example":"Not your job"}}}}}},"404":{"description":"Job not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"not_found"},"message":{"type":"string","example":"Job not found"}}}}}},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/api/v1/pdf-split/estimate":{"post":{"tags":["PDF Split"],"summary":"Estimate split credits","description":"Estimate the credits required to split PDF files. Provide URLs or a manual page count.","security":[{"BearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PdfSplitEstimateRequest"}}}},"responses":{"200":{"description":"Credit estimate","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PdfSplitEstimateResponse"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}}}}}},"401":{"$ref":"#/components/responses/UnauthorizedError"},"500":{"$ref":"#/components/responses/InternalServerError"},"501":{"description":"URL-based estimation not yet implemented","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"not_implemented"},"message":{"type":"string"}}}}}}}}},"/api/v1/pdf-split/from-url":{"post":{"tags":["PDF Split"],"summary":"Split PDFs from URLs","description":"Provide URLs to PDF files and split them. The files are downloaded and processed on the server.","security":[{"BearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PdfSplitFromUrlRequest"}}}},"responses":{"200":{"description":"Job created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PdfSplitJobResponse"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}}}}}},"401":{"$ref":"#/components/responses/UnauthorizedError"},"402":{"$ref":"#/components/responses/InsufficientCredits"},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/api/v1/templates":{"get":{"tags":["Templates"],"summary":"List saved templates","description":"Returns all saved filename templates for the authenticated user.","security":[{"BearerAuth":[]}],"responses":{"200":{"description":"List of templates","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplatesListResponse"}}}},"401":{"$ref":"#/components/responses/UnauthorizedError"},"500":{"$ref":"#/components/responses/InternalServerError"}}},"post":{"tags":["Templates"],"summary":"Create a template","description":"Create a new filename template for the authenticated user.","security":[{"BearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTemplateRequest"}}}},"responses":{"201":{"description":"Template created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTemplateResponse"}}}},"400":{"description":"Invalid request (name required)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Name is required"}}}}}},"401":{"$ref":"#/components/responses/UnauthorizedError"},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/api/v1/templates/{id}":{"patch":{"tags":["Templates"],"summary":"Update a template","description":"Update an existing filename template.","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"Template ID"},"required":true,"description":"Template ID","name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateTemplateRequest"}}}},"responses":{"200":{"description":"Template updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTemplateResponse"}}}},"401":{"$ref":"#/components/responses/UnauthorizedError"},"404":{"description":"Template not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Template not found"}}}}}},"500":{"$ref":"#/components/responses/InternalServerError"}}},"delete":{"tags":["Templates"],"summary":"Delete a template","description":"Delete a filename template.","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"Template ID"},"required":true,"description":"Template ID","name":"id","in":"path"}],"responses":{"200":{"description":"Template deleted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeleteTemplateResponse"}}}},"401":{"$ref":"#/components/responses/UnauthorizedError"},"404":{"description":"Template not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Template not found"}}}}}},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/api/v1/web-rename/enqueue":{"post":{"tags":["Web Rename"],"summary":"Enqueue a rename job","description":"Queue a file for async rename processing. Returns a job ID for polling or streaming status.","security":[{"BearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebRenameEnqueueRequest"}}}},"responses":{"200":{"description":"Job enqueued","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebRenameEnqueueResponse"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}},"401":{"$ref":"#/components/responses/UnauthorizedError"},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/api/v1/web-rename/jobs/{id}":{"get":{"tags":["Web Rename"],"summary":"Get job status","description":"Get the status of a rename job by ID.","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"Job ID"},"required":true,"description":"Job ID","name":"id","in":"path"}],"responses":{"200":{"description":"Job status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebRenameJobStatus"}}}},"401":{"$ref":"#/components/responses/UnauthorizedError"},"403":{"description":"Not authorized to view this job","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Unauthorized"}}}}}},"404":{"description":"Job not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Job not found"}}}}}},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/api/v1/web-rename/jobs/stream":{"get":{"tags":["Web Rename"],"summary":"Stream job updates (SSE)","description":"Stream real-time status updates for multiple jobs using Server-Sent Events. Pass job IDs as comma-separated query parameter.","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"Comma-separated list of job IDs"},"required":true,"description":"Comma-separated list of job IDs","name":"jobIds","in":"query"}],"responses":{"200":{"description":"Server-Sent Events stream","headers":{"Cache-Control":{"description":"No caching","schema":{"type":"string","example":"no-cache"}},"Connection":{"description":"Keep alive","schema":{"type":"string","example":"keep-alive"}}},"content":{"text/event-stream":{"schema":{"type":"string","description":"SSE stream with events: \"job-update\" (status changes), \"all-complete\" (all jobs done)"}}}},"400":{"description":"Missing job IDs","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"No job IDs provided"}}}}}},"401":{"$ref":"#/components/responses/UnauthorizedError"},"500":{"$ref":"#/components/responses/InternalServerError"}}},"post":{"tags":["Web Rename"],"summary":"Stream job updates (SSE via POST)","description":"Alternative to GET for streaming job updates. Pass job IDs in request body.","security":[{"BearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"jobIds":{"type":"array","items":{"type":"string"},"description":"Array of job IDs to watch"}},"required":["jobIds"]}}}},"responses":{"200":{"description":"Server-Sent Events stream","content":{"text/event-stream":{"schema":{"type":"string"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}},"401":{"$ref":"#/components/responses/UnauthorizedError"},"500":{"$ref":"#/components/responses/InternalServerError"}}}}}}