Extract Data from Document Action

Extracts structured data from a document by using Intelligent Document Processing (IDP). Send a Base64-encoded file directly for processing without uploading it to Salesforce first.

This action is available in API version 62.0 and later.

Use the extractDataFromDocument action to extract field values from documents, such as invoices, receipts, and forms. The action processes the document against an IDP configuration that defines which fields to extract. It returns structured data with confidence scores for each extracted field.

This action is part of MuleSoft for Flow and requires the Automation 2.0 SKU. Your org must have Data Cloud and Einstein provisioned with the Document Processing org permission enabled.

When any extracted field has a confidence score less than its configured threshold, the response sets needsManualReview to True.

Supported REST HTTP Methods 

URI: /services/data/vXX.0/actions/standard/extractDataFromDocument

Formats: JSON

HTTP Methods: POST

Authentication: Authorization: Bearer token

The authenticated user must have the Document Processing permission.

Inputs 

InputTypeDescription
documentProcessingConfigurationstringRequired. Name of the IDP configuration that defines which fields to extract.
fileContentstringRequired. Base64-encoded content of the file to process. Provide together with mimeType.
mimeTypestringRequired. MIME type of the file. Provide together with fileContent. Supported values: application/pdf, image/png, image/jpeg, image/jpg.

fileContent and mimeType are runtime-only fields available through REST API and Apex. They don’t appear in Flow Builder, where you use contentDocumentId instead.

Note

Outputs 

OutputTypeDescription
contentDocumentIdstringThe Salesforce content document ID. Null when the file was sent via fileContent.
documentProcessingConfigurationIdstringThe ID of the IDP configuration used for extraction.
extractedDataobjectStructured extraction results. Each field defined in the IDP configuration appears as a property with value, confidence_score, and confidence_threshold sub-properties. See Extracted Data Structure.
extractedDataJsonstringJSON string representation of the extracted data. Each field includes type, value, confidence_score, and confidence_threshold.
needsManualReviewbooleanTrue when any extracted field has a confidence score less than its configured threshold. See Extracted Data Structure.

Extracted Data Structure 

Each field defined in the IDP configuration appears in extractedData with two entries:

  • A top-level fieldName_set boolean flag indicating whether the field found in the document.
  • A fieldName object containing the extraction details.

Field names use hex encoding for special characters: x20 represents a space and x5f represents an underscore. For example, phonex20number corresponds to the phone number field in your IDP configuration.

Each field object contains:

PropertyTypeDescription
value_setbooleanTrue if a value extracted for this field.
valuestring or booleanThe extracted value.
confidencex5fthreshold_setboolean or nullTrue if a confidence threshold configured. Null for the needsManualReview field.
confidencex5fthresholdinteger or nullThe minimum confidence score configured for this field. Null for needsManualReview.
confidencex5fscore_setboolean or nullTrue if a confidence score computed. Null for needsManualReview.
confidencex5fscoreinteger or nullThe model’s confidence in the extraction (0–100). Null for needsManualReview.

The needsManualReview field is a special output. Its value is true when any extracted field has a confidence score (rounded) less than its configured threshold. Its confidence properties are always null.

Confidence scores in

Confidence scores in extractedData are integers from 0 to 100. In extractedDataJson, the same scores are represented as decimals from 0 to 1.0. For example, a score of 99 in extractedData appears as 0.99 in extractedDataJson.

Note

Usage 

Sample Input

This sample extracts data from a Base64-encoded PDF by using the Extract Data from Document action.

1{
2  "inputs": [
3    {
4      "fileContent": "JVBERi0xLjQKJeLj...",
5      "mimeType": "application/pdf",
6      "documentProcessingConfiguration": "Invoice_Extraction"
7    }
8  ]
9}

Sample Output

The response returns extracted field values with confidence scores.

1[
2  {
3    "actionName": "extractDataFromDocument",
4    "errors": null,
5    "invocationId": null,
6    "isSuccess": true,
7    "outcome": null,
8    "outputValues": {
9      "contentDocumentId": null,
10      "extractedData": {
11        "phonex20number_set": true,
12        "phonex20number": {
13          "value_set": true,
14          "value": "+1-541-754-3010",
15          "confidencex5fthreshold_set": true,
16          "confidencex5fthreshold": 80,
17          "confidencex5fscore_set": true,
18          "confidencex5fscore": 99
19        },
20        "needsManualReview_set": true,
21        "needsManualReview": {
22          "value_set": true,
23          "value": true,
24          "confidencex5fthreshold_set": null,
25          "confidencex5fthreshold": null,
26          "confidencex5fscore_set": null,
27          "confidencex5fscore": null
28        },
29        "invoicex20number_set": true,
30        "invoicex20number": {
31          "value_set": true,
32          "value": "00001",
33          "confidencex5fthreshold_set": true,
34          "confidencex5fthreshold": 80,
35          "confidencex5fscore_set": true,
36          "confidencex5fscore": 100
37        }
38      },
39      "documentProcessingConfigurationId": "1OfSG0000000Kd30AE",
40      "extractedDataJson": "{\"invoice number\":{\"type\":\"string\",\"value\":\"00001\",\"confidence_score\":1.0,\"confidence_threshold\":80.0},\"phone number\":{\"type\":\"string\",\"value\":\"+1-541-754-3010\",\"confidence_score\":0.99,\"confidence_threshold\":80.0},\"needsManualReview\":{\"type\":\"boolean\",\"value\":true}}"
41    },
42    "sortOrder": -1,
43    "version": 1
44  }
45]

Error Handling 

When extraction fails, isSuccess is false and the errors array contains details. Common causes include:

  • Invalid or nonexistent documentProcessingConfiguration name.
  • Unsupported mimeType value.
  • Malformed or empty fileContent (not valid Base64).
  • The file exceeds the org’s REST API request body size limit.
  • The caller lacks the Document Processing permission.

Considerations 

  • The fileContent and mimeType are always provided together. You can’t send one without the other.
  • Use fileContent to process a file directly without uploading it to Salesforce first. This approach avoids creating a ContentDocument record.
  • The maximum file size depends on your org’s REST API request body limits.
  • The needsManualReview flag is true when any field’s rounded confidence score falls less than its configured threshold.

See Also