API Key Authentication
Overview for obtaining and using an Intuition API Key.
Your Intuition API Key serves as the cornerstone of authentication when interacting with the Intuition API. It plays a crucial role in securing and authorizing your requests, ensuring that they are recognized and permitted. This is required to use our public API.
Getting Your API Key
Since your API Key is connected to your Ethereum wallet address, we've created an API Key Portal where you can obtain and view your API Key.
The Dev Quick Start page contains a walkthrough of this process. You can also go directly to the API Key Portal and sign the message.
Authenticating With Your API Key
Once you've obtained your Intuition API Key you can then begin interacting with the Intuition API. You'll need to include your valid API Key as a header
in every API request.
Let's look at key points for authenticating with your API Key.
Including Your API Key in Requests
You'll want to pass in your API Key in the x-api-key
header, such as:
x-api-key: YOUR_API_KEY
Replace the <API_Key>
with your valid API Key that you obtained from the API Key Portal.
Using Environment Variables
Be sure to follow best practices for protecting your API Key. One way to ensure safety is to use environment variables to prevent it from being leaked client-side on your requests. Be sure to also include this in any .gitignore
to prevent your .env
from being included in version control. It's highly recommended to follow this best practice and to avoid hardcoding your API Key value into your codebase.
If you're using Remix, Next.js, or any other frontend framework that supports using .env
we recommend that you include your API Key and access it via environment variables to prevent it from any unintentional client-side leaking.
Here is a general example of how you could include your API_KEY
in a .env
file:
This is a generalized example of how you can then reference your API_KEY
via environment variables. Each framework will handle this slightly differently, but this high-level approach can be used as a reference:
Note that frameworks such as Remix don't require the import 'dotenv/config';
, and that Vite uses import.meta.env
instead. Consult the documentation for the framework that you're using:
Last updated