Request
Request Body
file
filerequiredPDF file with form fields to analyze and map
Maximum 10MB, PDF format only, must contain form fields
AI-Powered Mapping
Advanced machine learning analyzes form field names, positions, and document content to provide intelligent mapping suggestions with confidence scores.
curl --request POST \
--url https://pdfmage.app/api/v1/field-mapping \
--header 'Accept: application/json' \
--header 'Authorization: Bearer pk_live_abc123...' \
--form 'file=@/path/to/form.pdf'
const formData = new FormData();
formData.append('file', pdfFile);
const response = await fetch('https://pdfmage.app/api/v1/field-mapping', {
method: 'POST',
headers: {
'Authorization': 'Bearer pk_live_abc123...'
},
body: formData
});
if (response.ok) {
const mappingResult = await response.json();
console.log('Fields detected:', mappingResult.statistics.totalFields);
console.log('Mapping success rate:', mappingResult.statistics.mappingSuccess);
mappingResult.fields.forEach(field => {
console.log(`Field: ${field.name} - Confidence: ${field.mapping.confidence}`);
});
} else {
const error = await response.json();
console.error('Error:', error);
}
Response
Response Body
fileName
string - Original filename of processed documentprocessedAt
string (ISO 8601) - Processing completion timestamppageCount
number - Total number of pages in documentfields
arrayArray of detected form fields with mapping information
name
string - Field name/identifiertype
string - Field type (text, checkbox, radio, dropdown, signature)required
boolean - Whether field is requiredpage
number - Page number containing this fieldposition
object - Field position coordinatesmapping
object - AI mapping resultsstatistics
objectMapping operation statistics
totalFields
number - Total form fields detectedmappedFields
number - Fields successfully mappedunmappedFields
number - Fields that could not be mappedmappingSuccess
number - Overall mapping success rate (0-1)extractedText
objectDocument text extraction results
fullText
string - Complete extracted text from documentpageCount
number - Number of pages processed{
"fileName": "employment-form.pdf",
"processedAt": "2024-01-15T10:30:45.123Z",
"pageCount": 1,
"fields": [
{
"name": "firstName",
"type": "text",
"required": true,
"page": 1,
"position": {
"x": 120.5,
"y": 680.2
},
"mapping": {
"relevantText": "First Name: John",
"confidence": 0.95,
"reasoning": "Field label 'firstName' matches document text 'First Name: John'"
}
},
{
"name": "employmentDate",
"type": "text",
"required": false,
"page": 1,
"position": {
"x": 120.5,
"y": 640.8
},
"mapping": {
"relevantText": "Start Date: January 15, 2024",
"confidence": 0.87,
"reasoning": "Employment date field likely corresponds to 'Start Date' in document"
}
}
],
"statistics": {
"totalFields": 12,
"mappedFields": 10,
"unmappedFields": 2,
"mappingSuccess": 0.83
},
"extractedText": {
"fullText": "Employment Application\n\nFirst Name: John\nLast Name: Doe\nStart Date: January 15, 2024...",
"pageCount": 1
}
}
HTTP/1.1 200 OK
Content-Type: application/json
X-Credits-Used: 0.01
X-Credits-Remaining: 4.99
X-Credits-Currency: USD
Error Responses
Bad Request
Invalid file format, missing file, or corrupted PDF
Unauthorized
Invalid or missing API key
Payment Required
Insufficient credit balance
Payload Too Large
File exceeds maximum size limit (10MB)
Unprocessable Entity
PDF contains no fillable form fields
{
"error": "Unprocessable Entity",
"message": "No form fields found in PDF",
"details": {
"code": "NO_FORM_FIELDS",
"pageCount": 2,
"suggestion": "Ensure PDF contains fillable form fields"
},
"timestamp": "2024-01-15T10:30:00Z",
"requestId": "req_abc123"
}
{
"error": "Bad Request",
"message": "Invalid file format",
"details": {
"code": "INVALID_FILE_FORMAT",
"allowedFormats": ["pdf"],
"receivedFormat": "docx"
},
"timestamp": "2024-01-15T10:30:00Z",
"requestId": "req_def456"
}
Mapping Intelligence
Semantic Understanding
AI understands field names, labels, and context to provide intelligent mapping suggestions.
Confidence Scoring
Each mapping includes confidence scores to help you validate and prioritize results.
Detailed Analysis
Get field positions, types, requirements, and detailed reasoning for each mapping decision.
Advanced AI Mapping
Our field mapping uses advanced natural language processing to understand relationships between form fields and document content, providing accurate mapping even for complex forms with non-standard field names.
Common Use Cases
Form Analysis
Analyze complex forms to understand field structure and requirements before implementing automated filling workflows.
Data Validation
Validate that your data structure matches form fields and identify missing or incompatible data points.
Integration Planning
Plan API integrations by understanding form structure and mapping requirements for automated processing.
Quality Assurance
Use confidence scores to identify potential mapping issues and ensure high-quality form filling results.
Debugging
Debug form filling issues by analyzing field mappings and understanding AI reasoning for each decision.
Custom Workflows
Build custom form processing workflows using detailed field information and mapping intelligence.