Authentication

Overview

The Nansen API uses API key authentication. All requests must include your API key in the apikey header.

Getting Your API Key

  1. Log in to your Nansen Account

  2. Generate a new API key

Using Your API Key

Header Format

apikey: YOUR_API_KEY

curl Example

curl -X POST 'https://api.nansen.ai/api/v1/smart-money/holdings' \
  -H 'Content-Type: application/json' \
  -H 'apikey: YOUR_API_KEY' \
  -d '{"chains": ["ethereum"]}'

Python Example

Python with Environment Variable

Authentication Errors

401 Unauthorized

Returned when the API key is missing or invalid:

Solutions:

  • Verify your API key is correct

  • Ensure the header name is apikey (lowercase)

  • Check that the key hasn't been revoked

403 Forbidden

Returned when the API key doesn't have permission for the requested resource:

Solutions:

  • Verify your subscription tier includes access to this endpoint

  • Contact support to upgrade your plan

Key Management

If your key is compromised:

  1. Immediately revoke it in your dashboard

  2. Generate a new key

  3. Update all applications using the old key

Last updated

Was this helpful?