Skip to content

📝 update documentation and supported versions #362

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/_test-code-samples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
- "18"
- "20"
- "22"
- "24"

steps:
- name: Check out Git repository
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/_test-integrations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- "macos-latest"
node-version:
- "18"
- "22"
- "24"
runs-on: ${{ matrix.os }}

steps:
Expand Down
168 changes: 22 additions & 146 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,163 +3,39 @@
# Mindee API Helper Library for Node.js
Quickly and easily connect to Mindee's API services using Node.js.

## Quick Start
Here's the TL;DR of getting started.
## Mindee API Versions
This client library has support for both Mindee platform versions.

First, get an [API Key](https://developers.mindee.com/docs/create-api-key)
### Latest - V2
This is the new platform located here:

Then, install this library:
```shell
npm install mindee
```
https://app.mindee.com

Finally, Node.js away!
It uses **API version 2**.

### Loading a File and Parsing It
Consult the
**[Latest Documentation](https://docs.mindee.com/integrations/client-libraries-sdk)**

#### Global Documents
```js
const mindee = require("mindee");
// for TS or modules:
// import * as mindee from "mindee";

// Init a new client
const mindeeClient = new mindee.Client({ apiKey: "my-api-key" });
### Legacy - V1
This is the legacy platform located here:

// Load a file from disk
const inputSource = mindeeClient.docFromPath("/path/to/the/file.ext");
https://platform.mindee.com/

// Parse it on the API of your choice
const apiResponse = mindeeClient.parse(mindee.product.InvoiceV4, inputSource);
```
It uses **API version 1**.

**Note:** Files can also be loaded from:

A base64 encoded string:
```js
const inputSource = mindeeClient.docFromBase64(myInputString, "my-file-name.ext")
```
Consult the
**[Legacy Documentation](https://developers.mindee.com/docs/nodejs-getting-started)**

A byte sequence:
```js
const inputSource = mindeeClient.docFromBytes(myInputBytes, "my-file-name.ext")
```
## Additional Information

A stream:
```js
const inputSource = mindeeClient.docFromStream(myReadableStream, "my-file-name.ext")
```

A buffer:
```js
const inputSource = mindeeClient.docFromBuffer(myBuffer, "my-file-name.ext")
```

A URL (`https` only):
```js
const inputSource = mindeeClient.docFromUrl("https://my-url");
```

You can also load the document locally before sending it:
```js
const inputSource = mindeeClient.docFromUrl("https://my-url");
await inputSource.init();
const localInputSource = inputSource.asLocalInputSource();
```

**Note:** Files hidden behind redirections are rejected by the server; this solution helps to circumvent that issue.

#### Region-Specific Documents

Region-Specific Documents use the following syntax:

```js
const mindee = require("mindee");
// for TS or modules:
// import * as mindee from "mindee";

const mindeeClient = new mindee.Client({ apiKey: "my-api-key" });

const inputSource = mindeeClient.docFromPath("/path/to/the/file.ext");

// The IdCardV1 product belongs to mindee.product.fr, not mindee.product itself
const apiResponse = mindeeClient.parse(mindee.product.fr.IdCardV1, inputSource);
```

#### Custom Documents (docTI & Custom APIs)

Custom documents will require you to provide their endpoint manually.

```js
const mindee = require("mindee");
// for TS or modules:
// import * as mindee from "mindee";

// Init a new client
const mindeeClient = new mindee.Client({
apiKey: "my-api-key"
});

// Load a file from disk
const inputSource = mindeeClient.docFromPath("/path/to/the/file.ext");

// Create a custom endpoint for your product
const customEndpoint = mindeeClient.createEndpoint(
"my-endpoint",
"my-account",
"my-version" // will default to 1 if not provided
);

// Parse it
const apiResponse = await mindeeClient
.enqueueAndParse(
mindee.product.GeneratedV1,
inputSource,
{
endpoint: customEndpoint
}
);
```

### Handling the Return
```js
// Handle the response Promise
apiResponse.then((resp) => {
// print a string summary
console.log(resp.document.toString());

// individual pages (array)
console.log(res.document.inference.pages);
});
```

### Additional Options
Options to pass when sending a file to be parsed.

#### Page Options
Allows only sending certain pages in a PDF.

In this example we only send the first, penultimate, and last pages:

```js
const apiResponse = mindeeClient.parse(
mindee.product.InvoiceV4,
inputSource,
{
pageOptions: {
pageIndexes: [0, -2, -1],
operation: mindee.PageOptionsOperation.KeepOnly,
onMinPages: 2
}
});
```

You can also take a look at the **[Reference Documentation](https://mindee.github.io/mindee-api-nodejs/)**.

## License
**[Source Code](https://github.com/mindee/mindee-api-nodejs)**

**[Reference Documentation](https://mindee.github.io/mindee-api-nodejs/)**

**[Feedback](https://feedback.mindee.com/)**

### License
Copyright © Mindee

Available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).

## Questions?
[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g)
Loading