Skip to main content

API Key Usage

Every request to the AIGEN API requires authentication via an API key. You can obtain one by creating an account on the AIGEN website.

Authentication Methods

Include your API key in the X-AIGEN-KEY header:

curl -X POST 'https://api.aigen.online/aiscript/idcard/v3' \
-H 'X-AIGEN-KEY: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"image": "<base64_string>"}'

Option 2: Query Parameter

Pass the API key as a query parameter named aigen_key:

curl 'https://api.aigen.online/aiscript/idcard/v3?aigen_key=YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"image": "<base64_string>"}'
When to use query parameters

This method is useful in environments where custom HTTP headers are restricted, such as webhook integrations (e.g., LINE webhook) or no-code platforms.

Security Best Practices

  • Keep your API key secret — Never expose it in client-side code, public repositories, or browser requests.
  • Use environment variables — Store your API key in environment variables, not hardcoded in source code.
  • Rotate compromised keys — If you suspect your key has been exposed, regenerate it immediately through the API management page.
  • Restrict usage — Use separate API keys for development and production environments.

Error Responses

HTTP StatusDescription
401Missing or invalid API key
403API key does not have permission for this endpoint
429API credit has been exhausted — top up your account to continue