Skip to main content

Create Attestation

Create a new cryptographically signed attestation for an agent action.

Endpoint

POST /v1/attest

Authentication

Required. Include your API key as a Bearer token:
Authorization: Bearer YOUR_API_KEY

Request Body

{
  "agent_slug": "my-agent",
  "action": "Processed customer request #12345",
  "inputs_hash": "a1b2c3d4e5f6...",
  "metadata": {
    "request_id": "req_123",
    "confidence": 0.95
  }
}
FieldTypeRequiredDescription
agent_slugstringYesUnique identifier for the agent (1-64 chars)
actionstringYesHuman-readable description of the action
inputs_hashstringYesSHA256 hash of the inputs (1-128 chars)
metadataobjectNoAdditional key-value data

Response

Status: 201 Created
{
  "attestation_id": "abc123-def456-ghi789-jkl012",
  "agent_slug": "my-agent",
  "action": "Processed customer request #12345",
  "inputs_hash": "a1b2c3d4e5f6...",
  "timestamp": "2024-01-15T10:30:00.000Z",
  "payload_hash": "sha256-of-canonical-payload",
  "signature": "base64-ed25519-signature",
  "key_id": "abc123def456",
  "public_url": "https://treeship.dev/verify/my-agent/abc123-def456...",
  "verify_command": "treeship verify abc123-def456..."
}

Example

curl -X POST https://api.treeship.dev/v1/attest \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "agent_slug": "loan-processor",
    "action": "Approved loan application #12345 for $50,000",
    "inputs_hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
  }'

Errors

StatusErrorDescription
401Missing AuthorizationNo API key provided
401Invalid API keyAPI key is incorrect
422Validation errorMissing or invalid fields