Skip to main content
Every API request needs an API key in the Authorization header.
Authorization: Bearer $GETIMG_API_KEY

Get your API key

Create and manage API keys in the developer settings.

Use your key

import GetimgAI from "getimg-ai";

const client = new GetimgAI({
  apiKey: process.env.GETIMG_API_KEY, // default, can be omitted
});

const result = await client.images.generate({
  model: "seedream-5-lite",
  prompt: "A sunset over the ocean",
});

Security best practices

  • Store API keys in environment variables, not source code.
  • Add .env files to .gitignore.
  • Revoke compromised API keys in developer settings and create replacements.
  • Use separate API keys for development and production.

Authentication errors

Missing, malformed, or invalid keys return 401 with error code invalid_api_key.
{
  "error": {
    "message": "Incorrect API key provided. You can manage your API keys at https://getimg.ai/app/developer/api-keys",
    "type": "invalid_request_error",
    "param": null,
    "code": "invalid_api_key",
    "doc_url": "https://docs.getimg.ai/guides/authentication"
  }
}
See Errors for error handling and retry guidance.