Standard structures and conventions used across all k0rdent APIsThis page describes the common patterns, data types, and conventions used throughout the k0rdent API to ensure consistency and predictability.
Response Envelope
All API responses use a consistent discriminated union envelope structure with asuccess boolean discriminator.
Type Definition
Success Response
Error Response
Meta Object
Themeta object is always present in responses and contains request tracking information.
Base Meta Fields
| Field | Type | Description |
|---|---|---|
requestId | string | Unique request identifier for log correlation |
timestamp | string | ISO 8601 timestamp (UTC) for distributed debugging |
Extended Meta Types
Success responses can extend meta with additional context: Pagination Meta:Resource Identifiers
Resources use globally unique, opaque IDs that do NOT contain region information. This decouples resource identity from physical location.ID Format
Format:{prefix}_{base62}
Resource ID Prefixes
| Resource | Prefix | Example |
|---|---|---|
| Organization | org_ | org_8TcVx2WkZddNmK3Pt9JwX7BzWrLM |
| Server | srv_ | srv_3KpQm9WnXccFjH2Ls8DkT6VzRqYU |
| Cluster | cls_ | cls_6NZtkvWLBbbmHfPi7L6oz7KZpqET |
| Stack | stk_ | stk_5MfRp4WjYbbHmG8Nt2LvS9CxPqZK |
| Workflow Run | run_ | run_7NhTq6WlAbbKmF5Rt3MxU8DzSqWJ |
| Pool | pool_ | pool_2LgPn8WmXccGjE7Mt4KwV9BySrTL |
| Allocation | alloc_ | alloc_9QjSr3WnZddMmH6Pt5LxW2CzUrYK |
| API Key | key_ | key_4KfQm7WkYccJmG3Nt8MvX9BzSqWL |
| Event | evt_ | evt_6MgRp2WlXbbKmF9Rt5NxU3DzTqZJ |
Request Identifiers
Every API request gets a unique Request ID for tracing, debugging, and correlation across services.Format
Format:req_{region}-{timestamp}-{entropy}
Example
Components
req_- Platform prefix for easy grepping in logssfo1- Region code where request was processed1770564159296- Unix timestamp in milliseconds7d4b9e1f3a5b- Random entropy (12 hex characters)
X-Request-Id response header and meta.requestId field.
Naming Conventions
URL Paths
| Rule | Example |
|---|---|
| Lowercase, hyphenated | /ai-services |
| Plural nouns for collections | /servers, /clusters |
| Singular for singletons | /me, /health |
| Colon-prefixed route params | /clusters/:clusterId |
Field Names
| Rule | Example |
|---|---|
| camelCase | createdAt, nodeCount |
Suffix IDs with Id | clusterId, organizationId |
| Past tense for timestamps | createdAt, updatedAt, deletedAt |
Dates and Timestamps
All temporal fields use ISO 8601 format and are always treated as UTC.Common Fields
| Field | Description |
|---|---|
createdAt | When the object was created |
updatedAt | When the object was last updated |
deletedAt | When the object was deleted (soft delete) |
Example
Use of HTTP
HTTP Methods
The k0rdent API uses standard HTTP methods:| Method | Purpose |
|---|---|
GET | Retrieve resources (read-only) |
POST | Create new resources |
PATCH | Update existing resources (partial) |
DELETE | Delete resources |
Content Type
All requests and responses useContent-Type: application/json unless otherwise specified.
Example Request
Pagination
The k0rdent API supports both cursor-based and offset/limit pagination.Cursor-Based Pagination
Recommended for real-time data:Offset/Limit Pagination
For stable datasets:Pagination Parameters
| Parameter | Description | Default |
|---|---|---|
limit | Number of items per page (max 100) | 25 |
offset | Skip this many items | 0 |
cursor | Opaque cursor for next page | - |
Filtering
You can filter resources by most attributes using query parameters:Simple Filter
Multiple Values
Example Response
All filtered results still use the standard response envelope with pagination.Sorting
Sort resources in ascending or descending order:Sort Ascending
Sort Descending
Use- prefix for descending:
Multiple Sort Fields
Field Design Rules
Use Objects Over Primitives
Always wrap values that might grow into objects:Never Use Booleans for State
States often grow beyond two values:Use IDs with Optional Expansion
Donβt embed full objects - use IDs and let clients request expansion:Optional Fields
Unpopulated optional data is returned as follows:- Arrays and Objects may be returned as empty (
[],{}) - Number, String, and Boolean types may be returned as
null