Clay logo

LeadMagic has made more than one billion API calls with Clay and won The Unstoppable Wheel award.

Recap
LeadMagicDocs

401 Errors

Fix invalid API key and authentication errors on LeadMagic API requests.

A 401 Unauthorized response means your API key wasn't accepted.

Quick checklist

  1. Header name: use X-API-Key (case-insensitive)
  2. Key value: copy fresh from Settings → API Keys
  3. No extra characters: no quotes, spaces, or line breaks in the key
  4. Key not revoked: check if the key was deleted in Settings

Correct request format

Common mistakes

MistakeFix
Key in query string (?api_key=)Use header only
Bearer prefix inside X-API-KeySend the key alone in X-API-Key, or use Authorization: Bearer <key>
Wrong workspace keyRegenerate if team changed key access

Key was working, now fails

  • Key may have been rotated or revoked: create a new one
  • Check if your subscription is active: past-due accounts may block API access
  • If you get 402 with code: "org_closed" instead of 401, the key is fine but the subscription has ended. Resubscribe and retry with the same key; rotating the key won't help

Getting 429 after repeated 401s

If the same rejected key is retried 10 or more times within 10 minutes, the API pauses it and returns 429 with a Retry-After header. Stop the retry loop, fix the key (or resubscribe for org_closed), then send requests again after the Retry-After time.

Integration-specific

  • Clay: Re-paste key in Clay integration settings
  • Zapier: Disconnect and reconnect the LeadMagic account
  • Custom code: Log the header value length (not the key itself) to verify it's being sent

Full auth guide: API documentation

Still failing? Contact support with timestamp and endpoint (not your API key).

Was this article helpful?