Send a File or URL
Reference documentation on sending files or URLs for processing using Mindee client libraries.
This is reference documentation.
Code samples shown are only examples, and will not work as-is. You'll need to copy-paste and modify according to your requirements.
Looking full code samples?
You can also use the "Ask" button at the top of any page in the documentation.
Requirements
You'll need to have your Mindee client configured correctly as described in the Client Configuration section.
You can send either a local file or an URL to Mindee servers for processing.
There's no difference between sending a file or an URL, both are considered valid Input Sources.
Using a Local File
You'll need a Local Input Source as described in the Load and Adjust a File section.
A local file can be manipulated and adjusted before sending, as described in the Adjust the Source File section.
Using an URL
You'll need a URL Input Source as described in the Load an URL section.
The contents of a URL cannot be manipulated locally. You'll need to download it to the local machine if you wish to adjust the file in any way before sending.
Send with Polling
Send a document using polling, this is the simplest way to get started.
The client library will POST the request for you, and then automatically poll the API.
Polling Configuration
Remember to use the appropriate Product/Model class, examples use ExtractionParameters.
When polling you really only need to set the model_id .
You can also set the various polling parameters. However, we do not recommend setting this option unless you are encountering timeout problems.
When polling you really only need to set the modelId .
You can also set the various polling parameters. However, we do not recommend setting this option unless you are encountering timeout problems.
When polling you really only need to set the modelId .
You can also set the various polling parameters. However, we do not recommend setting this option unless you are encountering timeout problems.
When polling you really only need to set the model_id .
You can also set the various polling parameters. However, we do not recommend setting this option unless you are encountering timeout problems.
When polling you really only need to set the modelId .
You can also set the various polling parameters. However, we do not recommend setting this option unless you are encountering timeout problems.
When polling you really only need to set the modelId.
You can also set the various polling parameters. However, we do not recommend setting this option unless you are encountering timeout problems.
Polling Method Call
You'll need a valid input source, one of:
a local source created in Load and Adjust a File
a remote source created in Load an URL
The mindee_client, created in Client Configuration.
Use the enqueue_and_get_result method.
The mindeeClient, created in Client Configuration.
Use the enqueueAndGetResult method. Remember to use the appropriate Product/Model class, examples use Extraction.
The $mindeeClient , created in Client Configuration.
Use the enqueueAndGetResult method. Remember to use the appropriate Product/Model class, examples use ExtractionResponse.
The mindee_client, created in Client Configuration.
Use the enqueue_and_get_result method. Remember to use the appropriate Product/Model class, examples use Extraction.
The mindeeClient, created in Client Configuration.
Use the enqueueAndGetResult method. Remember to use the appropriate Product/Model class, examples use ExtractionResponse.
The mindeeClient, created in Client Configuration.
Use the EnqueueAndGetResultAsync method. Remember to use the appropriate product/model class, examples use ExtractionResponse.
Send with Webhook
Send a document using webhooks, this is recommended for production use, in particular for high volume.
You'll need a valid input source, one of:
a local source created in Load and Adjust a File
a remote source created in Load an URL
Webhook Configuration
The client library will POST the request to your Web server, as configured by your webhook endpoint.
For more information on webhooks, take a look at the Using Webhooks page.
When using a webhook, you'll need to set the model ID and the webhook ID(s) to use.
Remember to use the appropriate Product/Model class, examples use ExtractionParameters.
Webhook Method Call
You can specify any number of webhook endpoint IDs, each will be sent the payload.
Using the mindee_client, created in Initialize the Mindee Client.
Use the enqueue_inference method:
Note: You can use both methods!
First, make sure you've added a webhook ID to the InferenceParameters instance.
Then, call enqueue_and_get_result .
You'll get the response via polling and webhooks will be sent as well.
Using the mindeeClient, created in Initialize the Mindee Client.
Use the enqueue method:
Note: You can use both methods!
First, make sure you've added a webhook ID to the modelParams object.
Then, call enqueueAndGetResult and await the promise.
You'll get the response via polling and webhooks will be sent as well.
Using the $mindeeClient, created in Initialize the Mindee Client.
Use the enqueueInference method:
Note: You can also use both methods!
First, make sure you've added a webhook ID to the ExtractionParameters instance.
Then, call enqueueAndGetResult.
You'll get the response via polling and webhooks will be sent as well.
Using the mindee_client, created in Initialize the Mindee Client.
Use the enqueue method:
Note: You can use both methods!
First, make sure you've added a webhook ID to the inference_params hash.
Then, call enqueue_and_get_result .
You'll get the response via polling and webhooks will be sent as well.
Using the mindeeClient, created in Initialize the Mindee Client.
Use the enqueueInference method:
Note: You can use both methods!
First, make sure you've added a webhook ID to the InferenceParameters instance.
Then, call enqueueAndGetInference and handle the promise.
You'll get the response via polling and webhooks will be sent as well.
Using the mindeeClient, created in Initialize the Mindee Client.
Use EnqueueInferenceAsync method:
Note: You can also use both methods!
First, make sure you've added a webhook ID to the InferenceParameters instance.
Then, call EnqueueAndGetResultAsync.
You'll get the response via polling and webhooks will be sent as well.
Get Processing Status
Accessing processing information is done using the Job object and related method calls.
If you are using webhooks, we highly recommend storing the job's ID so you can retrieve this information for debugging purposes.
You can access:
the result URL
overall processing status
detailed errors, if any
status for each webhook sent
creation and completion times
etc
Sending Multiple Files
The Mindee API doesn't support sending multiple files at once, if you are processing large numbers of files, there are several strategies you can adopt.
There are two typical use cases: handling files on disk, or handling end-user uploads.
Files on Disk
When you need to process large amounts of files in a directory or multiple directories.
Typically you'll simply loop through all the files in the directories, and call the API for each one.
Here the usual concern is how long it will take to process all the files.
If you're polling, you can either use threading or asynchronous processes to send multiple files at the same time. Your programming language and framework will determine what works best.
If you are using webhooks, your throughput will be significantly higher than when polling, without needing to use threading or asynchronous programing. This is because you are not waiting on the server to send back results before moving on to the next file.
In both case, pay attention to the file upload limits on the Mindee server. The server will respond with a HTTP 429 code in case of excessive file uploads.
End-user Uploads
When you provide a service in which an end-user can upload documents directly on your platform.
Since all Mindee SDKs provide multiple ways of handling files in-memory, you don't need to write anything to disk. You can if you want to, of course!
Typically, you'll use either raw bytes or a stream object, depending on your language and framework. Send this directly to the Mindee SDK and process as usual (polling or webhook). More information in the section: Load a Source File
With this kind of setup, polling is perhaps less of a performance handicap if you have multiple server processes running and few users.
When you have many users uploading many files, basically when this is a core feature of your product or workflow, webhooks will give you more flexibility. For example you could have your upload process send the file directly to Mindee, and then have another process or micro-service to handle processing the results.
Getting Integration Help
The AI Assistant can provide you with custom code and advice.
Enterprise users benefit from custom integration assistance, don't hesitate to reach out to our support team.
Last updated
Was this helpful?

