Getty Images Node.js SDK

6.5.4 · active · verified Sun Apr 19

The `gettyimages-api` package provides an official Node.js SDK for interacting with the Getty Images API, simplifying common tasks such as searching for creative and editorial images, retrieving image and video metadata, and managing media downloads. It handles credential management, including access token refresh, and employs a fluent API style for constructing requests. The current stable version is 6.5.4, released recently on April 17, 2026. While there isn't a fixed release cadence, updates are regularly pushed, often addressing dependency vulnerabilities, minor bug fixes, or adding small feature enhancements. Key differentiators include its direct support and maintenance by Getty Images, streamlined authentication and token management, and a fluent API design that abstracts away raw HTTP requests and complex URL construction, making API interaction more developer-friendly compared to manual integration.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates initializing the Getty Images API client and performing a creative image search using environment variables for credentials.

import api from "gettyimages-api";

// Ensure you set these environment variables before running:
// process.env.GETTY_API_KEY and process.env.GETTY_API_SECRET
const creds = {
    apiKey: process.env.GETTY_API_KEY ?? '',
    apiSecret: process.env.GETTY_API_SECRET ?? ''
};

if (!creds.apiKey || !creds.apiSecret) {
    console.error("Error: API Key and Secret must be provided via environment variables.");
    process.exit(1);
}

const client = new api(creds);

async function searchImages() {
    try {
        console.log("Searching for creative images...");
        const response = await client.searchimagescreative()
            .withPage(1)
            .withPageSize(1)
            .withPhrase('ocean')
            .execute();
        console.log("Found image:", JSON.stringify(response.images, null, 2));
    } catch (err) {
        console.error("An error occurred while searching for images:", err.message);
        if (err.response && err.response.data) {
            console.error("API Error details:", JSON.stringify(err.response.data, null, 2));
        }
    }
}

searchImages();

view raw JSON →