Skip to main content

Contracts API

Manage data contracts and SLAs between producers and consumers.

Endpoints Overview

MethodEndpointDescription
GET/contractsList contracts
POST/contractsCreate contract
GET/contracts/{id}Get details
PATCH/contracts/{id}Update contract
DELETE/contracts/{id}Delete contract

List Contracts

GET /contracts

Query Parameters

ParameterTypeDescription
space_iduuidFilter by space
producer_iduuidFilter by producer product
consumer_iduuidFilter by consumer product
statusstringactive, draft, expired
pageintegerPage number
sizeintegerItems per page

Response

{
"items": [
{
"id": "...",
"name": "Customer Events SLA",
"description": "Freshness and quality guarantees",
"status": "active",
"producer": {
"id": "...",
"name": "Customer Events (Raw)"
},
"consumer": {
"id": "...",
"name": "Customer Analytics"
},
"sla": {
"freshness_hours": 1,
"availability_percent": 99.5
},
"created_at": "2025-06-01T00:00:00Z",
"expires_at": "2026-06-01T00:00:00Z"
}
],
"total": 5,
"page": 1,
"size": 20
}

Create Contract

POST /contracts

Request Body

{
"name": "Orders Data SLA",
"description": "## Overview\n\nThis contract defines...",
"space_id": "space-uuid",
"producer_id": "product-uuid",
"consumer_id": "product-uuid",
"sla": {
"freshness_hours": 24,
"availability_percent": 99.0,
"quality_score_min": 0.9
},
"expires_at": "2026-12-31T23:59:59Z"
}

SLA Fields

FieldTypeDescription
freshness_hoursintegerMax data age in hours
availability_percentfloatUptime requirement (0-100)
quality_score_minfloatMinimum quality score (0-1)
response_time_hoursintegerIssue response SLA

Update Contract

PATCH /contracts/{id}

Modify SLA Terms

{
"sla": {
"freshness_hours": 12,
"availability_percent": 99.9
}
}

Change Status

{
"status": "expired"
}

Contract Violations

When SLA terms are breached, violations are automatically tracked.

List Violations

GET /contracts/{id}/violations

Response

{
"items": [
{
"id": "...",
"type": "freshness",
"occurred_at": "2026-01-15T08:00:00Z",
"details": {
"expected": 24,
"actual": 36,
"unit": "hours"
},
"resolved": false
}
]
}

Acknowledge Violation

PATCH /contracts/{id}/violations/{violation_id}
{
"acknowledged": true,
"notes": "Known outage, backfill in progress"
}