Registry / http-networking / tineye-api

tineye-api

JSON →
library2.0.6jsnpmunverified

The `tineye-api` package is the official Node.js library for interacting with the TinEye API, a commercial reverse image search solution. It enables developers to programmatically search for images using a URL or raw image data, retrieve the number of remaining searches, and query the total indexed image count. The current stable version is 2.0.6, which primarily includes updates to underlying dependencies like Axios and Jest, with no functional changes from 2.0.5. Releases appear to focus on maintenance and dependency updates rather than frequent new features, implying a stable API. Its key differentiator is being the official, supported client for accessing the paid TinEye API, ensuring compatibility and adherence to API specifications for professional and high-volume users. It simplifies authentication and request handling, abstracting away the complexities of HMAC-SHA256 authentication for previous versions, now using a simpler header key.

npm install tineye-api
INSTALL
IMPORT
SIG · TINEYE-API
T
tineye-api
http-networkingjavascriptv2.0.6
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

TinEye
✓ const TinEye = require('tineye-api');
✗ import TinEye from 'tineye-api';
The library primarily uses CommonJS `require` syntax as shown in official examples. While `import { TinEye } from 'tineye-api';` may work in ES module environments, the CommonJS pattern is the documented and most reliable approach.

Demonstrates how to instantiate the TinEye API client with an API key, perform a reverse image search using a public image URL, and check the remaining search credits for your account.

const TinEye = require('tineye-api'); const fs = require('fs'); // Needed if using searchData with local files // Your actual API key from TinEye. Recommended to use environment variables. // For testing, you can use the sandbox key: "6mm60lsCNIB,FwOWjJqA80QZHh9BMwc-ber4u=t^" const apiKey = process.env.TINEYE_API_KEY ?? "6mm60lsCNIB,FwOWjJqA80QZHh9BMwc-ber4u=t^"; // Sandbox key for demonstration const apiBaseUrl = "https://api.tineye.com/rest/"; // Use "https://api.tineye.com/rest/" for production const api = new TinEye(apiBaseUrl, apiKey); // --- Example 1: Search using an image URL --- async function searchByUrl() { const imageUrl = "https://tineye.com/images/meloncat.jpg"; const params = { offset: 0, limit: 1, sort: "score", order: "desc" }; try { console.log(`\nSearching for URL: ${imageUrl}`); const response = await api.searchUrl(imageUrl, params); console.log("Search by URL results (first item):", JSON.stringify(response.results[0], null, 2)); } catch (error) { console.error("Error searching by URL:", error.message); } } // --- Example 2: Get remaining searches --- async function getRemainingSearches() { try { console.log("\nGetting remaining searches..."); const response = await api.remainingSearches(); console.log("Remaining searches:", response.results); } catch (error) { console.error("Error getting remaining searches:", error.message); } } // Run examples async function runExamples() { await searchByUrl(); await getRemainingSearches(); } runExamples();
Debug
Known issues
breakingVersion 2.0.0 introduced a significant change to the authentication method. The API constructor now accepts a single `api_key` parameter instead of separate `publicKey` and `privateKey` parameters. The value for `api_key` is your previous `privateKey`.
fix
Update your `TinEye` constructor instantiation from `new TinEye(url, publicKey, privateKey)` to `new TinEye(url, apiKey)` where `apiKey` is your old `privateKey`.
affects: >=2.0.0
gotchaUsing the provided sandbox API keys (e.g., "6mm60lsCNIB,FwOWjJqA80QZHh9BMwc-ber4u=t^") will allow the API client to function, but it will not return real search results from the TinEye index. It's intended for integration testing only.
fix
For production use or to get actual search results, replace the sandbox key with a valid, paid TinEye API key obtained from your account dashboard.
affects: >=1.0.0
gotchaEnsure the correct TinEye API base URL, including the `/rest/` path, is provided during client instantiation. Omitting or incorrectly specifying this path may lead to connection errors or invalid API responses.
fix
Confirm the `apiBaseUrl` parameter in the `TinEye` constructor matches the official documentation, typically `https://api.tineye.com/rest/` for production or `https://sandbox.tineye.com/rest/` for the sandbox environment.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: TinEye is not a constructor
The `TinEye` class was not correctly imported or required.
fix
Ensure you are using `const TinEye = require('tineye-api');` at the top of your file for CommonJS modules, or `import { TinEye } from 'tineye-api';` for ES Modules if your environment supports it and the package is configured for it.
Error: Request failed with status code 401
The API key provided is invalid, missing, or unauthorized for the requested operation.
fix
Double-check that your `apiKey` passed to the `TinEye` constructor is correct and active. For versions 2.0.0 and above, ensure you are passing only your `privateKey` as the `apiKey`.
ReferenceError: fs is not defined
Attempting to use `api.searchData()` with local file paths (e.g., `fs.readFileSync`) without importing Node.js's built-in `fs` module.
fix
Add `const fs = require('fs');` at the top of your file if you intend to read image data from the local filesystem for `searchData`.
Upgrade
Version history
2.0.6latest on npm
Audit
Dependencies
axiosrequiredUsed for making HTTP requests to the TinEye API.
form-datarequiredUsed for constructing multipart/form-data requests when submitting image data.
Agent activity
14 hits · last 30 days
node
12
OpenAI (training)
1
Resources
tineye-api — npm install tineye-api · libregistry