Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.artnex.app/llms.txt

Use this file to discover all available pages before exploring further.

Every request to the Artnex API must include a valid API key. The API uses Bearer token authentication — you pass your key in the Authorization HTTP header, and the server validates it before processing your request.

Get your API key

1

Log in to your Artnex account

Go to artnex.ai and sign in.
2

Open your profile settings

Click your avatar in the top-right corner and select Profile Settings from the dropdown menu.
3

Navigate to the API section

Select the API tab in your settings. Click Generate API Key to create a new key.
4

Copy and store your key securely

Your key is shown once. Copy it immediately and store it in a password manager or secret manager — you cannot retrieve it again after closing the dialog.
If you lose your API key, you must revoke it and generate a new one. Any integrations using the old key will stop working immediately after revocation.

Pass your API key in requests

Include your key as a Bearer token in the Authorization header:
Authorization: Bearer YOUR_API_KEY
You must also set Content-Type: application/json for all POST requests.

Example requests

curl --request POST \
  --url https://api.artnex.ai/v1/generate \
  --header "Authorization: Bearer YOUR_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
    "prompt": "A serene mountain landscape at sunset",
    "model": "z-image-turbo",
    "width": 1024,
    "height": 1024
  }'

Handle 401 Unauthorized errors

A 401 Unauthorized response means the API could not validate your key:
{
  "success": false,
  "error": "invalid_api_key",
  "message": "The API key provided is not valid."
}
Common causes and fixes:
CauseFix
Missing Bearer prefixUse Authorization: Bearer YOUR_KEY, not just Authorization: YOUR_KEY
Extra whitespace in the headerEnsure there are no leading or trailing spaces around your key
Revoked or expired keyGenerate a new key in your profile settings
Wrong environment keyConfirm you are using a key from the correct account

Keep your API key secure

Never embed your API key directly in client-side code, mobile apps, or public repositories. Anyone who obtains your key can make API calls that consume your credits.
Best practices:
  • Store your key in an environment variable (e.g., ARTNEX_API_KEY) and read it at runtime.
  • Use a secrets manager such as AWS Secrets Manager, HashiCorp Vault, or Doppler in production environments.
  • Rotate your key regularly and immediately if you suspect it has been compromised.
  • Use separate keys for development, staging, and production so you can revoke them independently.
In server-side frameworks, load your key from process.env.ARTNEX_API_KEY (Node.js) or os.environ["ARTNEX_API_KEY"] (Python) rather than hardcoding it in source files.

Example: using an environment variable

curl --request POST \
  --url https://api.artnex.ai/v1/generate \
  --header "Authorization: Bearer $ARTNEX_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{"prompt": "A calm ocean at dawn", "model": "z-image-turbo"}'