| title | Quickstart |
|---|---|
| description | Run your first schema check in under 5 minutes. |
All examples use the base URL:
https://api.driftguard.dev/api/v1
All endpoints require the X-API-Key header. The only exception is GET /api/v1/health.
Your key must match the format dg_live_<24+ chars> or dg_test_<24+ chars>.
Not sure what your contract schema should look like? Send a sample JSON payload and DriftGuard will generate the column definitions for you automatically.
curl -s -X POST https://api.driftguard.dev/api/v1/contracts/infer \
-H "X-API-Key: $DRIFTGUARD_KEY" \
-H "Content-Type: application/json" \
-d '{
"sample": {
"user_id": 1,
"email": "user@example.com",
"created_at": "2026-01-01T00:00:00Z"
}
}'Sample response:
{
"columns": [
{ "name": "user_id", "type": "integer", "required": true },
{ "name": "email", "type": "string", "required": true },
{ "name": "created_at", "type": "timestamp", "required": true }
]
}Copy these columns into your contract creation request in the next step.
curl -s -X POST https://api.driftguard.dev/api/v1/contracts \
-H "X-API-Key: $DRIFTGUARD_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "users_production",
"schema": {
"columns": [
{ "name": "user_id", "type": "integer", "required": true },
{ "name": "email", "type": "string", "required": true },
{ "name": "created_at", "type": "timestamp", "required": true }
]
}
}'Sample response:
{
"id": "your_contract_id_here",
"name": "users_production",
"version": 1,
"created_at": "2026-03-01T18:00:00Z",
"updated_at": "2026-03-01T18:00:00Z"
}Valid column types: string, integer, number, boolean, date, timestamp, json.
Any type outside this list will be rejected.
Each check costs 1 credit and compares an incoming schema against your saved contract.
curl -s -X POST https://api.driftguard.dev/api/v1/check \
-H "X-API-Key: $DRIFTGUARD_KEY" \
-H "Content-Type: application/json" \
-d '{
"contract_id": "your_contract_id_here",
"incoming_schema": {
"columns": [
{ "name": "user_id", "type": "integer" },
{ "name": "created_at", "type": "string" }
]
}
}'Sample response:
{
"id": "your_check_id_here",
"result": "breaking",
"severity": 70,
"diff": {
"removed": ["email"],
"type_changes": [
{ "column": "created_at", "from": "timestamp", "to": "string" }
],
"added": []
},
"credits_used": 1,
"created_at": "2026-03-01T18:00:14Z"
}The three possible result values are:
| Result | Severity Score | Meaning |
|---|---|---|
pass |
0 – 19 | Schema matches contract |
warning |
20 – 89 | Drift detected, may cause issues |
breaking |
90 – 100 | Drift will break downstream consumers |
Exit with a non-zero code on breaking changes to fail your pipeline or pull request check.
RESULT=$(curl -s -X POST https://api.driftguard.dev/api/v1/check \
-H "X-API-Key: $DRIFTGUARD_KEY" \
-H "Content-Type: application/json" \
-d '{
"contract_id": "your_contract_id_here",
"incoming_schema": {
"columns": [
{ "name": "user_id", "type": "integer" },
{ "name": "email", "type": "string" }
]
}
}' | jq -r '.result')
echo "DriftGuard result: $RESULT"
[ "$RESULT" != "breaking" ] || exit 1curl -s https://api.driftguard.dev/api/v1/usage \
-H "X-API-Key: $DRIFTGUARD_KEY"{
"credits_remaining": 499,
"credits_used": 1,
"total_checks": 1
}The rate limit is 100 requests per minute per API key. If you exceed it,
you'll receive a 429 Too Many Requests response.
Learn how to model your datasets as contracts, including versioning and valid types. Understand exactly how the 0–100 severity score is calculated. Get notified instantly when a breaking check is detected. Full endpoint reference with all parameters and response shapes.