wrenchConfigure the Client

Reference documentation on preparing and configuring the Mindee client.

circle-info

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 for a quick TL;DR, or full code samples?

  • Take a look at the Quick Start page.

  • Ask our documentation AI to write code samples for you: You can also use the "ask" button at the top of any page in the documentation.

Requirements

Before proceeding you'll need to have one of the official Mindee client libraries installed.

You'll also need to use one of your Integration Overview and one or several Models configured.

Overview

Before sending any files to the Mindee servers for processing, you'll need to initialize your client and set inference options.

These settings will determine how your files are sent, including any extra options, and how you want to process the result.

Initialize the Mindee Client

This should be the first step in your code. It will determine which organization is used to make the calls.

You should reuse the same client instance for all calls of the same organization.

The client instance is thread-safe where applicable.

First import the needed classes:

For the API key, you can pass it directly to the client. This is useful for quick testing.

Instead of passing the key directly, you can also set the following environment variable:

MINDEE_V2_API_KEY

This is recommended for production use. In this way there is no need to pass the api_key when initializing the client.

Set Product Parameters

Product parameters control:

  • which model to use

  • server-side processing options

  • how the results will be returned to you

Use an Alias

You can set an alias for linking the sent file to your own system.

For example, you could use an internal PO number, or your database ID.

Aliases are not unique in our database, you can use the same alias multiple times.

Only the model_id is required.

Optional Features Configuration

Enable or disable Optional Features.

circle-info

Enabling a feature not in your plan will result in a Payment Required error (HTTP 402).

Check the Feature Comparison section for more information.

The default activation states for Optional Features are set on the platform. Any values set here will override the defaults.

Leave empty or null to use the default platform values.

For example: if the Polygon feature is enabled on the platform, and polygon is explicitly set to false in the parameters ⇒ the Polygon feature will not be enabled for the API call.

Only the model_id is required.

Dynamic Model Options

These options allow changing how the model performs an inference on a per-call basis.

As such they can only be used via API.

Text Context

Give additional guidelines to the model to help it better process a specific document.

This is a free-form text format.

Data Schema

In the rare cases when Text Context and/or RAG is not enough.

Directly modify the Data Schema: add, remove, or change fields.

To download the JSON string appropriate for your model:

  1. Go to your model's page

  2. On the left-hand menu, click on "General Settings"

  3. Scroll down to the "Actions" section

  4. Click on the "Download Data Schema" button:

    The "Download Data Schema" button

Code Sample

The Data Schema can be passed as a JSON string or by instantiating the appropriate classes.

If passed as a JSON string, it will be validated in the client before being sent to the server.

Only the model_id is required.

Next Steps

Now that everything is ready to, it's time to send your files to the Mindee servers.

If you're sending a local file, head on over to the Load and Adjust a File section for details on the next step.

If you're sending an URL, head on over to the Send a File or URL section.

Last updated

Was this helpful?