API Authentication

Learn how to authenticate with the Owl Eyes API using API keys.

API Keys

Owl Eyes uses API keys to authenticate requests. You have two types of keys:

Publishable Key (pk_)

Safe to expose in frontend code. Used to initialize the SDK and create client-side verification sessions.

pk_live_abc123...

Secret Key (sk_)

Must be kept secret. Used for server-side API calls, creating verification links, and accessing sensitive data.

sk_live_xyz789...
Keep Secret Keys Secure
Never expose your secret key in frontend code, public repositories, or client-side applications. Treat it like a password.

Getting Your API Keys

  1. Navigate to API Access

    Go to Dashboard → API Access.

  2. View Your Keys

    Your publishable key is visible. Click "Reveal" to view your secret key.

  3. Copy and Store Securely

    Copy your keys and store them in environment variables or a secrets manager.

Authentication Methods

Bearer Token (Recommended)

Pass your secret key in the Authorization header:

Terminalbash
Loading...

Query Parameter

Alternatively, pass the key as a query parameter (not recommended for production):

Terminalbash
Loading...
Note
Query parameter authentication may be logged in server access logs. Use Bearer token authentication in production.

Using API Keys in Code

Node.js

api-call.jsjavascript
Loading...

Python

api_call.pypython
Loading...

Go

api_call.gogo
Loading...

Test vs Live Keys

Each environment has its own set of API keys:

EnvironmentKey PrefixUse Case
Test/Sandboxpk_test_ / sk_test_Development, testing, CI/CD
Live/Productionpk_live_ / sk_live_Production applications

Test keys work with the sandbox API and don't process real verifications. Use them during development to avoid charges.

environment.jsjavascript
Loading...

Rolling API Keys

If your secret key is compromised, roll it immediately:

  1. Generate New Key

    In the dashboard, click "Roll Secret Key" to generate a new key.

  2. Grace Period

    Both old and new keys work for 24 hours to allow migration.

  3. Update Your Application

    Update your environment variables or secrets manager with the new key.

  4. Revoke Old Key

    After confirming the new key works, revoke the old key immediately.

IP Allowlisting

For additional security, restrict API access to specific IP addresses:

Terminalbash
Loading...

You can also configure this in the dashboard under API Access → Security Settings.

Authentication Errors

StatusErrorDescription
401invalid_api_keyAPI key is invalid or malformed
401expired_api_keyAPI key has been revoked
403insufficient_permissionsKey doesn't have access to this resource
403ip_not_allowedRequest from unauthorized IP address
error-response.jsonjson
Loading...

Best Practices

  1. Use environment variables

    Never hardcode API keys in your source code.

  2. Use a secrets manager

    Store keys in AWS Secrets Manager, HashiCorp Vault, or similar.

  3. Use different keys per environment

    Separate test and production keys. Don't share across environments.

  4. Enable IP allowlisting

    Restrict API access to your server's IP addresses.

  5. Rotate keys regularly

    Roll keys periodically as a security best practice.