Failed to generate API key — fix and where to find API endpoint docs

If you see 'Failed to generate API key', 'API key generation error', or 'API key creation failure' on Settings → Integrations, sign out and back in to refresh your session, then retry. The same fix handles 'Failed to save company name' on the same page. Full list of API endpoints available is at /api-docs.

Failed to generate API key, what endpoints exist, AI rate limits

If you've asked "what API endpoints are available", "Failed to generate API key", "Failed to save company name", or hit "Rate limit exceeded" in the AI Copywriter / Campaign Doctor — this covers all four.

Where to generate an API key

  1. Go to /settings.
  2. Click the Integrations tab.
  3. Scroll to the API Keys section.
  4. Click Generate API Key and give it a name (e.g., "n8n production").
  5. Copy the key immediately — keys are shown once and prefixed capi_. They cannot be re-displayed after you leave the page.

Where the API documentation lives

Full docs are at /api-docs. You'll find:

  • All search endpoints (B2B leads, Local Leads, Creator Leads)
  • Authentication header format (Authorization: Bearer capi_...)
  • Per-row credit cost (each search row returned costs 1 lead credit on the API)
  • Rate limits per endpoint
  • Example requests in cURL and JavaScript

"Failed to generate API key" — what to try

The most common causes:

  1. Stale auth session — sign out and sign back in, then retry. This fixes ~70% of cases.
  2. Network or CSRF mismatch — hard reload (Cmd-Shift-R / Ctrl-Shift-R) the settings page, then retry.
  3. Browser extension blocking the request — try in an incognito window with extensions disabled.
  4. Profile not provisioned — extremely rare; happens if signup didn't fully complete. Submit a ticket and we'll backfill the profile row.

The same root causes also produce "Failed to save company name" on the same page.

"Rate limit exceeded" in AI Copywriter / Campaign Doctor

AI generation endpoints share a per-user rate limit:

| Plan | AI generation requests / minute | |---|---| | Free | 10 | | Pro / Scale / Enterprise | 60 | | Admin | 120 |

If you're iterating quickly on copy or running many sequence generations in a short window, you'll hit this. Wait 60 seconds and the counter resets.

This is a request-rate limit, not a usage quota — there is no monthly cap on AI generations beyond what your subscription includes.

Per-row API billing

API search endpoints charge 1 lead credit per row returned. A search returning 50 leads costs 50 credits. Every response includes a credits_used field so your integration can track spend per call.

To estimate cost before running a large query, hit the count endpoint first (which is free) — it returns the total match count without unlocking any rows.

Need a higher rate limit?

Submit a ticket with: your plan, the endpoint you're hitting, and the throughput you need (e.g., "200 leads_search/min for a one-week migration"). We can lift limits temporarily for legitimate bulk projects.

Was this article helpful?