Skip to content

Authentication

Authenticated Sharpe API requests under https://www.sharpe.ai/api/v1/* require an API key. The API supports two production-safe authentication methods: a Bearer token in the Authorization header (recommended) or an X-API-Key header. The API is paid-only: a key works while its account has an active plan, and there is no free tier and no keyless API.

Getting your API key

  1. Sign in and choose a plan at /dashboard/billing (Hobbyist, Pro or Commercial; see Rate limits for what each includes). Plans are paid in USDC, or any token swapped at checkout, through MoonPay Commerce.
  2. Create your key from the API key dashboard. Creating a key without an active plan answers 402.

Each account has one API key. The REST API and the MCP server both use it and share the plan's monthly quota.

A key without an active plan

A key whose plan has ended answers 401 with type expired_api_key and the detail "This API key has no active plan. Subscribe or renew at https://www.sharpe.ai/dashboard/billing." Nothing is charged automatically: renewal reminders arrive on each of the 5 days before the paid period ends, and the key keeps working for 3 days after it. Renew at /dashboard/billing and the same key works again.

Every account gets one trial before it needs a plan: 7 days and 250 requests, starting with the key's first request (see Rate limits). A key issued before 2026-11-11 no longer answers for free: its first request after that day starts the same trial. Once the trial is over the key answers 401 expired_api_key with the detail "This account's trial has ended. Choose a plan at https://www.sharpe.ai/pricing and this key works again." until the account has a plan.

Two endpoints need no key: /v1/health and /v1/meta/coverage.

Once you have your key, store it in an environment variable:

Store your key

export SHARPE_API_KEY="sk_live_your_key_here"

Verify the key works by making a test request:

Verify your key

curl -s -o /dev/null -w "%{http_code}\n" \
  https://www.sharpe.ai/api/v1/funding/rates?type=current \
  -H "Authorization: Bearer $SHARPE_API_KEY"
# Should print 200

Pass your API key as a Bearer token in the Authorization header. This is the standard approach and works with most HTTP clients out of the box.

Bearer token authentication

curl https://www.sharpe.ai/api/v1/funding/rates?type=current \
  -H "Authorization: Bearer sk_live_your_key_here"

X-API-Key header

As an alternative, you can pass the key in the X-API-Key header. This is useful in environments where the Authorization header is reserved or stripped by a proxy.

X-API-Key authentication

curl https://www.sharpe.ai/api/v1/funding/rates?type=current \
  -H "X-API-Key: sk_live_your_key_here"

Query parameters are not accepted

API keys must not be sent in URLs. Query strings are captured by browser history, server logs, analytics tools, and referrer headers, so ?api_key= requests are rejected by default. Use Authorization: Bearer or X-API-Key instead.

Key format

When both supported authentication methods are present, the API uses this precedence order: Authorization: Bearer header > X-API-Key header. Only the highest-priority credential is evaluated.

All API keys follow a predictable format so you can identify them in logs and configuration:

PrefixEnvironmentExample
sk_live_Productionsk_live_a1b2c3d4e5f6...

Keys are 56 characters long including the prefix (8-character prefix + 48 hex characters). Treat them like passwords. Never commit them to source control or expose them in client-side code.

Rate limit and quota headers

Every authenticated v1 API response includes headers that tell you where you stand against your per-minute rate limit and monthly quota:

  • Name
    X-RateLimit-Limit
    Type
    integer
    Description

    Maximum number of requests allowed per minute on your plan.

  • Name
    X-RateLimit-Remaining
    Type
    integer
    Description

    Number of requests remaining in the current window.

  • Name
    X-RateLimit-Reset
    Type
    integer
    Description

    Unix timestamp (seconds) when the rate limit window resets.

  • Name
    X-Quota-Limit
    Type
    integer
    Description

    Monthly request quota of your plan. It resets on the 1st of each month (UTC).

  • Name
    X-Quota-Remaining
    Type
    integer
    Description

    Monthly requests remaining in the current billing period.

  • Name
    X-Quota-Reset
    Type
    string
    Description

    ISO 8601 timestamp when the monthly quota resets. Included when the quota store returns a reset timestamp.

  • Name
    X-Request-Id
    Type
    string
    Description

    Unique identifier for the request. Include this when contacting support.

Example response headers

HTTP/2 200
content-type: application/json
x-ratelimit-limit: 120
x-ratelimit-remaining: 118
x-ratelimit-reset: 1743062460
x-quota-limit: 300000
x-quota-remaining: 299812
x-quota-reset: 2026-12-01T00:00:00.000Z
x-request-id: req_abc123def456

Security best practices

  • Rotate keys regularly and immediately if you suspect a compromise
  • Use environment variables to store keys instead of hardcoding them
  • Revoke lost keys from the API key dashboard before creating replacements
  • Restrict by IP if your plan supports IP allowlisting

Was this page helpful?