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 contains the actual response data returned by the API. The structure of this object will vary depending on the specific endpoint being called. | After confirming there is no error, you can access this field to retrieve the requested information |
metadata | object or null (optional) | This 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. |
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.
Example JSON Response
Successful Response
In a successful response, the API returns the requested data along with any relevant metadata:Error Response
If an error occurs, the response will provide information about the error:Pagination
Many Messari API endpoints that return multiple items support pagination to help you navigate through large result sets. Pagination information is included in themetadata
field of the response.
The pagination structure contains the following attributes:
Request ID
Each API request has an associated request identifier. You can find this value in the response headers, underx-request-id
. To expedite the resolution process, provide the request identifier when you contact us about a specific request.