API Key
Generating an API Key
API keys can be created on the API Access page.
Permissions
By default all users have access to the Metrics, News, Assets and Market Data api endpoints. If you would like access to any other services, contact [email protected].
Using the API key
The API key must be included in the request headers using the x-messari-api-key
header field. This ensures secure access and proper authorization for your API requests.
Example Request (cURL)
The following example demonstrates how to send a request to the Messari API using cURL with the x-messari-api-key
header:
curl --location 'https://api.messari.io/ai/v1/chat/completions' \
--header 'x-messari-api-key: YOUR_API_KEY_HERE' \
--header 'Content-Type: application/json' \
--data '{
"messages": [
{
"role": "user",
"content": "Briefly explain what the Hyperliquid HyperEVM is"
}
],
"verbosity": "succinct",
"response_format": "markdown"
}'
Security Best Practices
- Keep Your API Key Secure: Never share your API key publicly or commit it to version control (e.g., GitHub).
- Use Environment Variables: Store API keys in environment variables rather than hardcoding them in your code.
- Rotate API Keys Regularly: Periodically update your API key for security purposes.