Summary
When working with the Messari Crypto API, always check the error
field in the JSON response to determine if your request was successful. If error
is null
, proceed to access the data
field for the necessary information. Additionally, review the metadata
field, if available, for extra context regarding your API call. This standardized response structure helps ensure that developers can consistently handle and interpret API responses effectively across all endpoints.
ResponseWithMetadata Structure
The ResponseWithMetadata
structure is the standard response format returned by the Messari Crypto API for all API calls. This structure ensures that clients receive a consistent format, simplifying the process of handling API responses.
Response Structure
Response Structure
A typical response from the Messari Crypto API will be in JSON format and will look like the following:
{
"error": null,
"data": {
// Data specific to the API endpoint
},
"metadata": {
// Additional contextual information (optional)
}
}
Fields Explained
Field | Type | Description | Usage |
---|---|---|---|
error | string or null | This field indicates whether an error occurred during the API request. If the request was successful, this field will be null. If there was an error, it will contain a descriptive error message explaining what went wrong. | Always check this field first to determine if your API call was successful before attempting to access the data |
data | object (varies based on the endpoint) | This field indicates whether an error occurred during the API request. If the request was successful, this field will be null. If there was an error, it will contain a descriptive error message explaining what went wrong. | After confirming there is no error, you can access this field to retrieve the requested information |
metadata | object or null (optional) | his optional field may include additional contextual information related to the API response, such as pagination details, request duration, or trace information. If there are no additional details to provide, the metadata field may be omitted entirely from the response. | If present, this field can provide useful insights for managing and optimizing your API usage. |
Example JSON Response
Successful Response
In a successful response, the API returns the requested data along with any relevant metadata:
{
"error": null,
"data": {
"messages": [
{
"role": "assistant",
"content": "### Overview of Hyperliquid HyperEVM\n\n**Hyperliquid HyperEVM** is an innovative integration of the Ethereum Virtual Machine (EVM) into Hyperliquid's Layer 1 blockchain, announced on February 18, 2025. \n\n#### Key Features and Highlights:\n1. **EVM Integration**: HyperEVM allows for enhanced programmability and performance for Ethereum-compatible smart contracts within the Hyperliquid ecosystem.\n2. **Spot Transfers**: The initial release supports spot transfers between native HYPE and HyperEVM HYPE.\n3. **DeFi Enhancement**: The HyperEVM includes elements such as a canonical WHYPE system contract to support decentralized financial applications.\n4. **Security and Consensus**: It maintains robust security through HyperBFT consensus, ensuring reliable operation within the network.\n5. **Performance Improvements**: The integration aims to provide high transaction capacity and low fees, leveraging Hyperliquid's highly optimized trading infrastructure.\n\n#### Additional Developments:\n- **Bug Bounty Program**: To enhance security, a bug bounty program was launched offering substantial rewards for identifying vulnerabilities in the system.\n- **Future Upgrades**: Plans include enabling ERC-20 native transfers and additional precompiles to expand functionality.\n\nThis new integration positions Hyperliquid as a comprehensive DeFi ecosystem, aiming to leverage the strengths of EVM with the robust infrastructure of its native blockchain."
}
]
},
"metadata": {
"status": "Completed",
"trace_id": "df89a737-b988-4643-97ba-08645ef8bd77"
}
}
Error Response
If an error occurs, the response will provide information about the error:
{
"error": "Invalid API key",
"data": null,
}
For more information on handling errors and the status codes that accompany unsuccessful requests, see the errors page.
Request ID
Each API request has an associated request identifier. You can find this value in the response headers, under x-request-id
. To expedite the resolution process, provide the request identifier when you contact us about a specific request.