PDF to Word API
Category: pdf
Convert PDF documents to editable Microsoft Word files (.docx).
Endpoint
POST
https://anythingtext.com/api/tools/pdf2word
Authentication Required
Content-Type: multipart/form-data
Authentication
This API requires an API key. Generate one from the API Keys section in your dashboard settings.
Include the X-API-Key header in all API requests:
X-API-Key: atk_your_api_key_here
Rate Limiting
API requests are limited to 60 requests per minute per user. If you exceed this limit, the API returns a 429 Too Many Requests response.
Every response includes rate limit headers:
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 57
X-RateLimit-Reset: 42
When rate limited, the response body contains:
{ "error": "Rate limit exceeded. Maximum 60 requests per minute.", "retryAfter": 42, "limit": 60 }
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
file
|
File | Required |
PDF file to convert
Example: document.pdf
|
Response
Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document
Converted Word document (.docx)
(binary DOCX data)
Error Responses
| Status | Description | Body |
|---|---|---|
401 |
Not authenticated | {"error": "Please log in..."} |
400 |
Bad request / Missing required params | {"error": "... is required"} |
500 |
Internal server error | {"error": "Failed to ..."} |
cURL Example
curl -X POST https://anythingtext.com/api/tools/pdf2word \ -H "X-API-Key: your_api_key_here" \ -F "file=@document.pdf" \ --output document.docx
Code Samples
const formData = new FormData();
formData.append('file', fileInput.files[0]);
const response = await fetch('https://anythingtext.com/api/tools/pdf2word', {
method: 'POST',
headers: { 'X-API-Key': 'your_api_key_here' },
body: formData
});
const blob = await response.blob();
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'output.docx';
a.click();
import requests
with open('input_file', 'rb') as f:
response = requests.post(
'https://anythingtext.com/api/tools/pdf2word',
files={'file': f},
headers={'X-API-Key': 'your_api_key_here'}
)
with open('output.docx', 'wb') as f:
f.write(response.content)
print('Saved to output.docx')
import java.net.URI;
import java.net.http.*;
import java.nio.file.*;
HttpClient client = HttpClient.newHttpClient();
String boundary = "----Boundary" + System.currentTimeMillis();
byte[] fileBytes = Files.readAllBytes(Path.of("input_file"));
String body = "--" + boundary + "\r\n"
+ "Content-Disposition: form-data; name=\"file\"; filename=\"input_file\"\r\n"
+ "Content-Type: application/octet-stream\r\n\r\n";
String end = "\r\n--" + boundary + "--";
byte[] prefix = body.getBytes();
byte[] suffix = end.getBytes();
byte[] full = new byte[prefix.length + fileBytes.length + suffix.length];
System.arraycopy(prefix, 0, full, 0, prefix.length);
System.arraycopy(fileBytes, 0, full, prefix.length, fileBytes.length);
System.arraycopy(suffix, 0, full, prefix.length + fileBytes.length, suffix.length);
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://anythingtext.com/api/tools/pdf2word"))
.header("Content-Type", "multipart/form-data; boundary=" + boundary)
.header("X-API-Key", "your_api_key_here")
.POST(HttpRequest.BodyPublishers.ofByteArray(full))
.build();
HttpResponse<byte[]> response = client.send(request,
HttpResponse.BodyHandlers.ofByteArray());
Files.write(Path.of("output.docx"), response.body());
System.out.println("Saved to output.docx");