Metrics APIs
![Thumbnail icon](/img/icons/metrics.png)
The Metrics Query API lets you execute Metrics queries from third-party scripts and applications so that you can reformat the results as desired.
Refer to Getting Started for Sumo Logic API Authentication, Endpoints, and Security.
Our APIs are built with OpenAPI. You can generate client libraries in several languages and explore automated testing.
To access our API documentation, navigate to the appropriate link based on your Sumo deployment. Deployment types differ based on geographic location and account creation date. If unsure, see How to determine your endpoint.
Prerequisites
You will need:
- An Enterprise account. For more information, see Sumo Logic Credits accounts or Cloud Flex (Legacy) Accounts, depending on the Sumo Logic package you have.
- An access key/access ID for authentication. Username/password are not supported.
Endpoints for API access
Sumo Logic has deployments that are assigned depending on the geographic location and the date an account is created. For API access, you must manually direct your API client to the correct Sumo Logic API URL.
See Sumo Logic Endpoints for the list of the URLs.
An HTTP 301 Moved
error suggests that the wrong endpoint was specified.
Rate limiting
- A rate limit of four API requests per second (240 requests per minute) applies to all API calls from a user.
- A rate limit of 10 concurrent requests to any API endpoint applies to an access key.
If a rate is exceeded, a rate limit exceeded 429 status code is returned.
Errors
The APIs return operation failures with a description and error code, including the following generic errors that apply to all APIs:
Code | Error | Description |
---|---|---|
301 | moved | The requested resource SHOULD be accessed through returned URI in Location Header. |
401 | unauthorized | Credential could not be verified. |
403 | forbidden | This operation is not allowed for your account type. |
404 | notfound | Requested resource could not be found. |
405 | method.unsupported | Unsupported method for URL. |
415 | contenttype.invalid | Invalid content type. |
429 | rate.limit.exceeded | The API request rate is higher than 4 request per second. |
500 | internal.error | Internal server error. |
503 | service.unavailable | Service is currently unavailable. |
API details
Executing a query
To execute a metrics query, send a JSON request to the endpoint.
Method: POST
Example endpoint: https://api.sumologic.com/api/v1/metrics/results
Which API endpoint should I use?
To determine which Sumo Logic API endpoint you should use, find the deployment pod referenced in your browser's Sumo Logic service URL.
If you see https://service.us2.sumologic.com
, for example, that means you're running on the US2 pod and need to use the API endpoint https://api.us2.sumologic.com/api/
. For the service URL https://service.eu.sumologic.com
, you'd need to use the API endpoint https://api.eu.sumologic.com/api/
, and so on. The only exception is the US1 pod (https://service.sumologic.com
), which uses the API endpoint https://api.sumologic.com/api/
.
To view all available endpoints, see Sumo Logic Endpoints.
Headers
Header | Value |
Content-Type | application/json |
Accept | application/json |