List Namespaces
Retrieve a list of Kubernetes namespaces within a specified time range.
Endpoint
POST /api/k8s/v2/namespaces/list
Authentication
This endpoint requires API Key authentication via the Authorization header.
Headers
Authorization
Yes
Bearer token with your API key
X-Backend-Id
Yes
Your backend identifier
Content-Type
Yes
Must be application/json
Accept
Yes
Must be application/json
Request Body
sources
Array
No
Filter by data sources (empty array for all sources)
start
String
Yes
Start timestamp in ISO 8601 format (UTC)
end
String
Yes
End timestamp in ISO 8601 format (UTC)
Time Range Parameters
Format: ISO 8601 format with milliseconds:
YYYY-MM-DDTHH:mm:ss.sssZ
Timezone: All timestamps must be in UTC (denoted by 'Z' suffix)
Response
The response contains an array of namespaces for the specified time period.
Response Fields
namespaces
Array
Array of namespace names or namespace objects
Examples
Basic Request
curl 'https://api.groundcover.com/api/k8s/v2/namespaces/list' \
-H 'accept: application/json' \
-H 'authorization: Bearer <YOUR_API_KEY>' \
-H 'content-type: application/json' \
-H 'X-Backend-Id: <YOUR_BACKEND_ID>' \
--data-raw '{"sources":[],"start":"2025-01-24T06:00:00.000Z","end":"2025-01-24T08:00:00.000Z"}'
Response Example
{
"namespaces": [
"groundcover",
"monitoring",
"kube-system",
"default"
]
}
Time Range Usage
Last 24 Hours
# Get current time and subtract 24 hours for start time
start_time=$(date -u -v-24H '+%Y-%m-%dT%H:%M:%S.000Z')
end_time=$(date -u '+%Y-%m-%dT%H:%M:%S.000Z')
curl 'https://api.groundcover.com/api/k8s/v2/namespaces/list' \
-H 'accept: application/json' \
-H 'authorization: Bearer <YOUR_API_KEY>' \
-H 'content-type: application/json' \
-H 'X-Backend-Id: <YOUR_BACKEND_ID>' \
--data-raw "{\"sources\":[],\"start\":\"$start_time\",\"end\":\"$end_time\"}"
Last updated