Run Integrations with the Mondoo API
List the integrations in a space and start an integration's scan, import, or export on demand with the Mondoo GraphQL API.
Integrations that Mondoo runs for you, such as cloud account scans, imports from other security tools, and data exports, run on a schedule. Use these recipes to check their status or to run one right away, for example right after a deployment finishes.
Each recipe is a complete curl command. To run them, set MONDOO_API_TOKEN and install jq as described in Make your first request. If your organization is in the EU region, replace us.api.mondoo.com with eu.api.mondoo.com.
List the integrations in a space
Use this query to get the MRN, type, and status of every integration in a space.
QUERY='
query ListIntegrations($input: ListClientIntegrationsInput!) {
listClientIntegrations(input: $input) {
integrations {
mrn
name
type
status
lastCheckin
}
}
}'
VARIABLES='{"input": {"scopeMrn": "//captain.api.mondoo.app/spaces/YOUR_SPACE_ID"}}'
curl -s https://us.api.mondoo.com/query \
-H "Authorization: Bearer $MONDOO_API_TOKEN" \
-H "Content-Type: application/json" \
-d "$(jq -n --arg query "$QUERY" --argjson variables "$VARIABLES" '{query: $query, variables: $variables}')" | jq- Scope: a space MRN.
- Access: any role that can view the space, such as Viewer.
To list only some kinds of integrations, add a filter to input. For example, "filterQuery": {"types": ["AWS", "AZURE"]} returns only AWS and Azure integrations.
Run an integration now
Use this operation to start an integration's main job right away instead of waiting for its schedule: a scan for an integration that scans, an import for one that imports findings from another tool, or an export for one that sends data out of Mondoo. Get the integration's MRN from the integrations list.
Unlike the other changes in this section, triggerAction is a query, not a mutation, so the operation starts with query.
QUERY='
query RunIntegration($input: TriggerActionInput!) {
triggerAction(input: $input) {
mrn
}
}'
VARIABLES='{"input": {"mrn": "YOUR_INTEGRATION_MRN", "type": "RUN"}}'
curl -s https://us.api.mondoo.com/query \
-H "Authorization: Bearer $MONDOO_API_TOKEN" \
-H "Content-Type: application/json" \
-d "$(jq -n --arg query "$QUERY" --argjson variables "$VARIABLES" '{query: $query, variables: $variables}')" | jq- Access: the Editor or Owner role, or another role with the Integrations Manager permission. To see every role, read Roles and permissions.
The response returns the integration's MRN when Mondoo accepts the request. The job itself runs in the background. To follow it, check the integration's status with the integrations list or open the integration in the Mondoo App. A paused integration doesn't run: the request returns an error instead.
type also accepts other actions, such as PAUSE and UNPAUSE. The RUN_SCAN, RUN_IMPORT, and RUN_EXPORT actions are deprecated. Use RUN instead.
Next steps
- Retrieve audit logs through the API: see who changed what in a space or organization.
Last updated on