API Documentation
Learn how to integrate and use the LateNightWork PDF Conversion API in your applications.
API Endpoints
Convert images or text files to PDF format.
Request Headers
Content-Type: multipart/form-data tenant-id: <your_tenant_id> api-key: <your_api_key> accept: application/pdf
Request Body
Upload a single image or text file via form-data:
{
"file": (binary)
}
Response
{
"statusCode": 200,
"headers": {
"Content-Type": "application/pdf",
"Content-Disposition": "attachment; filename=02-photo-comparison-2x-opt.pdf",
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Headers": "Allowed Headers Here"
},
"body": "Base64Encoded PDF Content Here",
"isBase64Encoded": true
}
Note: The API can be region-specific — this endpoint is for region
ap-south-1, other regions like us-east-1, or
eu-west-1 can be setup depending on requirements.
Code Examples
curl -X POST \
-H "tenant-id: YOUR_TENANT_ID" \
-H "api-key: YOUR_API_KEY" \
-H "accept: application/pdf" \
-F "file=@/path/to/image.png" \
https://duen64ewe5.execute-api.ap-south-1.amazonaws.com/prod/api/pdfconversion \
--output image.pdf
const formData = new FormData();
formData.append('file', document.getElementById('fileInput').files[0]);
fetch('https://duen64ewe5.execute-api.ap-south-1.amazonaws.com/prod/api/pdfconversion', {
method: 'POST',
headers: {
'api-key': 'abc',
'tenant-id': '123'
},
body: formData,
Accept: 'application/pdf'
})
.then(response => response.json())
.then(data => {
console.log('PDF URL:', data.body);
// Handle the PDF download URL
})
.catch(error => console.error('Error:', error));
using (var httpClient = new HttpClient())
{
var form = new MultipartFormDataContent();
// Add file
var fileStream = File.OpenRead("document.jpg");
form.Add(new StreamContent(fileStream), "file", "document.jpg");
// Add headers
httpClient.DefaultRequestHeaders.Add("tenant-id", "YOUR_TENANT_ID");
httpClient.DefaultRequestHeaders.Add("api-key", "YOUR_API_KEY");
httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/pdf"));
var response = await httpClient.PostAsync(
"https://duen64ewe5.execute-api.ap-south-1.amazonaws.com/prod/api/pdfconversion",
form);
if (response.IsSuccessStatusCode)
{
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result.body);
}
}
Rate Limits
API requests are limited based on your subscription plan:
- Basic: 100 requests/hour
- Pro: 500 requests/hour
- Enterprise: Unlimited requests
Exceeding these limits will result in a 429 Too Many Requests response.