# Rest API

## Get user enclaves

> Retrieve all enclaves associated with a wallet address

```json
{"openapi":"3.0.0","info":{"title":"Treza Platform API","version":"2.3.0"},"tags":[{"name":"Enclaves","description":"Secure enclave management and lifecycle control"}],"servers":[{"url":"https://app.trezalabs.com","description":"Production server"},{"url":"http://localhost:3000","description":"Development server"}],"security":[{"BearerAuth":[]},{"WalletAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"},"WalletAuth":{"type":"apiKey","in":"query","name":"wallet","description":"Wallet address for authentication"}},"schemas":{"Enclave":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"status":{"type":"string","enum":["PENDING_DEPLOY","DEPLOYING","DEPLOYED","PAUSING","PAUSED","RESUMING","PENDING_DESTROY","DESTROYING","DESTROYED","FAILED"]},"region":{"type":"string"},"walletAddress":{"type":"string"},"providerId":{"type":"string","description":"The ID of the provider used for this enclave"},"providerConfig":{"type":"object","description":"Provider-specific configuration settings"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"githubConnection":{"$ref":"#/components/schemas/GitHubConnection"},"error_message":{"type":"string","description":"Error message if enclave failed (optional)"}}},"GitHubConnection":{"type":"object","properties":{"isConnected":{"type":"boolean"},"username":{"type":"string"},"selectedRepo":{"type":"string"},"selectedBranch":{"type":"string"},"accessToken":{"type":"string"}}},"Error":{"type":"object","properties":{"error":{"type":"string"},"details":{"type":"array","items":{"type":"string"},"description":"Additional error details (optional)"}}}}},"paths":{"/api/enclaves":{"get":{"operationId":"listEnclaves","summary":"Get user enclaves","description":"Retrieve all enclaves associated with a wallet address","tags":["Enclaves"],"parameters":[{"name":"wallet","in":"query","required":true,"description":"Wallet address to filter enclaves","schema":{"type":"string"}}],"responses":{"200":{"description":"List of enclaves","content":{"application/json":{"schema":{"type":"object","properties":{"enclaves":{"type":"array","items":{"$ref":"#/components/schemas/Enclave"}}}}}}},"400":{"description":"Missing wallet address","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## Create new enclave

> Create a new secure enclave

```json
{"openapi":"3.0.0","info":{"title":"Treza Platform API","version":"2.3.0"},"tags":[{"name":"Enclaves","description":"Secure enclave management and lifecycle control"}],"servers":[{"url":"https://app.trezalabs.com","description":"Production server"},{"url":"http://localhost:3000","description":"Development server"}],"security":[{"BearerAuth":[]},{"WalletAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"},"WalletAuth":{"type":"apiKey","in":"query","name":"wallet","description":"Wallet address for authentication"}},"schemas":{"GitHubConnection":{"type":"object","properties":{"isConnected":{"type":"boolean"},"username":{"type":"string"},"selectedRepo":{"type":"string"},"selectedBranch":{"type":"string"},"accessToken":{"type":"string"}}},"Enclave":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"status":{"type":"string","enum":["PENDING_DEPLOY","DEPLOYING","DEPLOYED","PAUSING","PAUSED","RESUMING","PENDING_DESTROY","DESTROYING","DESTROYED","FAILED"]},"region":{"type":"string"},"walletAddress":{"type":"string"},"providerId":{"type":"string","description":"The ID of the provider used for this enclave"},"providerConfig":{"type":"object","description":"Provider-specific configuration settings"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"githubConnection":{"$ref":"#/components/schemas/GitHubConnection"},"error_message":{"type":"string","description":"Error message if enclave failed (optional)"}}},"Error":{"type":"object","properties":{"error":{"type":"string"},"details":{"type":"array","items":{"type":"string"},"description":"Additional error details (optional)"}}}}},"paths":{"/api/enclaves":{"post":{"operationId":"createEnclave","summary":"Create new enclave","description":"Create a new secure enclave","tags":["Enclaves"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name","description","region","walletAddress","providerId"],"properties":{"name":{"type":"string"},"description":{"type":"string"},"region":{"type":"string"},"walletAddress":{"type":"string"},"providerId":{"type":"string"},"providerConfig":{"type":"object"},"githubConnection":{"$ref":"#/components/schemas/GitHubConnection"}}}}}},"responses":{"201":{"description":"Enclave created successfully","content":{"application/json":{"schema":{"type":"object","properties":{"enclave":{"$ref":"#/components/schemas/Enclave"}}}}}},"400":{"description":"Missing required fields or invalid provider configuration","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## Update enclave

> Update an existing enclave

```json
{"openapi":"3.0.0","info":{"title":"Treza Platform API","version":"2.3.0"},"tags":[{"name":"Enclaves","description":"Secure enclave management and lifecycle control"}],"servers":[{"url":"https://app.trezalabs.com","description":"Production server"},{"url":"http://localhost:3000","description":"Development server"}],"security":[{"BearerAuth":[]},{"WalletAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"},"WalletAuth":{"type":"apiKey","in":"query","name":"wallet","description":"Wallet address for authentication"}},"schemas":{"GitHubConnection":{"type":"object","properties":{"isConnected":{"type":"boolean"},"username":{"type":"string"},"selectedRepo":{"type":"string"},"selectedBranch":{"type":"string"},"accessToken":{"type":"string"}}},"Enclave":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"status":{"type":"string","enum":["PENDING_DEPLOY","DEPLOYING","DEPLOYED","PAUSING","PAUSED","RESUMING","PENDING_DESTROY","DESTROYING","DESTROYED","FAILED"]},"region":{"type":"string"},"walletAddress":{"type":"string"},"providerId":{"type":"string","description":"The ID of the provider used for this enclave"},"providerConfig":{"type":"object","description":"Provider-specific configuration settings"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"githubConnection":{"$ref":"#/components/schemas/GitHubConnection"},"error_message":{"type":"string","description":"Error message if enclave failed (optional)"}}},"Error":{"type":"object","properties":{"error":{"type":"string"},"details":{"type":"array","items":{"type":"string"},"description":"Additional error details (optional)"}}}}},"paths":{"/api/enclaves":{"put":{"operationId":"updateEnclave","summary":"Update enclave","description":"Update an existing enclave","tags":["Enclaves"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["id","walletAddress"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"region":{"type":"string"},"walletAddress":{"type":"string"},"providerId":{"type":"string"},"providerConfig":{"type":"object"},"githubConnection":{"$ref":"#/components/schemas/GitHubConnection"}}}}}},"responses":{"200":{"description":"Enclave updated successfully","content":{"application/json":{"schema":{"type":"object","properties":{"enclave":{"$ref":"#/components/schemas/Enclave"}}}}}},"400":{"description":"Missing required fields or invalid provider configuration","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Enclave not found or access denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## Delete enclave

> Delete an existing enclave

```json
{"openapi":"3.0.0","info":{"title":"Treza Platform API","version":"2.3.0"},"tags":[{"name":"Enclaves","description":"Secure enclave management and lifecycle control"}],"servers":[{"url":"https://app.trezalabs.com","description":"Production server"},{"url":"http://localhost:3000","description":"Development server"}],"security":[{"BearerAuth":[]},{"WalletAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"},"WalletAuth":{"type":"apiKey","in":"query","name":"wallet","description":"Wallet address for authentication"}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"string"},"details":{"type":"array","items":{"type":"string"},"description":"Additional error details (optional)"}}}}},"paths":{"/api/enclaves":{"delete":{"operationId":"deleteEnclaveByQuery","summary":"Delete enclave","description":"Delete an existing enclave","tags":["Enclaves"],"parameters":[{"name":"id","in":"query","required":true,"description":"Enclave ID to delete","schema":{"type":"string"}},{"name":"wallet","in":"query","required":true,"description":"Wallet address for authorization","schema":{"type":"string"}}],"responses":{"200":{"description":"Enclave deleted successfully","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}},"400":{"description":"Missing required parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Enclave not found or access denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## Get specific enclave

> Retrieve details for a specific enclave by ID

```json
{"openapi":"3.0.0","info":{"title":"Treza Platform API","version":"2.3.0"},"tags":[{"name":"Enclaves","description":"Secure enclave management and lifecycle control"}],"servers":[{"url":"https://app.trezalabs.com","description":"Production server"},{"url":"http://localhost:3000","description":"Development server"}],"security":[{"BearerAuth":[]},{"WalletAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"},"WalletAuth":{"type":"apiKey","in":"query","name":"wallet","description":"Wallet address for authentication"}},"schemas":{"Enclave":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"status":{"type":"string","enum":["PENDING_DEPLOY","DEPLOYING","DEPLOYED","PAUSING","PAUSED","RESUMING","PENDING_DESTROY","DESTROYING","DESTROYED","FAILED"]},"region":{"type":"string"},"walletAddress":{"type":"string"},"providerId":{"type":"string","description":"The ID of the provider used for this enclave"},"providerConfig":{"type":"object","description":"Provider-specific configuration settings"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"githubConnection":{"$ref":"#/components/schemas/GitHubConnection"},"error_message":{"type":"string","description":"Error message if enclave failed (optional)"}}},"GitHubConnection":{"type":"object","properties":{"isConnected":{"type":"boolean"},"username":{"type":"string"},"selectedRepo":{"type":"string"},"selectedBranch":{"type":"string"},"accessToken":{"type":"string"}}},"Error":{"type":"object","properties":{"error":{"type":"string"},"details":{"type":"array","items":{"type":"string"},"description":"Additional error details (optional)"}}}}},"paths":{"/api/enclaves/{id}":{"get":{"operationId":"getEnclave","summary":"Get specific enclave","description":"Retrieve details for a specific enclave by ID","tags":["Enclaves"],"parameters":[{"name":"id","in":"path","required":true,"description":"Enclave ID","schema":{"type":"string"}}],"responses":{"200":{"description":"Enclave details retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"enclave":{"$ref":"#/components/schemas/Enclave"}}}}}},"404":{"description":"Enclave not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## Delete specific enclave

> Delete a specific enclave by ID (only if in terminal state)

```json
{"openapi":"3.0.0","info":{"title":"Treza Platform API","version":"2.3.0"},"tags":[{"name":"Enclaves","description":"Secure enclave management and lifecycle control"}],"servers":[{"url":"https://app.trezalabs.com","description":"Production server"},{"url":"http://localhost:3000","description":"Development server"}],"security":[{"BearerAuth":[]},{"WalletAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"},"WalletAuth":{"type":"apiKey","in":"query","name":"wallet","description":"Wallet address for authentication"}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"string"},"details":{"type":"array","items":{"type":"string"},"description":"Additional error details (optional)"}}}}},"paths":{"/api/enclaves/{id}":{"delete":{"operationId":"deleteEnclave","summary":"Delete specific enclave","description":"Delete a specific enclave by ID (only if in terminal state)","tags":["Enclaves"],"parameters":[{"name":"id","in":"path","required":true,"description":"Enclave ID","schema":{"type":"string"}},{"name":"wallet","in":"query","required":true,"description":"Wallet address for authorization","schema":{"type":"string"}}],"responses":{"200":{"description":"Enclave deleted successfully","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}},"400":{"description":"Enclave not in terminal state or missing parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Unauthorized - wallet mismatch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Enclave not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## Manage enclave lifecycle

> Perform lifecycle actions on an enclave (pause, resume, terminate)

```json
{"openapi":"3.0.0","info":{"title":"Treza Platform API","version":"2.3.0"},"tags":[{"name":"Enclaves","description":"Secure enclave management and lifecycle control"}],"servers":[{"url":"https://app.trezalabs.com","description":"Production server"},{"url":"http://localhost:3000","description":"Development server"}],"security":[{"BearerAuth":[]},{"WalletAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"},"WalletAuth":{"type":"apiKey","in":"query","name":"wallet","description":"Wallet address for authentication"}},"schemas":{"Enclave":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"status":{"type":"string","enum":["PENDING_DEPLOY","DEPLOYING","DEPLOYED","PAUSING","PAUSED","RESUMING","PENDING_DESTROY","DESTROYING","DESTROYED","FAILED"]},"region":{"type":"string"},"walletAddress":{"type":"string"},"providerId":{"type":"string","description":"The ID of the provider used for this enclave"},"providerConfig":{"type":"object","description":"Provider-specific configuration settings"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"githubConnection":{"$ref":"#/components/schemas/GitHubConnection"},"error_message":{"type":"string","description":"Error message if enclave failed (optional)"}}},"GitHubConnection":{"type":"object","properties":{"isConnected":{"type":"boolean"},"username":{"type":"string"},"selectedRepo":{"type":"string"},"selectedBranch":{"type":"string"},"accessToken":{"type":"string"}}},"Error":{"type":"object","properties":{"error":{"type":"string"},"details":{"type":"array","items":{"type":"string"},"description":"Additional error details (optional)"}}}}},"paths":{"/api/enclaves/{id}":{"patch":{"operationId":"enclaveLifecycleAction","summary":"Manage enclave lifecycle","description":"Perform lifecycle actions on an enclave (pause, resume, terminate)","tags":["Enclaves"],"parameters":[{"name":"id","in":"path","required":true,"description":"Enclave ID","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["action","walletAddress"],"properties":{"action":{"type":"string","enum":["pause","resume","terminate"],"description":"Action to perform on the enclave"},"walletAddress":{"type":"string"}}}}}},"responses":{"200":{"description":"Lifecycle action performed successfully","content":{"application/json":{"schema":{"type":"object","properties":{"enclave":{"$ref":"#/components/schemas/Enclave"},"message":{"type":"string"}}}}}},"400":{"description":"Invalid action or enclave state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Unauthorized - wallet mismatch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Enclave not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## Get enclave logs

> Retrieve logs for a specific enclave from various sources

```json
{"openapi":"3.0.0","info":{"title":"Treza Platform API","version":"2.3.0"},"tags":[{"name":"Enclaves","description":"Secure enclave management and lifecycle control"},{"name":"Logs","description":"Enclave logs and monitoring"}],"servers":[{"url":"https://app.trezalabs.com","description":"Production server"},{"url":"http://localhost:3000","description":"Development server"}],"security":[{"BearerAuth":[]},{"WalletAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"},"WalletAuth":{"type":"apiKey","in":"query","name":"wallet","description":"Wallet address for authentication"}},"schemas":{"LogsResponse":{"type":"object","properties":{"enclave_id":{"type":"string"},"enclave_name":{"type":"string"},"enclave_status":{"type":"string"},"logs":{"type":"object","properties":{"ecs":{"type":"array","items":{"$ref":"#/components/schemas/LogEntry"},"description":"ECS deployment logs (optional)"},"stepfunctions":{"type":"array","items":{"$ref":"#/components/schemas/LogEntry"},"description":"Step Functions workflow logs (optional)"},"lambda":{"type":"array","items":{"$ref":"#/components/schemas/LogEntry"},"description":"Lambda function logs (optional)"},"application":{"type":"array","items":{"$ref":"#/components/schemas/LogEntry"},"description":"Application logs from the enclave (optional)"},"errors":{"type":"array","items":{"$ref":"#/components/schemas/LogEntry"},"description":"Error logs from all sources (optional)"}}}}},"LogEntry":{"type":"object","properties":{"timestamp":{"type":"integer","format":"int64","description":"Unix timestamp in milliseconds"},"message":{"type":"string"},"source":{"type":"string","enum":["ecs","stepfunctions","lambda","application","dynamodb"]},"stream":{"type":"string","description":"Log stream name (optional)"},"type":{"type":"string","enum":["application","stdout","stderr","info","error"],"description":"Log type (optional)"},"logGroup":{"type":"string","description":"CloudWatch log group (optional)"},"function":{"type":"string","description":"Lambda function name for lambda logs (optional)"},"execution":{"type":"string","description":"Step Function execution name (optional)"},"stateMachine":{"type":"string","enum":["deployment","cleanup"],"description":"Step Function state machine type (optional)"}}},"Error":{"type":"object","properties":{"error":{"type":"string"},"details":{"type":"array","items":{"type":"string"},"description":"Additional error details (optional)"}}}}},"paths":{"/api/enclaves/{id}/logs":{"get":{"operationId":"getEnclaveLogs","summary":"Get enclave logs","description":"Retrieve logs for a specific enclave from various sources","tags":["Enclaves","Logs"],"parameters":[{"name":"id","in":"path","required":true,"description":"Enclave ID","schema":{"type":"string"}},{"name":"type","in":"query","required":false,"description":"Type of logs to retrieve","schema":{"type":"string","enum":["all","ecs","stepfunctions","lambda","application","errors"],"default":"all"}},{"name":"limit","in":"query","required":false,"description":"Maximum number of log entries to return","schema":{"type":"integer","minimum":1,"maximum":1000,"default":100}}],"responses":{"200":{"description":"Logs retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LogsResponse"}}}},"404":{"description":"Enclave not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## Get enclave attestation

> Retrieve cryptographic attestation document and verification details for a deployed enclave

```json
{"openapi":"3.0.0","info":{"title":"Treza Platform API","version":"2.3.0"},"tags":[{"name":"Enclaves","description":"Secure enclave management and lifecycle control"},{"name":"Attestation","description":"Cryptographic attestation and verification services"}],"servers":[{"url":"https://app.trezalabs.com","description":"Production server"},{"url":"http://localhost:3000","description":"Development server"}],"security":[{"BearerAuth":[]},{"WalletAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"},"WalletAuth":{"type":"apiKey","in":"query","name":"wallet","description":"Wallet address for authentication"}},"schemas":{"AttestationResponse":{"type":"object","properties":{"enclaveId":{"type":"string","description":"Enclave identifier"},"attestationDocument":{"$ref":"#/components/schemas/AttestationDocument"},"verification":{"$ref":"#/components/schemas/AttestationVerification"},"endpoints":{"type":"object","properties":{"verificationUrl":{"type":"string","format":"uri","description":"URL for third-party verification"},"apiEndpoint":{"type":"string","format":"uri","description":"API endpoint for attestation data"},"webhookUrl":{"type":"string","format":"uri","description":"Webhook URL for real-time verification updates"}},"required":["verificationUrl","apiEndpoint","webhookUrl"]}},"required":["enclaveId","attestationDocument","verification","endpoints"]},"AttestationDocument":{"type":"object","properties":{"moduleId":{"type":"string","description":"Unique identifier for the enclave module"},"digest":{"type":"string","description":"SHA-384 digest of the enclave image"},"timestamp":{"type":"integer","format":"int64","description":"Unix timestamp when attestation was generated"},"pcrs":{"type":"object","properties":{"0":{"type":"string","description":"PCR0: Hash of the enclave image file"},"1":{"type":"string","description":"PCR1: Linux kernel and bootstrap hash"},"2":{"type":"string","description":"PCR2: Application hash"},"8":{"type":"string","description":"PCR8: Signing certificate hash"}},"required":["0","1","2","8"]},"certificate":{"type":"string","description":"X.509 certificate for verification"},"cabundle":{"type":"array","items":{"type":"string"},"description":"Certificate authority bundle"},"publicKey":{"type":"string","description":"Public key for verification (optional)"},"userData":{"type":"string","nullable":true,"description":"User-provided data included in attestation (optional)"},"nonce":{"type":"string","description":"Nonce for replay attack protection (optional)"}},"required":["moduleId","digest","timestamp","pcrs","certificate","cabundle"]},"AttestationVerification":{"type":"object","properties":{"isValid":{"type":"boolean","description":"Whether the attestation is valid"},"trustLevel":{"type":"string","enum":["HIGH","MEDIUM","LOW"],"description":"Trust level based on verification results"},"verificationStatus":{"type":"string","enum":["VERIFIED","PENDING","FAILED"],"description":"Current verification status"},"integrityScore":{"type":"number","format":"float","minimum":0,"maximum":100,"description":"Integrity score as a percentage"},"lastVerified":{"type":"string","format":"date-time","description":"Timestamp of last verification"},"errors":{"type":"array","items":{"type":"string"},"description":"List of verification errors (if any)"}},"required":["isValid","trustLevel","verificationStatus","integrityScore","lastVerified"]},"Error":{"type":"object","properties":{"error":{"type":"string"},"details":{"type":"array","items":{"type":"string"},"description":"Additional error details (optional)"}}}}},"paths":{"/api/enclaves/{id}/attestation":{"get":{"operationId":"getAttestation","summary":"Get enclave attestation","description":"Retrieve cryptographic attestation document and verification details for a deployed enclave","tags":["Enclaves","Attestation"],"parameters":[{"name":"id","in":"path","required":true,"description":"Enclave ID","schema":{"type":"string"}}],"responses":{"200":{"description":"Attestation document and verification details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AttestationResponse"}}}},"400":{"description":"Attestation not available (enclave not deployed)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"status":{"type":"string"}}}}}},"404":{"description":"Enclave not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## Get verification status

> Get quick verification status for an enclave

```json
{"openapi":"3.0.0","info":{"title":"Treza Platform API","version":"2.3.0"},"tags":[{"name":"Enclaves","description":"Secure enclave management and lifecycle control"},{"name":"Attestation","description":"Cryptographic attestation and verification services"}],"servers":[{"url":"https://app.trezalabs.com","description":"Production server"},{"url":"http://localhost:3000","description":"Development server"}],"security":[{"BearerAuth":[]},{"WalletAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"},"WalletAuth":{"type":"apiKey","in":"query","name":"wallet","description":"Wallet address for authentication"}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"string"},"details":{"type":"array","items":{"type":"string"},"description":"Additional error details (optional)"}}}}},"paths":{"/api/enclaves/{id}/attestation/verify":{"get":{"operationId":"getVerificationStatus","summary":"Get verification status","description":"Get quick verification status for an enclave","tags":["Enclaves","Attestation"],"parameters":[{"name":"id","in":"path","required":true,"description":"Enclave ID","schema":{"type":"string"}}],"responses":{"200":{"description":"Verification status","content":{"application/json":{"schema":{"type":"object","properties":{"enclaveId":{"type":"string"},"isVerified":{"type":"boolean"},"status":{"type":"string"},"lastVerified":{"type":"string","format":"date-time"},"trustLevel":{"type":"string","enum":["HIGH","MEDIUM","LOW","UNKNOWN"]}}}}}},"404":{"description":"Enclave not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## Verify attestation document

> Perform comprehensive verification of an attestation document

```json
{"openapi":"3.0.0","info":{"title":"Treza Platform API","version":"2.3.0"},"tags":[{"name":"Enclaves","description":"Secure enclave management and lifecycle control"},{"name":"Attestation","description":"Cryptographic attestation and verification services"}],"servers":[{"url":"https://app.trezalabs.com","description":"Production server"},{"url":"http://localhost:3000","description":"Development server"}],"security":[{"BearerAuth":[]},{"WalletAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"},"WalletAuth":{"type":"apiKey","in":"query","name":"wallet","description":"Wallet address for authentication"}},"schemas":{"VerificationResult":{"type":"object","properties":{"isValid":{"type":"boolean","description":"Whether the attestation verification passed"},"trustLevel":{"type":"string","enum":["HIGH","MEDIUM","LOW"],"description":"Overall trust level"},"verificationDetails":{"type":"object","properties":{"pcrVerification":{"type":"boolean","description":"Whether PCR measurements are valid"},"certificateChain":{"type":"boolean","description":"Whether certificate chain verification passed"},"timestampValid":{"type":"boolean","description":"Whether timestamp is within acceptable range"},"nonceMatches":{"type":"boolean","description":"Whether provided nonce matches (if nonce was provided)"},"signatureValid":{"type":"boolean","description":"Whether cryptographic signature is valid"}},"required":["pcrVerification","certificateChain","timestampValid","nonceMatches","signatureValid"]},"complianceChecks":{"type":"object","properties":{"soc2":{"type":"boolean","description":"SOC 2 compliance status"},"hipaa":{"type":"boolean","description":"HIPAA compliance status"},"fips":{"type":"boolean","description":"FIPS 140-2 compliance status"},"commonCriteria":{"type":"boolean","description":"Common Criteria compliance status"}},"required":["soc2","hipaa","fips","commonCriteria"]},"riskScore":{"type":"integer","minimum":0,"maximum":100,"description":"Risk score (lower is better)"},"recommendations":{"type":"array","items":{"type":"string"},"description":"Security recommendations and observations"},"verifiedAt":{"type":"string","format":"date-time","description":"Timestamp when verification was performed"}},"required":["isValid","trustLevel","verificationDetails","complianceChecks","riskScore","recommendations","verifiedAt"]},"Error":{"type":"object","properties":{"error":{"type":"string"},"details":{"type":"array","items":{"type":"string"},"description":"Additional error details (optional)"}}}}},"paths":{"/api/enclaves/{id}/attestation/verify":{"post":{"operationId":"verifyAttestation","summary":"Verify attestation document","description":"Perform comprehensive verification of an attestation document","tags":["Enclaves","Attestation"],"parameters":[{"name":"id","in":"path","required":true,"description":"Enclave ID","schema":{"type":"string"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"attestationDocument":{"type":"string","description":"Base64 encoded attestation document (optional)"},"nonce":{"type":"string","description":"Nonce for replay attack protection"},"challenge":{"type":"string","description":"Challenge string for additional verification"}}}}}},"responses":{"200":{"description":"Verification result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerificationResult"}}}},"400":{"description":"Cannot verify (enclave not deployed)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"status":{"type":"string"}}}}}},"404":{"description":"Enclave not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## Search Docker Hub or get repository tags

> Search Docker Hub for images or get tags for a specific repository

```json
{"openapi":"3.0.0","info":{"title":"Treza Platform API","version":"2.3.0"},"tags":[{"name":"Docker","description":"Docker Hub integration and image management"}],"servers":[{"url":"https://app.trezalabs.com","description":"Production server"},{"url":"http://localhost:3000","description":"Development server"}],"security":[{"BearerAuth":[]},{"WalletAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"},"WalletAuth":{"type":"apiKey","in":"query","name":"wallet","description":"Wallet address for authentication"}},"schemas":{"DockerSearchResponse":{"type":"object","properties":{"count":{"type":"integer","description":"Total number of search results"},"results":{"type":"array","items":{"$ref":"#/components/schemas/DockerImage"}}}},"DockerImage":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"},"stars":{"type":"integer","description":"Number of stars on Docker Hub"},"official":{"type":"boolean","description":"Whether this is an official Docker image"},"automated":{"type":"boolean","description":"Whether this is an automated build"},"owner":{"type":"string","description":"Image owner/namespace (optional)"}}},"DockerTagsResponse":{"type":"object","properties":{"tags":{"type":"array","items":{"$ref":"#/components/schemas/DockerTag"}}}},"DockerTag":{"type":"object","properties":{"name":{"type":"string"},"size":{"type":"integer","format":"int64","description":"Image size in bytes"},"lastUpdated":{"type":"string","format":"date-time","description":"Last updated timestamp"},"digest":{"type":"string","description":"Image digest"}}},"Error":{"type":"object","properties":{"error":{"type":"string"},"details":{"type":"array","items":{"type":"string"},"description":"Additional error details (optional)"}}}}},"paths":{"/api/docker/search":{"get":{"operationId":"searchDockerImages","summary":"Search Docker Hub or get repository tags","description":"Search Docker Hub for images or get tags for a specific repository","tags":["Docker"],"parameters":[{"name":"q","in":"query","required":false,"description":"Search query for Docker images","schema":{"type":"string"}},{"name":"repo","in":"query","required":false,"description":"Repository name to get tags for (e.g., 'library/node')","schema":{"type":"string"}}],"responses":{"200":{"description":"Search results or repository tags","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/DockerSearchResponse"},{"$ref":"#/components/schemas/DockerTagsResponse"}]}}}},"400":{"description":"Missing required query parameter (q or repo)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error or Docker Hub API error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## Get available providers

> Retrieve all available enclave providers or a specific provider by ID

```json
{"openapi":"3.0.0","info":{"title":"Treza Platform API","version":"2.3.0"},"tags":[{"name":"Providers","description":"Enclave provider information"}],"servers":[{"url":"https://app.trezalabs.com","description":"Production server"},{"url":"http://localhost:3000","description":"Development server"}],"security":[{"BearerAuth":[]},{"WalletAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"},"WalletAuth":{"type":"apiKey","in":"query","name":"wallet","description":"Wallet address for authentication"}},"schemas":{"Provider":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"regions":{"type":"array","items":{"type":"string"}},"configSchema":{"type":"object","description":"Schema defining the configuration options for this provider"}}},"Error":{"type":"object","properties":{"error":{"type":"string"},"details":{"type":"array","items":{"type":"string"},"description":"Additional error details (optional)"}}}}},"paths":{"/api/providers":{"get":{"operationId":"listProviders","summary":"Get available providers","description":"Retrieve all available enclave providers or a specific provider by ID","tags":["Providers"],"parameters":[{"name":"id","in":"query","required":false,"description":"Specific provider ID to retrieve","schema":{"type":"string"}}],"responses":{"200":{"description":"Provider(s) retrieved successfully","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"providers":{"type":"array","items":{"$ref":"#/components/schemas/Provider"}}}},{"type":"object","properties":{"provider":{"$ref":"#/components/schemas/Provider"}}}]}}}},"404":{"description":"Provider not found (when requesting specific provider)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## Initiate GitHub OAuth flow

> Get GitHub OAuth authorization URL

```json
{"openapi":"3.0.0","info":{"title":"Treza Platform API","version":"2.3.0"},"tags":[{"name":"GitHub","description":"GitHub integration and OAuth"}],"servers":[{"url":"https://app.trezalabs.com","description":"Production server"},{"url":"http://localhost:3000","description":"Development server"}],"security":[{"BearerAuth":[]},{"WalletAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"},"WalletAuth":{"type":"apiKey","in":"query","name":"wallet","description":"Wallet address for authentication"}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"string"},"details":{"type":"array","items":{"type":"string"},"description":"Additional error details (optional)"}}}}},"paths":{"/api/github/auth":{"get":{"operationId":"getGitHubAuthUrl","summary":"Initiate GitHub OAuth flow","description":"Get GitHub OAuth authorization URL","tags":["GitHub"],"parameters":[{"name":"state","in":"query","required":false,"description":"Optional state parameter for OAuth flow","schema":{"type":"string"}}],"responses":{"200":{"description":"GitHub OAuth URL generated","content":{"application/json":{"schema":{"type":"object","properties":{"authUrl":{"type":"string","format":"uri"},"state":{"type":"string"}}}}}},"500":{"description":"GitHub client ID not configured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## Exchange OAuth code for access token

> Exchange GitHub OAuth authorization code for access token

```json
{"openapi":"3.0.0","info":{"title":"Treza Platform API","version":"2.3.0"},"tags":[{"name":"GitHub","description":"GitHub integration and OAuth"}],"servers":[{"url":"https://app.trezalabs.com","description":"Production server"},{"url":"http://localhost:3000","description":"Development server"}],"security":[{"BearerAuth":[]},{"WalletAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"},"WalletAuth":{"type":"apiKey","in":"query","name":"wallet","description":"Wallet address for authentication"}},"schemas":{"GitHubUser":{"type":"object","properties":{"id":{"type":"integer"},"login":{"type":"string"},"name":{"type":"string"},"avatar_url":{"type":"string","format":"uri"}}},"Error":{"type":"object","properties":{"error":{"type":"string"},"details":{"type":"array","items":{"type":"string"},"description":"Additional error details (optional)"}}}}},"paths":{"/api/github/auth":{"post":{"operationId":"exchangeGitHubCode","summary":"Exchange OAuth code for access token","description":"Exchange GitHub OAuth authorization code for access token","tags":["GitHub"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["code"],"properties":{"code":{"type":"string","description":"OAuth authorization code from GitHub"},"state":{"type":"string","description":"State parameter from OAuth flow"}}}}}},"responses":{"200":{"description":"Access token obtained successfully","content":{"application/json":{"schema":{"type":"object","properties":{"access_token":{"type":"string"},"user":{"$ref":"#/components/schemas/GitHubUser"}}}}}},"400":{"description":"Invalid authorization code or other OAuth error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"GitHub OAuth not configured or internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## GitHub OAuth callback

> Handle GitHub OAuth callback and redirect to platform

```json
{"openapi":"3.0.0","info":{"title":"Treza Platform API","version":"2.3.0"},"tags":[{"name":"GitHub","description":"GitHub integration and OAuth"}],"servers":[{"url":"https://app.trezalabs.com","description":"Production server"},{"url":"http://localhost:3000","description":"Development server"}],"security":[{"BearerAuth":[]},{"WalletAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"},"WalletAuth":{"type":"apiKey","in":"query","name":"wallet","description":"Wallet address for authentication"}}},"paths":{"/api/github/callback":{"get":{"operationId":"gitHubOAuthCallback","summary":"GitHub OAuth callback","description":"Handle GitHub OAuth callback and redirect to platform","tags":["GitHub"],"parameters":[{"name":"code","in":"query","required":false,"description":"OAuth authorization code","schema":{"type":"string"}},{"name":"state","in":"query","required":false,"description":"OAuth state parameter","schema":{"type":"string"}},{"name":"error","in":"query","required":false,"description":"OAuth error if any","schema":{"type":"string"}}],"responses":{"302":{"description":"Redirect to platform page with success or error parameters"}}}}}}
```

## Get user repositories

> Fetch GitHub repositories for authenticated user

```json
{"openapi":"3.0.0","info":{"title":"Treza Platform API","version":"2.3.0"},"tags":[{"name":"GitHub","description":"GitHub integration and OAuth"}],"servers":[{"url":"https://app.trezalabs.com","description":"Production server"},{"url":"http://localhost:3000","description":"Development server"}],"security":[{"BearerAuth":[]},{"WalletAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"},"WalletAuth":{"type":"apiKey","in":"query","name":"wallet","description":"Wallet address for authentication"}},"schemas":{"Repository":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"fullName":{"type":"string"},"description":{"type":"string"},"private":{"type":"boolean"},"defaultBranch":{"type":"string"},"language":{"type":"string"},"updatedAt":{"type":"string","format":"date-time"},"htmlUrl":{"type":"string","format":"uri"}}},"Error":{"type":"object","properties":{"error":{"type":"string"},"details":{"type":"array","items":{"type":"string"},"description":"Additional error details (optional)"}}}}},"paths":{"/api/github/repositories":{"get":{"operationId":"listGitHubRepos","summary":"Get user repositories","description":"Fetch GitHub repositories for authenticated user","tags":["GitHub"],"parameters":[{"name":"token","in":"query","required":true,"description":"GitHub access token","schema":{"type":"string"}}],"responses":{"200":{"description":"List of repositories","content":{"application/json":{"schema":{"type":"object","properties":{"repositories":{"type":"array","items":{"$ref":"#/components/schemas/Repository"}}}}}}},"400":{"description":"Access token required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Invalid access token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## Get repository branches

> Fetch branches for a specific repository

```json
{"openapi":"3.0.0","info":{"title":"Treza Platform API","version":"2.3.0"},"tags":[{"name":"GitHub","description":"GitHub integration and OAuth"}],"servers":[{"url":"https://app.trezalabs.com","description":"Production server"},{"url":"http://localhost:3000","description":"Development server"}],"security":[{"BearerAuth":[]},{"WalletAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"},"WalletAuth":{"type":"apiKey","in":"query","name":"wallet","description":"Wallet address for authentication"}},"schemas":{"Branch":{"type":"object","properties":{"name":{"type":"string"},"commit":{"type":"object","properties":{"sha":{"type":"string"},"url":{"type":"string","format":"uri"}}}}},"Error":{"type":"object","properties":{"error":{"type":"string"},"details":{"type":"array","items":{"type":"string"},"description":"Additional error details (optional)"}}}}},"paths":{"/api/github/repositories":{"post":{"operationId":"listGitHubBranches","summary":"Get repository branches","description":"Fetch branches for a specific repository","tags":["GitHub"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["accessToken","repository"],"properties":{"accessToken":{"type":"string"},"repository":{"type":"string"}}}}}},"responses":{"200":{"description":"List of branches","content":{"application/json":{"schema":{"type":"object","properties":{"branches":{"type":"array","items":{"$ref":"#/components/schemas/Branch"}}}}}}},"400":{"description":"Missing required fields","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Invalid access token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## Get API keys

> Retrieve all API keys for the authenticated user

```json
{"openapi":"3.0.0","info":{"title":"Treza Platform API","version":"2.3.0"},"tags":[{"name":"API Keys","description":"API key management with permissions and authentication"}],"servers":[{"url":"https://app.trezalabs.com","description":"Production server"},{"url":"http://localhost:3000","description":"Development server"}],"security":[{"BearerAuth":[]},{"WalletAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"},"WalletAuth":{"type":"apiKey","in":"query","name":"wallet","description":"Wallet address for authentication"}},"schemas":{"ApiKey":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"key":{"type":"string","description":"The actual API key (only returned on creation)"},"keyHash":{"type":"string","description":"SHA256 hash of the API key for storage"},"permissions":{"type":"array","items":{"type":"string","enum":["enclaves:read","enclaves:write","tasks:read","tasks:write","logs:read"]}},"status":{"type":"string","enum":["active","inactive"]},"walletAddress":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"lastUsed":{"type":"string","format":"date-time","description":"Timestamp of last usage (optional)"}}},"Error":{"type":"object","properties":{"error":{"type":"string"},"details":{"type":"array","items":{"type":"string"},"description":"Additional error details (optional)"}}}}},"paths":{"/api/api-keys":{"get":{"operationId":"listApiKeys","summary":"Get API keys","description":"Retrieve all API keys for the authenticated user","tags":["API Keys"],"parameters":[{"name":"wallet","in":"query","required":true,"description":"Wallet address to filter API keys","schema":{"type":"string"}}],"responses":{"200":{"description":"List of API keys","content":{"application/json":{"schema":{"type":"object","properties":{"apiKeys":{"type":"array","items":{"$ref":"#/components/schemas/ApiKey"}}}}}}},"400":{"description":"Missing wallet address","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## Create API key

> Create a new API key with specified permissions

```json
{"openapi":"3.0.0","info":{"title":"Treza Platform API","version":"2.3.0"},"tags":[{"name":"API Keys","description":"API key management with permissions and authentication"}],"servers":[{"url":"https://app.trezalabs.com","description":"Production server"},{"url":"http://localhost:3000","description":"Development server"}],"security":[{"BearerAuth":[]},{"WalletAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"},"WalletAuth":{"type":"apiKey","in":"query","name":"wallet","description":"Wallet address for authentication"}},"schemas":{"ApiKey":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"key":{"type":"string","description":"The actual API key (only returned on creation)"},"keyHash":{"type":"string","description":"SHA256 hash of the API key for storage"},"permissions":{"type":"array","items":{"type":"string","enum":["enclaves:read","enclaves:write","tasks:read","tasks:write","logs:read"]}},"status":{"type":"string","enum":["active","inactive"]},"walletAddress":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"lastUsed":{"type":"string","format":"date-time","description":"Timestamp of last usage (optional)"}}},"Error":{"type":"object","properties":{"error":{"type":"string"},"details":{"type":"array","items":{"type":"string"},"description":"Additional error details (optional)"}}}}},"paths":{"/api/api-keys":{"post":{"operationId":"createApiKey","summary":"Create API key","description":"Create a new API key with specified permissions","tags":["API Keys"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name","permissions","walletAddress"],"properties":{"name":{"type":"string"},"permissions":{"type":"array","items":{"type":"string","enum":["enclaves:read","enclaves:write","tasks:read","tasks:write","logs:read"]}},"walletAddress":{"type":"string"}}}}}},"responses":{"201":{"description":"API key created successfully","content":{"application/json":{"schema":{"type":"object","properties":{"apiKey":{"$ref":"#/components/schemas/ApiKey"}}}}}},"400":{"description":"Missing required fields or invalid permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## Update API key

> Update an existing API key

```json
{"openapi":"3.0.0","info":{"title":"Treza Platform API","version":"2.3.0"},"tags":[{"name":"API Keys","description":"API key management with permissions and authentication"}],"servers":[{"url":"https://app.trezalabs.com","description":"Production server"},{"url":"http://localhost:3000","description":"Development server"}],"security":[{"BearerAuth":[]},{"WalletAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"},"WalletAuth":{"type":"apiKey","in":"query","name":"wallet","description":"Wallet address for authentication"}},"schemas":{"ApiKey":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"key":{"type":"string","description":"The actual API key (only returned on creation)"},"keyHash":{"type":"string","description":"SHA256 hash of the API key for storage"},"permissions":{"type":"array","items":{"type":"string","enum":["enclaves:read","enclaves:write","tasks:read","tasks:write","logs:read"]}},"status":{"type":"string","enum":["active","inactive"]},"walletAddress":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"lastUsed":{"type":"string","format":"date-time","description":"Timestamp of last usage (optional)"}}},"Error":{"type":"object","properties":{"error":{"type":"string"},"details":{"type":"array","items":{"type":"string"},"description":"Additional error details (optional)"}}}}},"paths":{"/api/api-keys":{"put":{"operationId":"updateApiKey","summary":"Update API key","description":"Update an existing API key","tags":["API Keys"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["id","walletAddress"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"permissions":{"type":"array","items":{"type":"string","enum":["enclaves:read","enclaves:write","tasks:read","tasks:write","logs:read"]}},"status":{"type":"string","enum":["active","inactive"]},"walletAddress":{"type":"string"}}}}}},"responses":{"200":{"description":"API key updated successfully","content":{"application/json":{"schema":{"type":"object","properties":{"apiKey":{"$ref":"#/components/schemas/ApiKey"}}}}}},"400":{"description":"Missing required fields or invalid permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"API key not found or access denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## Delete API key

> Delete an existing API key

```json
{"openapi":"3.0.0","info":{"title":"Treza Platform API","version":"2.3.0"},"tags":[{"name":"API Keys","description":"API key management with permissions and authentication"}],"servers":[{"url":"https://app.trezalabs.com","description":"Production server"},{"url":"http://localhost:3000","description":"Development server"}],"security":[{"BearerAuth":[]},{"WalletAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"},"WalletAuth":{"type":"apiKey","in":"query","name":"wallet","description":"Wallet address for authentication"}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"string"},"details":{"type":"array","items":{"type":"string"},"description":"Additional error details (optional)"}}}}},"paths":{"/api/api-keys":{"delete":{"operationId":"deleteApiKey","summary":"Delete API key","description":"Delete an existing API key","tags":["API Keys"],"parameters":[{"name":"id","in":"query","required":true,"description":"API key ID to delete","schema":{"type":"string"}},{"name":"wallet","in":"query","required":true,"description":"Wallet address for authorization","schema":{"type":"string"}}],"responses":{"200":{"description":"API key deleted successfully","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}},"400":{"description":"Missing required parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"API key not found or access denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## Submit ZK proof for KYC verification

> Submit a zero-knowledge proof for KYC verification. The proof is validated, stored in DynamoDB,\
> and optionally submitted to the blockchain for immutable verification.\
> \
> \*\*Authentication:\*\* None required (open endpoint)\
> \
> \*\*Rate Limiting:\*\* Recommended 10 requests/hour per IP\
> \
> \*\*Security:\*\* Cryptographic proof validation prevents fake submissions<br>

```json
{"openapi":"3.0.0","info":{"title":"Treza Platform API","version":"2.3.0"},"tags":[{"name":"KYC","description":"Zero-knowledge proof KYC verification and management"}],"servers":[{"url":"https://app.trezalabs.com","description":"Production server"},{"url":"http://localhost:3000","description":"Development server"}],"security":[{"BearerAuth":[]},{"WalletAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"},"WalletAuth":{"type":"apiKey","in":"query","name":"wallet","description":"Wallet address for authentication"}},"schemas":{"ZKProof":{"type":"object","required":["commitment","proof","publicInputs","timestamp","algorithm"],"properties":{"commitment":{"type":"string","minLength":64,"maxLength":64,"pattern":"^[0-9a-fA-F]{64}$","description":"64-character hex commitment hash"},"proof":{"type":"string","minLength":65,"description":"Zero-knowledge proof data (minimum 65 characters)"},"publicInputs":{"type":"array","items":{"type":"string"},"minItems":1,"description":"Public inputs used in the ZK proof"},"timestamp":{"type":"string","format":"date-time","description":"Proof generation timestamp (must be within 1 hour)"},"algorithm":{"type":"string","enum":["Pedersen-SHA256"],"description":"Cryptographic algorithm used for the proof"}}},"Error":{"type":"object","properties":{"error":{"type":"string"},"details":{"type":"array","items":{"type":"string"},"description":"Additional error details (optional)"}}}}},"paths":{"/api/kyc/proof":{"post":{"operationId":"submitKYCProof","summary":"Submit ZK proof for KYC verification","description":"Submit a zero-knowledge proof for KYC verification. The proof is validated, stored in DynamoDB,\nand optionally submitted to the blockchain for immutable verification.\n\n**Authentication:** None required (open endpoint)\n\n**Rate Limiting:** Recommended 10 requests/hour per IP\n\n**Security:** Cryptographic proof validation prevents fake submissions\n","tags":["KYC"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["userId","proof"],"properties":{"userId":{"type":"string","description":"User identifier"},"proof":{"$ref":"#/components/schemas/ZKProof"},"deviceInfo":{"type":"object","properties":{"platform":{"type":"string"},"version":{"type":"string"}}}}}}}},"responses":{"201":{"description":"Proof submitted successfully","content":{"application/json":{"schema":{"type":"object","properties":{"proofId":{"type":"string","format":"uuid","description":"Unique identifier for the submitted proof"},"blockchainProofId":{"type":"string","description":"On-chain proof identifier (if blockchain submission succeeded)"},"verificationUrl":{"type":"string","format":"uri","description":"URL to verify the proof"},"expiresAt":{"type":"string","format":"date-time","description":"Proof expiration timestamp (7 days from submission)"},"chainTxHash":{"type":"string","description":"Blockchain transaction hash (if blockchain submission succeeded)"}}}}}},"400":{"description":"Invalid request or proof verification failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## Get proof details

> Retrieve details for a specific KYC proof by ID. By default returns public data only.

```json
{"openapi":"3.0.0","info":{"title":"Treza Platform API","version":"2.3.0"},"tags":[{"name":"KYC","description":"Zero-knowledge proof KYC verification and management"}],"servers":[{"url":"https://app.trezalabs.com","description":"Production server"},{"url":"http://localhost:3000","description":"Development server"}],"security":[{"BearerAuth":[]},{"WalletAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"},"WalletAuth":{"type":"apiKey","in":"query","name":"wallet","description":"Wallet address for authentication"}},"schemas":{"ProofDetails":{"type":"object","properties":{"proofId":{"type":"string","format":"uuid","description":"Unique proof identifier"},"commitment":{"type":"string","description":"Commitment hash"},"publicInputs":{"type":"array","items":{"type":"string"},"description":"Public inputs"},"algorithm":{"type":"string","description":"Algorithm used"},"verifiedAt":{"type":"string","format":"date-time","description":"Verification timestamp"},"expiresAt":{"type":"string","format":"date-time","description":"Expiration timestamp (7 days after verification)"},"proof":{"type":"string","description":"Proof signature (only included when includePrivate=true)"},"timestamp":{"type":"string","format":"date-time","description":"Original proof timestamp (only included when includePrivate=true)"}},"required":["proofId","commitment","publicInputs","algorithm","verifiedAt","expiresAt"]},"Error":{"type":"object","properties":{"error":{"type":"string"},"details":{"type":"array","items":{"type":"string"},"description":"Additional error details (optional)"}}}}},"paths":{"/api/kyc/proof/{proofId}":{"get":{"operationId":"getKYCProof","summary":"Get proof details","description":"Retrieve details for a specific KYC proof by ID. By default returns public data only.","tags":["KYC"],"parameters":[{"name":"proofId","in":"path","required":true,"description":"Proof ID (UUID)","schema":{"type":"string","format":"uuid"}},{"name":"includePrivate","in":"query","required":false,"description":"Include private proof data (requires authentication)","schema":{"type":"boolean","default":false}}],"responses":{"200":{"description":"Proof details retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProofDetails"}}}},"404":{"description":"Proof not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## Verify a proof by ID

> Verify the validity of a KYC proof, checking expiration and blockchain status

```json
{"openapi":"3.0.0","info":{"title":"Treza Platform API","version":"2.3.0"},"tags":[{"name":"KYC","description":"Zero-knowledge proof KYC verification and management"}],"servers":[{"url":"https://app.trezalabs.com","description":"Production server"},{"url":"http://localhost:3000","description":"Development server"}],"security":[{"BearerAuth":[]},{"WalletAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"},"WalletAuth":{"type":"apiKey","in":"query","name":"wallet","description":"Wallet address for authentication"}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"string"},"details":{"type":"array","items":{"type":"string"},"description":"Additional error details (optional)"}}}}},"paths":{"/api/kyc/proof/{proofId}/verify":{"get":{"operationId":"verifyKYCProof","summary":"Verify a proof by ID","description":"Verify the validity of a KYC proof, checking expiration and blockchain status","tags":["KYC"],"parameters":[{"name":"proofId","in":"path","required":true,"description":"Proof ID (UUID)","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Verification result","content":{"application/json":{"schema":{"type":"object","properties":{"proofId":{"type":"string","format":"uuid"},"isValid":{"type":"boolean","description":"Whether the proof is valid and not expired"},"publicInputs":{"type":"array","items":{"type":"string"},"description":"Public inputs used in the proof"},"verifiedAt":{"type":"string","format":"date-time","description":"Timestamp when proof was originally verified"},"chainVerified":{"type":"boolean","description":"Whether the proof was verified on blockchain"},"expiresAt":{"type":"string","format":"date-time","description":"Proof expiration timestamp"}}}}}},"404":{"description":"Proof not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"410":{"description":"Proof expired","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"expiresAt":{"type":"string","format":"date-time"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## Get tasks

> Retrieve tasks for the authenticated user, optionally filtered by enclave

```json
{"openapi":"3.0.0","info":{"title":"Treza Platform API","version":"2.3.0"},"tags":[{"name":"Tasks","description":"Task scheduling and management within enclaves"}],"servers":[{"url":"https://app.trezalabs.com","description":"Production server"},{"url":"http://localhost:3000","description":"Development server"}],"security":[{"BearerAuth":[]},{"WalletAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"},"WalletAuth":{"type":"apiKey","in":"query","name":"wallet","description":"Wallet address for authentication"}},"schemas":{"Task":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"enclaveId":{"type":"string"},"status":{"type":"string","enum":["running","stopped","failed","pending"]},"schedule":{"type":"string","description":"Cron-style schedule expression"},"walletAddress":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"lastRun":{"type":"string","format":"date-time","description":"Timestamp of last execution (optional)"}}},"Error":{"type":"object","properties":{"error":{"type":"string"},"details":{"type":"array","items":{"type":"string"},"description":"Additional error details (optional)"}}}}},"paths":{"/api/tasks":{"get":{"operationId":"listTasks","summary":"Get tasks","description":"Retrieve tasks for the authenticated user, optionally filtered by enclave","tags":["Tasks"],"parameters":[{"name":"wallet","in":"query","required":true,"description":"Wallet address to filter tasks","schema":{"type":"string"}},{"name":"enclave","in":"query","required":false,"description":"Optional enclave ID to filter tasks","schema":{"type":"string"}}],"responses":{"200":{"description":"List of tasks","content":{"application/json":{"schema":{"type":"object","properties":{"tasks":{"type":"array","items":{"$ref":"#/components/schemas/Task"}}}}}}},"400":{"description":"Missing wallet address","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## Create task

> Create a new task within an enclave

```json
{"openapi":"3.0.0","info":{"title":"Treza Platform API","version":"2.3.0"},"tags":[{"name":"Tasks","description":"Task scheduling and management within enclaves"}],"servers":[{"url":"https://app.trezalabs.com","description":"Production server"},{"url":"http://localhost:3000","description":"Development server"}],"security":[{"BearerAuth":[]},{"WalletAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"},"WalletAuth":{"type":"apiKey","in":"query","name":"wallet","description":"Wallet address for authentication"}},"schemas":{"Task":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"enclaveId":{"type":"string"},"status":{"type":"string","enum":["running","stopped","failed","pending"]},"schedule":{"type":"string","description":"Cron-style schedule expression"},"walletAddress":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"lastRun":{"type":"string","format":"date-time","description":"Timestamp of last execution (optional)"}}},"Error":{"type":"object","properties":{"error":{"type":"string"},"details":{"type":"array","items":{"type":"string"},"description":"Additional error details (optional)"}}}}},"paths":{"/api/tasks":{"post":{"operationId":"createTask","summary":"Create task","description":"Create a new task within an enclave","tags":["Tasks"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name","description","enclaveId","schedule","walletAddress"],"properties":{"name":{"type":"string"},"description":{"type":"string"},"enclaveId":{"type":"string"},"schedule":{"type":"string","description":"Cron-style schedule expression"},"walletAddress":{"type":"string"}}}}}},"responses":{"201":{"description":"Task created successfully","content":{"application/json":{"schema":{"type":"object","properties":{"task":{"$ref":"#/components/schemas/Task"}}}}}},"400":{"description":"Missing required fields","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## Update task

> Update an existing task

```json
{"openapi":"3.0.0","info":{"title":"Treza Platform API","version":"2.3.0"},"tags":[{"name":"Tasks","description":"Task scheduling and management within enclaves"}],"servers":[{"url":"https://app.trezalabs.com","description":"Production server"},{"url":"http://localhost:3000","description":"Development server"}],"security":[{"BearerAuth":[]},{"WalletAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"},"WalletAuth":{"type":"apiKey","in":"query","name":"wallet","description":"Wallet address for authentication"}},"schemas":{"Task":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"enclaveId":{"type":"string"},"status":{"type":"string","enum":["running","stopped","failed","pending"]},"schedule":{"type":"string","description":"Cron-style schedule expression"},"walletAddress":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"lastRun":{"type":"string","format":"date-time","description":"Timestamp of last execution (optional)"}}},"Error":{"type":"object","properties":{"error":{"type":"string"},"details":{"type":"array","items":{"type":"string"},"description":"Additional error details (optional)"}}}}},"paths":{"/api/tasks":{"put":{"operationId":"updateTask","summary":"Update task","description":"Update an existing task","tags":["Tasks"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["id","walletAddress"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"schedule":{"type":"string"},"status":{"type":"string","enum":["running","stopped","failed","pending"]},"walletAddress":{"type":"string"}}}}}},"responses":{"200":{"description":"Task updated successfully","content":{"application/json":{"schema":{"type":"object","properties":{"task":{"$ref":"#/components/schemas/Task"}}}}}},"400":{"description":"Missing required fields","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Task not found or access denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## Delete task

> Delete an existing task

```json
{"openapi":"3.0.0","info":{"title":"Treza Platform API","version":"2.3.0"},"tags":[{"name":"Tasks","description":"Task scheduling and management within enclaves"}],"servers":[{"url":"https://app.trezalabs.com","description":"Production server"},{"url":"http://localhost:3000","description":"Development server"}],"security":[{"BearerAuth":[]},{"WalletAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"},"WalletAuth":{"type":"apiKey","in":"query","name":"wallet","description":"Wallet address for authentication"}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"string"},"details":{"type":"array","items":{"type":"string"},"description":"Additional error details (optional)"}}}}},"paths":{"/api/tasks":{"delete":{"operationId":"deleteTask","summary":"Delete task","description":"Delete an existing task","tags":["Tasks"],"parameters":[{"name":"id","in":"query","required":true,"description":"Task ID to delete","schema":{"type":"string"}},{"name":"wallet","in":"query","required":true,"description":"Wallet address for authorization","schema":{"type":"string"}}],"responses":{"200":{"description":"Task deleted successfully","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}},"400":{"description":"Missing required parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Task not found or access denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.trezalabs.com/developers/rest-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
