Skip to main content

Endpoint

GET /api/v1/contracts/{id}
Host: api.driftguard.dev

Path Parameters

ParameterTypeRequiredDescription
idstringYesThe contract ID returned by POST /api/v1/contracts

Request

curl -s https://api.driftguard.dev/api/v1/contracts/your_contract_id_here \
  -H "X-API-Key: $DRIFTGUARD_KEY"

Response

{
  "id": "your_contract_id_here",
  "name": "users_production",
  "version": 1,
  "schema": {
    "columns": [
      { "name": "user_id",    "type": "integer",   "required": true },
      { "name": "email",      "type": "string",    "required": true },
      { "name": "created_at", "type": "timestamp", "required": true }
    ]
  },
  "created_at": "2026-03-01T18:00:00Z",
  "updated_at": "2026-03-01T18:00:00Z"
}

Response Fields

FieldTypeDescription
idstringUnique identifier for the contract
namestringThe name given to the contract
versionintegerCurrent version number — increments each time the contract schema is updated
schema.columnsarrayFull list of column definitions as saved
schema.columns[].namestringColumn name (case-sensitive)
schema.columns[].typestringColumn type — one of string, integer, number, boolean, date, timestamp, json
schema.columns[].requiredbooleanWhether the column must be present in every check
created_atstringISO 8601 timestamp of when the contract was created
updated_atstringISO 8601 timestamp of the last update

Error Responses

StatusMeaning
401Missing or invalid X-API-Key
404Contract not found, or belongs to a different user
429Rate limit exceeded — 100 req/min per key

List Contracts

Retrieve all contracts on your account.

Run a Check

Use this contract ID to run a schema check.