Skip to main content
This endpoint is not yet available. It is planned for a future release. To change a contract’s schema today, create a new contract via POST /api/v1/contracts with the updated column definitions.

Endpoint

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

Planned Behaviour

Once available, this endpoint will:
  • Accept a partial or full update to the contract’s schema.columns
  • Automatically increment the contract’s version number on each successful update
  • Leave any omitted fields unchanged
  • Apply to all future checks run against this contract immediately — existing historical check results are not affected

Path Parameters

ParameterTypeRequiredDescription
idstringYesThe contract ID to update

Planned Request Body

{
  "name": "users_production_v2",
  "schema": {
    "columns": [
      { "name": "user_id",    "type": "integer",   "required": true },
      { "name": "email",      "type": "string",    "required": true },
      { "name": "created_at", "type": "timestamp", "required": true },
      { "name": "updated_at", "type": "timestamp", "required": false }
    ]
  }
}

Planned Field Reference

FieldTypeRequiredDescription
namestringNew name for the contract — must be unique per account
schema.columnsarrayFull replacement list of column definitions — omit to leave columns unchanged
schema.columns[].namestring✅ (if columns provided)Column name (case-sensitive)
schema.columns[].typestring✅ (if columns provided)One of string, integer, number, boolean, date, timestamp, json
schema.columns[].requiredboolean✅ (if columns provided)Whether the column must be present in every check

Planned Response

{
  "id": "your_contract_id_here",
  "name": "users_production_v2",
  "version": 2,
  "schema": {
    "columns": [
      { "name": "user_id",    "type": "integer",   "required": true },
      { "name": "email",      "type": "string",    "required": true },
      { "name": "created_at", "type": "timestamp", "required": true },
      { "name": "updated_at", "type": "timestamp", "required": false }
    ]
  },
  "created_at": "2026-03-01T18:00:00Z",
  "updated_at": "2026-03-02T09:12:00Z"
}

Planned Error Responses

StatusMeaning
400Invalid request body — unsupported type or missing required column fields
401Missing or invalid X-API-Key
404Contract not found, or belongs to a different user
409Updated name already exists for another contract on your account
429Rate limit exceeded — 100 req/min per key

Want to be notified when this endpoint goes live? Watch the Changelog or follow @naveenbale on X.

Create Contract

Create a new contract with updated column definitions in the meantime.

Get Contract

Retrieve a contract’s current schema and version.