POST
/
attestations
curl -X POST https://api.treeship.dev/v1/attestations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "performance",
    "subject": {
      "id": "agent_ml_001",
      "type": "agent",
      "metadata": {
        "name": "Medical Diagnosis AI",
        "version": "2.1.0"
      }
    },
    "claims": [
      {
        "property": "diagnostic_accuracy",
        "value": 0.97,
        "operator": ">=",
        "threshold": 0.95
      },
      {
        "property": "false_positive_rate",
        "value": 0.02,
        "operator": "<=",
        "threshold": 0.05
      }
    ],
    "evidence": {
      "proofs": ["proof_abc123", "proof_def456"],
      "documents": [
        {
          "type": "test_results",
          "hash": "0x7d8f9e8a..."
        }
      ]
    },
    "issuer": {
      "id": "healthcare_org_001",
      "type": "organization",
      "credentials": ["cert_fda_510k"]
    },
    "validityPeriod": {
      "duration": "1y"
    },
    "privacy": {
      "selective_disclosure": true,
      "zero_knowledge": true
    }
  }'
{
  "attestationId": "attest_7d8f9e8a7b6c5d4e",
  "type": "performance",
  "subject": {
    "id": "agent_ml_001",
    "type": "agent",
    "metadata": {
      "name": "Medical Diagnosis AI",
      "version": "2.1.0"
    }
  },
  "claims": [
    {
      "property": "diagnostic_accuracy",
      "value": 0.97,
      "operator": ">=",
      "threshold": 0.95,
      "verified": true
    },
    {
      "property": "false_positive_rate",
      "value": 0.02,
      "operator": "<=",
      "threshold": 0.05,
      "verified": true
    }
  ],
  "issuer": {
    "id": "healthcare_org_001",
    "type": "organization",
    "credentials": ["cert_fda_510k"],
    "verified": true
  },
  "signature": {
    "algorithm": "ECDSA_secp256k1",
    "value": "0x8f9d3a4e5b6c7d8e...",
    "publicKey": "0x2a3b4c5d6e7f8g9h..."
  },
  "proof": {
    "type": "zk-SNARK",
    "data": "0x7f8e9d0c1b2a3456...",
    "verificationKey": "0x9e8d7c6b5a4f3e2d..."
  },
  "validFrom": "2024-01-27T12:30:00Z",
  "validTo": "2025-01-27T12:30:00Z",
  "revocable": true,
  "verificationUrl": "https://verify.treeship.dev/attest_7d8f9e8a7b6c5d4e",
  "createdAt": "2024-01-27T12:30:00Z"
}

Request

type
string
required
Type of attestation to create. Options:
  • capability - Attest to agent capabilities
  • performance - Attest to performance metrics
  • compliance - Attest to regulatory compliance
  • identity - Attest to agent identity
  • execution - Attest to successful execution
  • credential - General verifiable credential
subject
object
required
The entity being attested to
claims
array
required
List of claims being attested to
[
  {
    "property": "accuracy",
    "value": 0.97,
    "operator": ">=",
    "threshold": 0.95
  },
  {
    "property": "compliance",
    "value": "GDPR",
    "operator": "includes"
  }
]
evidence
object
required
Evidence supporting the attestation
issuer
object
required
Information about the attestation issuer
validityPeriod
object
Validity period for the attestation
privacy
object
Privacy settings for the attestation
curl -X POST https://api.treeship.dev/v1/attestations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "performance",
    "subject": {
      "id": "agent_ml_001",
      "type": "agent",
      "metadata": {
        "name": "Medical Diagnosis AI",
        "version": "2.1.0"
      }
    },
    "claims": [
      {
        "property": "diagnostic_accuracy",
        "value": 0.97,
        "operator": ">=",
        "threshold": 0.95
      },
      {
        "property": "false_positive_rate",
        "value": 0.02,
        "operator": "<=",
        "threshold": 0.05
      }
    ],
    "evidence": {
      "proofs": ["proof_abc123", "proof_def456"],
      "documents": [
        {
          "type": "test_results",
          "hash": "0x7d8f9e8a..."
        }
      ]
    },
    "issuer": {
      "id": "healthcare_org_001",
      "type": "organization",
      "credentials": ["cert_fda_510k"]
    },
    "validityPeriod": {
      "duration": "1y"
    },
    "privacy": {
      "selective_disclosure": true,
      "zero_knowledge": true
    }
  }'

Response

attestationId
string
Unique identifier for the created attestation
type
string
Type of attestation created
subject
object
Information about the attested subject
claims
array
List of verified claims in the attestation
issuer
object
Information about the attestation issuer
signature
object
Cryptographic signature of the attestation
proof
object
Zero-Knowledge proof supporting the attestation (if privacy enabled)
validFrom
string
ISO 8601 timestamp when attestation becomes valid
validTo
string
ISO 8601 timestamp when attestation expires (if applicable)
revocable
boolean
Whether the attestation can be revoked
verificationUrl
string
URL for public verification of the attestation
createdAt
string
ISO 8601 timestamp of creation
{
  "attestationId": "attest_7d8f9e8a7b6c5d4e",
  "type": "performance",
  "subject": {
    "id": "agent_ml_001",
    "type": "agent",
    "metadata": {
      "name": "Medical Diagnosis AI",
      "version": "2.1.0"
    }
  },
  "claims": [
    {
      "property": "diagnostic_accuracy",
      "value": 0.97,
      "operator": ">=",
      "threshold": 0.95,
      "verified": true
    },
    {
      "property": "false_positive_rate",
      "value": 0.02,
      "operator": "<=",
      "threshold": 0.05,
      "verified": true
    }
  ],
  "issuer": {
    "id": "healthcare_org_001",
    "type": "organization",
    "credentials": ["cert_fda_510k"],
    "verified": true
  },
  "signature": {
    "algorithm": "ECDSA_secp256k1",
    "value": "0x8f9d3a4e5b6c7d8e...",
    "publicKey": "0x2a3b4c5d6e7f8g9h..."
  },
  "proof": {
    "type": "zk-SNARK",
    "data": "0x7f8e9d0c1b2a3456...",
    "verificationKey": "0x9e8d7c6b5a4f3e2d..."
  },
  "validFrom": "2024-01-27T12:30:00Z",
  "validTo": "2025-01-27T12:30:00Z",
  "revocable": true,
  "verificationUrl": "https://verify.treeship.dev/attest_7d8f9e8a7b6c5d4e",
  "createdAt": "2024-01-27T12:30:00Z"
}

Attestation Types

Capability Attestation

Attest to an agent’s capabilities:
const capabilityAttestation = await treeship.attestations.create({
  type: 'capability',
  subject: { id: 'agent_123', type: 'agent' },
  claims: [
    {
      property: 'natural_language_processing',
      value: true,
      evidence_type: 'performance_test'
    },
    {
      property: 'max_context_length',
      value: 32000,
      operator: '>=',
      threshold: 16000
    }
  ],
  evidence: {
    proofs: ['capability_proof_xyz']
  }
});

Compliance Attestation

Attest to regulatory compliance:
const complianceAttestation = await treeship.attestations.create({
  type: 'compliance',
  subject: { id: 'financial_agent_456', type: 'agent' },
  claims: [
    {
      property: 'gdpr_compliance',
      value: 'compliant',
      framework: 'GDPR'
    },
    {
      property: 'data_retention',
      value: '30_days',
      policy: 'user_data_retention'
    }
  ],
  evidence: {
    proofs: ['gdpr_compliance_proof'],
    documents: [
      { type: 'audit_report', hash: '0x...' }
    ]
  }
});

Identity Attestation

Attest to agent identity and ownership:
const identityAttestation = await treeship.attestations.create({
  type: 'identity',
  subject: { id: 'agent_789', type: 'agent' },
  claims: [
    {
      property: 'controlled_by',
      value: 'organization_001',
      verification_method: 'cryptographic_signature'
    },
    {
      property: 'created_at',
      value: '2024-01-01T00:00:00Z',
      evidence_type: 'blockchain_record'
    }
  ]
});

Advanced Features

Composite Attestations

Create attestations that depend on other attestations:
const compositeAttestation = await treeship.attestations.create({
  type: 'credential',
  subject: { id: 'agent_composite', type: 'agent' },
  dependencies: [
    'attest_capability_123',
    'attest_performance_456',
    'attest_compliance_789'
  ],
  claims: [
    {
      property: 'qualified_for_production',
      value: true,
      logic: 'ALL_DEPENDENCIES_VALID'
    }
  ]
});

Revocable Attestations

Create attestations that can be revoked:
const revocableAttestation = await treeship.attestations.create({
  type: 'performance',
  // ... other fields
  revocation: {
    enabled: true,
    conditions: [
      'performance_degradation',
      'security_incident',
      'manual_request'
    ],
    revocationList: 'https://revocation.treeship.dev/list'
  }
});

// Later revoke if needed
await treeship.attestations.revoke(attestationId, {
  reason: 'performance_degradation',
  evidence: 'performance_monitoring_alert_001'
});

Batch Attestations

Create multiple attestations efficiently:
const batchAttestations = await treeship.attestations.createBatch([
  {
    type: 'capability',
    subject: { id: 'agent_001', type: 'agent' },
    claims: [...]
  },
  {
    type: 'performance',
    subject: { id: 'agent_002', type: 'agent' },
    claims: [...]
  }
]);

Verification

Verify attestations publicly:
// Public verification
const verification = await treeship.attestations.verify(attestationId);
console.log('Valid:', verification.isValid);
console.log('Claims verified:', verification.claims);

// Verify with selective disclosure
const partialVerification = await treeship.attestations.verify(
  attestationId,
  {
    revealClaims: ['diagnostic_accuracy'],
    hideClaims: ['false_positive_rate']
  }
);

Use Cases

Next Steps