# @nyris/nyris-api

> ## Install

Latest version **0.3.98** (published 2026-09-02) · 0 weekly downloads

## Install

```sh
npm install @nyris/nyris-api
pnpm add @nyris/nyris-api
yarn add @nyris/nyris-api
bun add @nyris/nyris-api
```

## Health

**Score 60/100 (C)** — status: active.

Positive: has types; no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no esm support; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.3.98 |
| Published | 2026-09-02 |
| First published | 2020-05-04 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 73.8 KB |
| Known vulnerabilities | 0 (+23 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | nyris-hfries, f.medini, nyris-itops |

## Links

- npm: https://www.npmjs.com/package/@nyris/nyris-api
- Homepage: https://github.com/nyris/nyris-webapp
- npm.io page: https://npm.io/package/@nyris/nyris-api

## Dependencies (5)

- [axios](https://npm.io/package/axios.md) ^0.21.1
- [@types/node](https://npm.io/package/@types/node.md) 20.11.26
- [blueimp-load-image](https://npm.io/package/blueimp-load-image.md) ^2.24.0
- [blueimp-canvas-to-blob](https://npm.io/package/blueimp-canvas-to-blob.md) ^3.16.0
- [@types/blueimp-load-image](https://npm.io/package/@types/blueimp-load-image.md) ^2.23.4

## Recent versions

- 0.3.98 (latest) — 2026-09-02
- 0.3.97 — 2026-08-24
- 0.3.96 — 2026-07-16
- 0.3.95 — 2026-07-13
- 0.3.94 — 2026-07-01
- 0.3.93 — 2026-05-21
- 0.3.92 — 2026-05-13
- 0.3.91 — 2026-04-14
- 0.3.90 — 2026-03-27
- 0.3.89 — 2025-12-18
- 0.3.88 — 2025-12-09
- 0.3.87 — 2025-11-14
- 0.3.86 — 2025-11-14
- 0.3.85 — 2025-11-07
- 0.3.84 — 2025-11-05
- … 94 more at https://npm.io/package/@nyris/nyris-api/versions

## README

# nyris-api

## Install

```shell script
npm install @nyris/nyris-api
```

## Example usage

```javascript
import NyrisAPI, { urlOrBlobToCanvas } from "@nyris/nyris-api";

const settings = {
    xOptions: 'default', // optional, see "General request options" https://docs.nyris.io/#general-request-options for available options
    apiKey: '<YOUR_API_KEY>',
    jpegQuality: 0.9, // 
    maxWidth: 500, // Maximal image size sent to server
    maxHeight: 500,
    responseFormat: 'application/offers.complete+json' // optional, see "Response type" https://docs.nyris.io/#response-type

};
const api = new NyrisAPI(settings);

const image = await urlOrBlobToCanvas("http://...");
const results = await api.findByImage(image, {});
console.log(results);
```

## api methods


### Search for an image
```typescript
find(options: ImageSearchOptions, canvas: HTMLCanvasElement | HTMLImageElement | HTMLVideoElement, filters?: Filter[], xOptions?: any) : Promise<SearchResult>
```

The image has to be an image-like HTML object.
Example options:
```javascript
const options = {
    geoLocation: { lat: 52.5, lon: 13.4, dist: 50 },
    cropRect: {x1: 0.3, x2: 0.7, y1: 0.3, y2: 0.7}
}
```

### Search for an SKU (itemID)

```javascript
findBySku(sku: string, mid: string): Promise<SearchResult>
```

### Search for significant sections in the image.
```javascript
findRegions(canvas: HTMLCanvasElement | HTMLVideoElement | HTMLImageElement): Promise<Region[]>
```

### Send feedback event.

```javascript
sendFeedback(sessionId: string, requestId: string, payload: FeedbackEventPayload)
```

See [Click and conversion analytics](https://docs.nyris.io/#click-and-conversion-analytics).

Example feedback events:
```javascript

// Signal a successful or failed search
const success = {
    request_id: "<REQUEST_ID>",
    timestamp: new Date(),
    session_id: "<SESSION_ID>",
    event: 'feedback',
    data: { success: true }
};

// Signal a selected region
const region = {
    request_id: "<REQUEST_ID>",
    timestamp: new Date(),
    session_id: "<SESSION_ID>",
    event: 'region',
    data: { rect: { x: 0.1, y: 0.1, w: 0.2, h: 0.2 } }
};

// Signal a clicked result
const click = {
    request_id: "<REQUEST_ID>",
    timestamp: new Date(),
    session_id: "<SESSION_ID>",
    event: 'click',
    data: { positions: [4]} // position of the result in the results list
};
```

---
_Source: https://npm.io/package/@nyris/nyris-api · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
