Curl Example

Prev Next

Follow these necessary steps to write and run a simple Curl command that queries the Red Canary API.

Prerequisites

Before running any code, ensure you have the following:

Query the API

Open the command line, and run the following command. Be sure to replace <API key> with your API key and <subdomain> with the subdomain you want to query.

curl -X "GET" -H "X-Api-Key:<API key>" "https://<subdomain>.my.redcanary.co/openapi/v3/endpoints"

The command should print a JSON object containing the first page of endpoints associated with the subdomain.

Customize your request with parameters

You can use HTTP parameters to customize the results of your request. Visit the Red Canary API docs for a list of supported parameters for each API endpoint.

Example: Limit the number of endpoints returned

Limit the number of endpoints returned by Curl using the per_page parameter.

Open the command line, run the following command. Be sure to replace <API key> with your API key and <subdomain> with the subdomain you want to query.

curl -X "GET" -H "X-Api-Key:<API key>" "https://<subdomain>.my.redcanary.co/openapi/v3/endpoints?per_page=1"

The command should print a JSON object containing exactly one endpoint.