SwiftAPI Authority Documentation

SwiftAPI is a trust authority for governing autonomous AI execution via cryptographic attestations and mandatory enforcement points.

DOI: 10.5281/zenodo.18012025

System Overview


AI Agent
   │
   ▼
SwiftAPI Trust Authority (swiftapi.ai)
   │  ── issues signed attestations
   ▼
Mandatory Enforcement Point (K8s Admission, Proxy, Gateway)
   │
   ▼
Execution Allowed or Denied
        

SwiftAPI does not execute actions. It does not run agents. It does not bypass enforcement. It issues verifiable permission artifacts that external enforcement points validate before allowing execution.


Quick Start (Python SDK)

The recommended way to integrate SwiftAPI is via the official Python SDK. It handles cryptographic verification, fail-closed logic, and revocation checks automatically.

1. Installation

pip install swiftapi-python

2. Integration (The "Golden Loop")

Wrap your dangerous functions in the Enforcement guard. This ensures no action runs without a signed attestation from the Authority.

from swiftapi import SwiftAPI, Enforcement

# Initialize with your Authority Key
api = SwiftAPI(key="swiftapi_live_...")
guard = Enforcement(api)

def destructive_action():
    # This code is effectively dead unless SwiftAPI unlocks it
    print("Dropping production database...")

# Execute with Governance
try:
    guard.run(
        func=destructive_action,
        action="database_drop",
        intent="Schema cleanup script"
    )
except Exception as e:
    print(f"BLOCKED: {e}")
    # Output: "Blocked by policy 'no_database_drop'"

Why use the SDK?

View on PyPI


Drop-in OpenAI Replacement

Change one import. Every inference call is now attested. No other code changes required.

Before (unattested)

from openai import OpenAI
client = OpenAI(api_key="sk-...")

After (attested)

from swiftapi import OpenAI
client = OpenAI(
    swiftapi_key="swiftapi_live_...",
    openai_key="sk-..."
)

You bring both keys. SwiftAPI governs. OpenAI executes. The SDK attests each call with the trust authority, then calls OpenAI directly with your own key. Your credits. Your model. SwiftAPI just decides whether it happens.

response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Hello"}]
)
print(response.choices[0].message.content)
# If policy denies: empty string (void)
# If approved: normal completion from OpenAI

If the authority denies the action, the response content is an empty string. No error. No exception. Void. The action never happened. Your OpenAI key is never sent to SwiftAPI.


Drop-in Anthropic Replacement

Same pattern. Change one import. Every Claude call is now attested.

Before (unattested)

from anthropic import Anthropic
client = Anthropic(api_key="sk-ant-...")

After (attested)

from swiftapi import Anthropic
client = Anthropic(
    swiftapi_key="swiftapi_live_...",
    anthropic_key="sk-ant-..."
)

You bring both keys. SwiftAPI governs. Anthropic executes. The SDK attests each call with the trust authority, then calls Anthropic directly with your own key. Your credits. Your model. SwiftAPI just decides whether it happens.

response = client.messages.create(
    model="claude-sonnet-4-5-20250929",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hello"}]
)
print(response.content[0].text)
# If policy denies: empty string (void)
# If approved: normal completion from Anthropic

If the authority denies the action, the response content is an empty string. No error. No exception. Void. The action never happened. Your Anthropic key is never sent to SwiftAPI.


Authority Keys

Authority keys grant the ability to exercise governance over the trust authority.

Key TypePurpose
RecoveryEmergency root. Offline storage recommended. Can revoke owner keys.
OwnerManages authority, policies, grants, and regular keys.
RegularScoped authority for automation, systems, or delegated access.
Important:
  • Keys are opaque tokens. Format: swiftapi_live_[64 hex chars]
  • Only SHA-256 hashes are stored. Raw keys are never persisted.
  • Keys are delivered once. They cannot be retrieved again.
  • Revocation is immediate and irreversible.

Scopes

Each authority key is granted specific scopes that define its capabilities.

ScopeCapability
verifyIssue and revoke execution attestations
grantsCreate and revoke delegated authority
policyPropose, approve, and activate policy bundles
adminManage authority keys and access denial logs

A key without the required scope cannot exercise that authority under any circumstance.


Enforcement Model

SwiftAPI enforcement is mandatory when integrated with a Mandatory Enforcement Point (MEP) such as:

In a correctly deployed environment, execution physically cannot occur without a valid SwiftAPI attestation.


Attestations

Attestations are cryptographically signed tokens that authorize specific actions.

PropertyValue
Signing AlgorithmEd25519 (EdDSA)
Token FormatBase64URL encoded header.payload.signature
Default TTL48 hours (172800 seconds)
Replay DefenseUnique JTI per attestation
RevocationPull-based via /attestation/revocations

Governance Events

All governance events are logged and cryptographically signed:

All governance events are cryptographically signed and non-repudiable.


What SwiftAPI Is Not

SwiftAPI is exclusively a trust authority. It issues verifiable governance artifacts. Enforcement is delegated to external systems.


Obtaining Authority

Authority keys with verify scope are issued instantly at getswiftapi.com/request.

For enterprise access with custom policies, HSM-backed keys, and additional scopes, contact the authority operator directly.


Endpoints Reference

Public Endpoints

EndpointMethodDescription
/GETAuthority metadata and public key
/healthGETHealth check
/attestation/infoGETAttestation format and TTL information
/attestation/verifyPOSTVerify an attestation (rate limited)
/attestation/revocationsGETList of revoked attestation JTIs
/policiesGETActive policy bundles

Protected Endpoints (Require Authority Key)

EndpointMethodScopeDescription
/verifyPOSTverifyIssue an execution attestation
/attestPOSTverifyIssue attestation with action data (for SDK and proxy flows)
/chat/vibePOSTverifyAttestation-gated OpenAI Chat Completions proxy
/attestation/revokePOSTverifyRevoke an attestation by JTI
/grantsPOSTgrantsCreate a delegated grant
/grants/{id}DELETEgrantsRevoke a grant
/policy/bundlesPOSTpolicyUpload a policy bundle
/policy/proposalsPOSTpolicyCreate a policy proposal
/policy/activatePOSTpolicyActivate a policy bundle
/authority/keysPOSTadminCreate a new authority key
/authority/denialsGETadminView denial log

All protected endpoints require the X-SwiftAPI-Authority header with a valid key.