Endpoint
This endpoint does not create a contract. It returns a suggested
schema.columns array that you can review and then use in a separate
create contract request.Request
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
sample | object | ✅ | A single representative JSON record from your dataset. Use values that reflect the real types — e.g. an actual integer, not a string "1". |
Response
Response Fields
| Field | Type | Description |
|---|---|---|
columns | array | Inferred column definitions, ready to use as schema.columns in a create contract request |
columns[].name | string | Column name taken directly from the sample key |
columns[].type | string | Inferred type — one of string, integer, number, boolean, date, timestamp, json |
columns[].required | boolean | Always true for inferred columns — adjust manually if some columns are optional in your dataset |
All inferred columns are marked
required: true by default since the sample
represents a complete record. Review the output and set required: false for
any columns that may be absent in real data before creating the contract.Type Inference Rules
DriftGuard maps JSON value types to contract column types as follows:| Sample Value | Inferred Type |
|---|---|
1, 42 (integer) | integer |
98.6, 3.14 (float) | number |
"hello" (string) | string |
true, false (boolean) | boolean |
"2026-01-01T00:00:00Z" (ISO datetime string) | timestamp |
"2026-01-01" (ISO date string) | date |
{ ... } (nested object) | json |
Using the Response to Create a Contract
Take thecolumns array from the response and pass it directly into the
create contract endpoint:
Error Responses
| Status | Meaning |
|---|---|
400 | Invalid request body — sample missing or not a JSON object |
401 | Missing or invalid X-API-Key |
429 | Rate limit exceeded — 100 req/min per key |
Create Contract
Use the inferred schema to create a contract.
Run a Check
Once your contract is created, run your first schema check.
