Overview

The DriftOps Public API lets external systems read your contracts and their version history. It is intended for giving trading partners or downstream systems access to your schema baselines without giving them access to the full DriftOps app.

The Public API is read-only. It does not expose drift events, monitors, or organization settings.

Base URL: https://api.driftops.io/api/v1

API keys

API keys are scoped to your organization. Create them in Settings > API Keys.

Each key has:

  • A name (for your reference)
  • Scopes (which endpoints the key can access)
  • An optional expiry date
  • A prefix shown in the DriftOps app (e.g. driftops_abc123...)

The full key is shown only once at creation. Store it securely. If you lose it, revoke the key and create a new one.

To revoke a key: go to Settings > API Keys and deactivate or delete it.

Authentication

Include the API key in the Authorization header as a Bearer token:

Authorization: Bearer driftops_your_key_here

Keys that are deactivated, expired, or not found return 401 Unauthorized.

Scopes

ScopeAccess
contracts:readList contracts, get contract detail and schema
versions:readList and get contract versions

Keys created before scopes were introduced have full access to all endpoints (backwards compatible).

To restrict a key to a specific scope, set the scopes when creating the key. A key with contracts:read cannot access version endpoints.

Endpoints

List contracts

GET /api/v1/contracts
Authorization: Bearer driftops_...

Returns all contracts for the organization. Does not include schema content.

Response:

{
  "items": [
    {
      "id": 12,
      "name": "Demo 850 PO",
      "description": "Purchase order schema",
      "vendor": "Demo",
      "created_at": "2025-03-01T12:00:00",
      "updated_at": "2025-09-15T08:30:00"
    }
  ]
}

Get a contract

GET /api/v1/contracts/{contract_id}
Authorization: Bearer driftops_...

Returns the contract with its full schema content.

Response:

{
  "id": 12,
  "name": "Demo 850 PO",
  "description": "Purchase order schema",
  "vendor": "Demo",
  "schema_content": { ... },
  "tags": ["850", "Purchase Order", "Production"],
  "created_at": "2025-03-01T12:00:00",
  "updated_at": "2025-09-15T08:30:00"
}

List contract versions

GET /api/v1/contracts/{contract_id}/versions
Authorization: Bearer driftops_...

Returns all versions for a contract, newest first. Does not include schema content.

Response:

{
  "items": [
    {
      "id": 45,
      "version_number": 3,
      "change_summary": "Added BEG04 field",
      "change_type": "manual",
      "created_at": "2025-09-15T08:30:00",
      "created_by": "user_abc123"
    }
  ]
}

Get a specific version

GET /api/v1/contracts/{contract_id}/versions/{version_id}
Authorization: Bearer driftops_...

Returns the version with its full schema content.

Rate limiting

The Public API is rate limited per API key. If you exceed the limit, you receive 429 Too Many Requests. Back off and retry.

Examples

Fetch the latest schema for a contract:

import requests

API_KEY = "driftops_your_key_here"
CONTRACT_ID = 12

resp = requests.get(
    f"https://api.driftops.io/api/v1/contracts/{CONTRACT_ID}",
    headers={"Authorization": f"Bearer {API_KEY}"}
)
resp.raise_for_status()
schema = resp.json()["schema_content"]

List all contracts:

curl https://api.driftops.io/api/v1/contracts \
  -H "Authorization: Bearer driftops_your_key_here"

Fetch the latest version of a contract:

import requests

API_KEY = "driftops_your_key_here"
CONTRACT_ID = 12

resp = requests.get(
    f"https://api.driftops.io/api/v1/contracts/{CONTRACT_ID}/versions",
    headers={"Authorization": f"Bearer {API_KEY}"}
)
resp.raise_for_status()
versions = resp.json()["items"]
latest = versions[0] if versions else None