Skip to content

Get API Key

Authenticate with the API using a Personal Access Token (PAT) passed in the X-API-Key header.

  1. Sign in to GEN

    Go to gen.pro and sign in to your account.

  2. Navigate to API Keys

    Open Settings > API Keys from the sidebar.

  3. Create a key

    Click Create API Key. Give it a descriptive name (e.g., n8n-production or claude-code).

  4. Copy the key

    Your key is displayed once. Copy it immediately and store it somewhere secure.

    gen_pat_a1b2c3d4e5f6...

Pass the key in the X-API-Key header on every request:

Terminal window
curl https://api.gen.pro/v1/me \
-H "X-API-Key: $GEN_API_KEY"

A successful response confirms your key is valid:

{
"id": "user_abc123",
"email": "you@example.com",
"name": "Your Name"
}

You can list, rename, and revoke keys through the API itself:

Terminal window
# List all your keys
curl https://api.gen.pro/v1/persisted_tokens \
-H "X-API-Key: $GEN_API_KEY"
# Rename a key
curl -X PATCH https://api.gen.pro/v1/persisted_tokens/{token_id} \
-H "X-API-Key: $GEN_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "new-name"}'
# Revoke a key
curl -X DELETE https://api.gen.pro/v1/persisted_tokens/{token_id} \
-H "X-API-Key: $GEN_API_KEY"

Your API key inherits the permissions of the user who created it. Here’s what determines what you can do:

RequirementWhat it means
Workspace creditsAuto Content Engine endpoints require active GEN credits on the workspace. No credits → 422 usable_gen_credit_required.
Owner or Manager roleYou can only access agents in workspaces where you are an owner or manager. Viewer and editor roles cannot use the API.
Agent scopeAll /v1/autocontentengine/ requests require an agent_id parameter. You can only use agents you have access to.
ActionOwnerManagerEditorViewer
List agents & enginesYesYesNoNo
Create/update contentYesYesNoNo
Trigger generationsYesYesNoNo
Create/delete agentsYesYesNoNo
Delete organizationYesNoNoNo
Manage API keysYesYesYesYes
  • Never commit keys to source control. Use environment variables or a secrets manager.
  • Use separate keys per integration. Create one key for n8n, another for Claude Code, etc. If one is compromised, revoke it without disrupting others.
  • Rotate keys regularly. Create a new key, update your integrations, then revoke the old one.
  • Restrict access. Only share keys with people and systems that need them.
Terminal window
# Store your key in an environment variable
export GEN_API_KEY="gen_pat_a1b2c3d4e5f6..."
# Or use a .env file (make sure it's in .gitignore)
echo "GEN_API_KEY=gen_pat_a1b2c3d4e5f6..." >> .env

For frontend integrations, you can authenticate with a JWT token instead of an API key:

Terminal window
curl https://api.gen.pro/v1/me \
-H "Authorization: Bearer <jwt-token>"

JWTs are issued during user login through the GEN web app and are validated against the GEN user database.

When to use each method:

MethodBest for
API Key (PAT)Server-to-server, scripts, MCP, CLI tools, n8n
JWTFrontend apps, browser-based integrations

The Agent Chat API at agent.gen.pro accepts the same authentication methods:

  • X-API-Key header with your PAT
  • Authorization: Bearer header with a JWT

Real-time progress streams are addressed by the run-specific firebase_path returned from POST /v1/agent/run. Treat that path as sensitive application data.