Service API: issues
- We're assuming your API key is set in the environment variable
$KEYwith the necessary permissions. - The
issuesendpoints require a key with issues scope: read access for theGETmethods, write access to update or close an issue. - The
issue-typesendpoint requires a key with issue-types scope (read). - Otherwise the API returns
403 Forbidden.
An issue is a problem the Console's Stack Health monitoring found on
your stack, such as a Security Engine that went offline or a Log Processor that reads no logs. Each issue
concerns one entity (a Security Engine, a Log Processor, a blocklist integration), has a severity
(info, medium, high or critical) and a status (open, resolved or closed). An issue type
describes one kind of issue.
Issuesโ
Get Issuesโ
List the issues of your Organization
All query parameters are optional. The list parameters can be repeated to pass several values.
| Parameter | Description |
|---|---|
issues_type | Issue types to keep, see Get Issue Types (e.g. security_engine_offline) |
entity_ids | IDs of the entities to keep. An issue matches on its own entity or on the Security Engine it belongs to |
tags | Keep the issues of the entities carrying one of these tags. Returns 404 Not Found if no entity carries them |
severities | info, medium, high, critical |
is_ignored | true for ignored issues only, false for issues that are not ignored |
status | open, resolved or closed |
include_hidden | Include the issues hidden by another issue (e.g. "no activity" while the engine is offline). Default false |
page, size | Pagination. Default page=1, size=50 (max 100) |
curl -i -H "x-api-key: ${KEY}" -X GET -H "Content-Type: application/json" \
"https://admin.api.crowdsec.net/v1/issues?status=open&severities=critical&severities=high&page=1&size=50"
import os
KEY = os.getenv('KEY')
from crowdsec_service_api import (
Issues,
Server,
ApiKeyAuth,
)
from httpx import HTTPStatusError
auth = ApiKeyAuth(api_key=KEY)
client = Issues(base_url=Server.production_server.value, auth=auth)
try:
response = client.get_issues(
issues_type=None,
entity_ids=None,
tags=None,
severities=["critical", "high"],
is_ignored=None,
status="open",
include_hidden=False,
page=1,
size=50,
)
print(response.model_dump_json())
except HTTPStatusError as e:
print(f"An error occurred: {e.response.status_code} - {e.response.text}")
answer on success
{
"items": [
{
"uuid": "string",
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"last_triggered_at": "2019-08-24T14:15:22Z",
"opened_at": "2019-08-24T14:15:22Z",
"organization_id": "string",
"triggered_count": 1,
"status": "open",
"ignored_until": null,
"is_ignored": false,
"detail": {
"entity_id": "string",
"severity": "critical",
"version": "v1.6.3",
"os": {
"name": "string",
"version": "string",
"family": "string"
},
"last_login": "2019-08-22T07:06:21",
"issue_type": "security_engine_offline",
"name": "string",
"entity_type": "engine"
}
}
],
"total": 0,
"page": 1,
"size": 1,
"pages": 0,
"links": {
"first": "/api/v1/users?limit=1&offset1",
"last": "/api/v1/users?limit=1&offset1",
"self": "/api/v1/users?limit=1&offset1",
"next": "/api/v1/users?limit=1&offset1",
"prev": "/api/v1/users?limit=1&offset1"
}
}
detail always holds issue_type, entity_id, entity_type and severity. Its other fields depend
on issue_type: the example above is a security_engine_offline issue.
Get Issues Summaryโ
Count the issues of your Organization by severity, type and status
Accepts the same filters as Get Issues, without page and size.
curl -i -H "x-api-key: ${KEY}" -X GET -H "Content-Type: application/json" \
"https://admin.api.crowdsec.net/v1/issues/summary?status=open"
import os
KEY = os.getenv('KEY')
from crowdsec_service_api import (
Issues,
Server,
ApiKeyAuth,
)
from httpx import HTTPStatusError
auth = ApiKeyAuth(api_key=KEY)
client = Issues(base_url=Server.production_server.value, auth=auth)
try:
response = client.get_issues_summary(status="open")
print(response.model_dump_json())
except HTTPStatusError as e:
print(f"An error occurred: {e.response.status_code} - {e.response.text}")
answer on success
{
"total_issues": 3,
"by_severity": [
{
"severity": "critical",
"count": 1
},
{
"severity": "high",
"count": 2
}
],
"by_type": [
{
"issue_type": "log_processor_no_logs_read",
"count": 2
},
{
"issue_type": "security_engine_offline",
"count": 1
}
],
"by_status": [
{
"status": "open",
"count": 3
}
],
"ignored_issues": 0
}
Get Issueโ
Retrieve a single issue, using the
uuidreturned by Get Issues
curl -i -H "x-api-key: ${KEY}" -X GET -H "Content-Type: application/json" \
https://admin.api.crowdsec.net/v1/issues/${ISSUE_UUID}
import os
KEY = os.getenv('KEY')
ISSUE_UUID = os.getenv('ISSUE_UUID')
from crowdsec_service_api import (
Issues,
Server,
ApiKeyAuth,
)
from httpx import HTTPStatusError
auth = ApiKeyAuth(api_key=KEY)
client = Issues(base_url=Server.production_server.value, auth=auth)
try:
response = client.get_issue(issue_uuid=ISSUE_UUID)
print(response.model_dump_json())
except HTTPStatusError as e:
print(f"An error occurred: {e.response.status_code} - {e.response.text}")
answer on success
{
"uuid": "string",
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"last_triggered_at": "2019-08-24T14:15:22Z",
"opened_at": "2019-08-24T14:15:22Z",
"organization_id": "string",
"triggered_count": 1,
"status": "open",
"ignored_until": null,
"is_ignored": false,
"detail": {
"entity_id": "string",
"severity": "critical",
"version": "v1.6.3",
"os": {
"name": "string",
"version": "string",
"family": "string"
},
"last_login": "2019-08-22T07:06:21",
"issue_type": "security_engine_offline",
"name": "string",
"entity_type": "engine"
}
}
An unknown issue_uuid returns 404 Not Found.
Update Issueโ
Change the status of an issue, or ignore it
The body accepts three optional fields:
status: the new status,open,resolvedorclosed.is_ignoredandignored_until: always sent together. Setis_ignoredtotrueto ignore the issue until theignored_untildate, or indefinitely whenignored_untilisnull. Setis_ignoredtofalseandignored_untiltonullto stop ignoring it.
# Mark the issue as resolved
curl -i -H "x-api-key: ${KEY}" -X PATCH -H "Content-Type: application/json" \
https://admin.api.crowdsec.net/v1/issues/${ISSUE_UUID} \
-d '{ "status": "resolved" }'
# Ignore the issue until a given date
curl -i -H "x-api-key: ${KEY}" -X PATCH -H "Content-Type: application/json" \
https://admin.api.crowdsec.net/v1/issues/${ISSUE_UUID} \
-d '{ "is_ignored": true, "ignored_until": "2026-12-31T00:00:00Z" }'
import os
KEY = os.getenv('KEY')
ISSUE_UUID = os.getenv('ISSUE_UUID')
from crowdsec_service_api import (
Issues,
Server,
ApiKeyAuth,
)
from crowdsec_service_api.models import IssueUpdateRequest
from httpx import HTTPStatusError
auth = ApiKeyAuth(api_key=KEY)
client = Issues(base_url=Server.production_server.value, auth=auth)
request = IssueUpdateRequest(
is_ignored=True,
ignored_until="2026-12-31T00:00:00Z",
)
try:
response = client.update_issue(issue_uuid=ISSUE_UUID, request=request)
print(response.model_dump_json())
except HTTPStatusError as e:
print(f"An error occurred: {e.response.status_code} - {e.response.text}")
answer on success
{
"uuid": "string",
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"last_triggered_at": "2019-08-24T14:15:22Z",
"opened_at": "2019-08-24T14:15:22Z",
"organization_id": "string",
"triggered_count": 1,
"status": "open",
"ignored_until": "2026-12-31T00:00:00Z",
"is_ignored": true,
"detail": {
"entity_id": "string",
"severity": "critical",
"version": "v1.6.3",
"os": {
"name": "string",
"version": "string",
"family": "string"
},
"last_login": "2019-08-22T07:06:21",
"issue_type": "security_engine_offline",
"name": "string",
"entity_type": "engine"
}
}
Sending only one of is_ignored and ignored_until returns 422 Unprocessable Entity. An unknown
issue_uuid returns 404 Not Found.
Close Issueโ
Close an issue. The issue is not deleted: its status is set to
closed.
curl -i -H "x-api-key: ${KEY}" -X DELETE -H "Content-Type: application/json" \
https://admin.api.crowdsec.net/v1/issues/${ISSUE_UUID}
import os
KEY = os.getenv('KEY')
ISSUE_UUID = os.getenv('ISSUE_UUID')
from crowdsec_service_api import (
Issues,
Server,
ApiKeyAuth,
)
from httpx import HTTPStatusError
auth = ApiKeyAuth(api_key=KEY)
client = Issues(base_url=Server.production_server.value, auth=auth)
try:
client.close_issue(issue_uuid=ISSUE_UUID)
except HTTPStatusError as e:
print(f"An error occurred: {e.response.status_code} - {e.response.text}")
On success the API returns 204 No Content with an empty body.
Issue typesโ
Get Issue Typesโ
List the issue types the Console can raise
curl -i -H "x-api-key: ${KEY}" -X GET -H "Content-Type: application/json" \
https://admin.api.crowdsec.net/v1/issue-types
import os
KEY = os.getenv('KEY')
from crowdsec_service_api import (
IssueTypes,
Server,
ApiKeyAuth,
)
from httpx import HTTPStatusError
auth = ApiKeyAuth(api_key=KEY)
client = IssueTypes(base_url=Server.production_server.value, auth=auth)
try:
response = client.get_issue_types()
print(response.model_dump_json())
except HTTPStatusError as e:
print(f"An error occurred: {e.response.status_code} - {e.response.text}")
answer on success
{
"items": [
{
"issue_type": "security_engine_offline",
"label": "Security Engine: offline",
"description": "Security Engine is offline for more than 24 hours and cannot detect or block attacks.",
"severity": "critical",
"entity_type": "engine",
"solution_links": [
"string"
]
}
]
}
Use the issue_type values to filter Get Issues with issues_type. solution_links
points to the troubleshooting guides for the issue.