This article describes how to quickly get started with the Endor Labs REST API using the Endor Labs command line tool endorctl
or curl
. For a more detailed guide, see Getting started with the REST API.
The following is an example request to get the number of findings in your namespace:
-
Authenticate with Endor Labs using
endorctl init
. For more information, see endorctl init.endorctl init --auth-mode google
-
Use the
endorctl
command-line tool to make your request. Note that you do not have to provide the namespace or access token when usingendorctl
to access the Endor Labs REST API. For more information, see the Endor Labs CLI documentation.endorctl api list -r Finding --count
-
Install
curl
if it isn’t already installed on your machine. To check ifcurl
is installed, executecurl --version
on the command line. If the output provides information about the version ofcurl
, that meanscurl
is installed. If you get a message similar to command not found: curl, you need to download and install curl. For more information, see the curl project download page. -
Authenticate with Endor Labs using
endorctl init
. For more information, see endorctl init.endorctl init --auth-mode google
-
Create an access token. The access token produced below has the same scopes/permissions as the API key created through
endorctl init
. Treat your access token like a password. For more information, see Authentication.export ENDOR_TOKEN=$(endorctl auth --print-access-token)
-
Use the Curl command to make your request. Pass your token in an Authorization header. The following is an example request to get the number of findings in a given namespace. If needed, replace
$ENDOR_NAMESPACE
with the name of your namespace, or export it as a variable usingexport ENDOR_NAMESPACE=<insert-namespace>
.curl --get \ --header "Authorization: Bearer $ENDOR_TOKEN" \ --header "Accept-Encoding: gzip, deflate, br, zstd" \ --url "https://api.endorlabs.com/v1/namespaces/$ENDOR_NAMESPACE/findings?list_parameters.count=true"
For more information on HTTP headers and parameters, see Getting Started.
For more examples of common use cases, see Use cases.