Rest API
Retrieve all enclaves associated with a wallet address
Wallet address to filter enclaves
0x4B0897b0513fdc7C541B6d9D7E929C4e5364D2dB
List of enclaves
Missing wallet address
Internal server error
GET /api/enclaves HTTP/1.1
Host: app.trezalabs.com
Authorization: Bearer JWT
Accept: */*
{
"enclaves": [
{
"id": "enc_123456",
"name": "Trading Bot Enclave",
"description": "Secure environment for automated trading strategies",
"status": "PENDING_DEPLOY",
"region": "us-east-1",
"walletAddress": "0x4B0897b0513fdc7C541B6d9D7E929C4e5364D2dB",
"providerId": "aws-nitro",
"providerConfig": {
"dockerImage": "my-app:latest",
"cpuCount": 2,
"memoryMiB": 512
},
"createdAt": "2024-01-15T00:00:00Z",
"updatedAt": "2024-01-15T00:00:00Z",
"githubConnection": {
"isConnected": true,
"username": "example-user",
"selectedRepo": "example-user/trading-bot",
"selectedBranch": "main",
"accessToken": "gho_xxxxxxxxxxxxxxxxxxxx"
},
"error_message": "Deployment failed: Instance type not compatible with Nitro Enclaves"
}
]
}
Create a new secure enclave
Trading Bot Enclave
Secure environment for automated trading strategies
us-east-1
0x4B0897b0513fdc7C541B6d9D7E929C4e5364D2dB
aws-nitro
{"dockerImage":"my-app:latest","cpuCount":2,"memoryMiB":512}
Enclave created successfully
Missing required fields or invalid provider configuration
Internal server error
POST /api/enclaves HTTP/1.1
Host: app.trezalabs.com
Authorization: Bearer JWT
Content-Type: application/json
Accept: */*
Content-Length: 456
{
"name": "Trading Bot Enclave",
"description": "Secure environment for automated trading strategies",
"region": "us-east-1",
"walletAddress": "0x4B0897b0513fdc7C541B6d9D7E929C4e5364D2dB",
"providerId": "aws-nitro",
"providerConfig": {
"dockerImage": "my-app:latest",
"cpuCount": 2,
"memoryMiB": 512
},
"githubConnection": {
"isConnected": true,
"username": "example-user",
"selectedRepo": "example-user/trading-bot",
"selectedBranch": "main",
"accessToken": "gho_xxxxxxxxxxxxxxxxxxxx"
}
}
{
"enclave": {
"id": "enc_123456",
"name": "Trading Bot Enclave",
"description": "Secure environment for automated trading strategies",
"status": "PENDING_DEPLOY",
"region": "us-east-1",
"walletAddress": "0x4B0897b0513fdc7C541B6d9D7E929C4e5364D2dB",
"providerId": "aws-nitro",
"providerConfig": {
"dockerImage": "my-app:latest",
"cpuCount": 2,
"memoryMiB": 512
},
"createdAt": "2024-01-15T00:00:00Z",
"updatedAt": "2024-01-15T00:00:00Z",
"githubConnection": {
"isConnected": true,
"username": "example-user",
"selectedRepo": "example-user/trading-bot",
"selectedBranch": "main",
"accessToken": "gho_xxxxxxxxxxxxxxxxxxxx"
},
"error_message": "Deployment failed: Instance type not compatible with Nitro Enclaves"
}
}
Update an existing enclave
enc_123456
Updated Enclave Name
Updated description
us-west-2
0x4B0897b0513fdc7C541B6d9D7E929C4e5364D2dB
aws-nitro
{"dockerImage":"my-app:v2","cpuCount":4,"memoryMiB":1024}
Enclave updated successfully
Missing required fields or invalid provider configuration
Enclave not found or access denied
Internal server error
PUT /api/enclaves HTTP/1.1
Host: app.trezalabs.com
Authorization: Bearer JWT
Content-Type: application/json
Accept: */*
Content-Length: 440
{
"id": "enc_123456",
"name": "Updated Enclave Name",
"description": "Updated description",
"region": "us-west-2",
"walletAddress": "0x4B0897b0513fdc7C541B6d9D7E929C4e5364D2dB",
"providerId": "aws-nitro",
"providerConfig": {
"dockerImage": "my-app:v2",
"cpuCount": 4,
"memoryMiB": 1024
},
"githubConnection": {
"isConnected": true,
"username": "example-user",
"selectedRepo": "example-user/trading-bot",
"selectedBranch": "main",
"accessToken": "gho_xxxxxxxxxxxxxxxxxxxx"
}
}
{
"enclave": {
"id": "enc_123456",
"name": "Trading Bot Enclave",
"description": "Secure environment for automated trading strategies",
"status": "PENDING_DEPLOY",
"region": "us-east-1",
"walletAddress": "0x4B0897b0513fdc7C541B6d9D7E929C4e5364D2dB",
"providerId": "aws-nitro",
"providerConfig": {
"dockerImage": "my-app:latest",
"cpuCount": 2,
"memoryMiB": 512
},
"createdAt": "2024-01-15T00:00:00Z",
"updatedAt": "2024-01-15T00:00:00Z",
"githubConnection": {
"isConnected": true,
"username": "example-user",
"selectedRepo": "example-user/trading-bot",
"selectedBranch": "main",
"accessToken": "gho_xxxxxxxxxxxxxxxxxxxx"
},
"error_message": "Deployment failed: Instance type not compatible with Nitro Enclaves"
}
}
Delete an existing enclave
Enclave ID to delete
enc_123456
Wallet address for authorization
0x4B0897b0513fdc7C541B6d9D7E929C4e5364D2dB
Enclave deleted successfully
Missing required parameters
Enclave not found or access denied
Internal server error
DELETE /api/enclaves HTTP/1.1
Host: app.trezalabs.com
Authorization: Bearer JWT
Accept: */*
{
"message": "Enclave deleted successfully"
}
Retrieve all available enclave providers or a specific provider by ID
Specific provider ID to retrieve
aws-nitro
Provider(s) retrieved successfully
Provider not found (when requesting specific provider)
Internal server error
GET /api/providers HTTP/1.1
Host: app.trezalabs.com
Authorization: Bearer JWT
Accept: */*
{
"providers": [
{
"id": "aws-nitro",
"name": "AWS Nitro Enclaves",
"description": "Secure isolated compute environments using AWS Nitro technology",
"regions": [
"us-east-1",
"us-west-2",
"eu-west-1"
],
"configSchema": {
"dockerImage": {
"type": "string",
"label": "Docker Image",
"required": true,
"description": "Container image to deploy"
},
"cpuCount": {
"type": "number",
"label": "CPU Count",
"defaultValue": 2,
"validation": {
"min": 1,
"max": 8
}
}
}
}
]
}
Get GitHub OAuth authorization URL
Optional state parameter for OAuth flow
GitHub OAuth URL generated
GitHub client ID not configured
GET /api/github/auth HTTP/1.1
Host: app.trezalabs.com
Authorization: Bearer JWT
Accept: */*
{
"authUrl": "https://github.com/login/oauth/authorize?client_id=...",
"state": "abc123"
}
Exchange GitHub OAuth authorization code for access token
OAuth authorization code from GitHub
abcdef123456
State parameter from OAuth flow
abc123
Access token obtained successfully
Invalid authorization code or other OAuth error
GitHub OAuth not configured or internal error
POST /api/github/auth HTTP/1.1
Host: app.trezalabs.com
Authorization: Bearer JWT
Content-Type: application/json
Accept: */*
Content-Length: 40
{
"code": "abcdef123456",
"state": "abc123"
}
{
"access_token": "gho_xxxxxxxxxxxxxxxxxxxx",
"user": {
"id": 12345,
"login": "username",
"name": "John Doe",
"avatar_url": "https://avatars.githubusercontent.com/u/12345"
}
}
Handle GitHub OAuth callback and redirect to platform
OAuth authorization code
OAuth state parameter
OAuth error if any
Redirect to platform page with success or error parameters
No content
GET /api/github/callback HTTP/1.1
Host: app.trezalabs.com
Authorization: Bearer JWT
Accept: */*
Redirect to platform page with success or error parameters
No content
Fetch GitHub repositories for authenticated user
GitHub access token
gho_xxxxxxxxxxxxxxxxxxxx
List of repositories
Access token required
Invalid access token
Internal server error
GET /api/github/repositories HTTP/1.1
Host: app.trezalabs.com
Authorization: Bearer JWT
Accept: */*
{
"repositories": [
{
"id": 123456,
"name": "my-repo",
"fullName": "username/my-repo",
"description": "A sample repository",
"private": false,
"defaultBranch": "main",
"language": "TypeScript",
"updatedAt": "2024-01-15T00:00:00Z",
"htmlUrl": "https://github.com/username/my-repo"
}
]
}
Fetch branches for a specific repository
gho_xxxxxxxxxxxxxxxxxxxx
username/repo-name
List of branches
Missing required fields
Invalid access token
Internal server error
POST /api/github/repositories HTTP/1.1
Host: app.trezalabs.com
Authorization: Bearer JWT
Content-Type: application/json
Accept: */*
Content-Length: 76
{
"accessToken": "gho_xxxxxxxxxxxxxxxxxxxx",
"repository": "username/repo-name"
}
{
"branches": [
{
"name": "main",
"commit": {
"sha": "abc123def456",
"url": "https://api.github.com/repos/username/repo/commits/abc123def456"
}
}
]
}
Retrieve all API keys for the authenticated user
Wallet address to filter API keys
0x4B0897b0513fdc7C541B6d9D7E929C4e5364D2dB
List of API keys
Missing wallet address
Internal server error
GET /api/api-keys HTTP/1.1
Host: app.trezalabs.com
Authorization: Bearer JWT
Accept: */*
{
"apiKeys": [
{
"id": "key_123456",
"name": "Production API Key",
"key": "api_key_example_12345",
"keyHash": "sha256_hash_of_key",
"permissions": [
"enclaves:read",
"tasks:read"
],
"status": "active",
"walletAddress": "0x4B0897b0513fdc7C541B6d9D7E929C4e5364D2dB",
"createdAt": "2024-01-15T00:00:00Z",
"updatedAt": "2024-01-15T00:00:00Z",
"lastUsed": "2024-01-15T12:30:00Z"
}
]
}
Create a new API key with specified permissions
Production API Key
0x4B0897b0513fdc7C541B6d9D7E929C4e5364D2dB
API key created successfully
Missing required fields or invalid permissions
Internal server error
POST /api/api-keys HTTP/1.1
Host: app.trezalabs.com
Authorization: Bearer JWT
Content-Type: application/json
Accept: */*
Content-Length: 135
{
"name": "Production API Key",
"permissions": [
"enclaves:read",
"tasks:read"
],
"walletAddress": "0x4B0897b0513fdc7C541B6d9D7E929C4e5364D2dB"
}
{
"apiKey": {
"id": "key_123456",
"name": "Production API Key",
"key": "api_key_example_12345",
"keyHash": "sha256_hash_of_key",
"permissions": [
"enclaves:read",
"tasks:read"
],
"status": "active",
"walletAddress": "0x4B0897b0513fdc7C541B6d9D7E929C4e5364D2dB",
"createdAt": "2024-01-15T00:00:00Z",
"updatedAt": "2024-01-15T00:00:00Z",
"lastUsed": "2024-01-15T12:30:00Z"
}
}
Update an existing API key
key_123456
Updated API Key Name
active
Possible values: 0x4B0897b0513fdc7C541B6d9D7E929C4e5364D2dB
API key updated successfully
Missing required fields or invalid permissions
API key not found or access denied
Internal server error
PUT /api/api-keys HTTP/1.1
Host: app.trezalabs.com
Authorization: Bearer JWT
Content-Type: application/json
Accept: */*
Content-Length: 177
{
"id": "key_123456",
"name": "Updated API Key Name",
"permissions": [
"enclaves:read",
"enclaves:write"
],
"status": "active",
"walletAddress": "0x4B0897b0513fdc7C541B6d9D7E929C4e5364D2dB"
}
{
"apiKey": {
"id": "key_123456",
"name": "Production API Key",
"key": "api_key_example_12345",
"keyHash": "sha256_hash_of_key",
"permissions": [
"enclaves:read",
"tasks:read"
],
"status": "active",
"walletAddress": "0x4B0897b0513fdc7C541B6d9D7E929C4e5364D2dB",
"createdAt": "2024-01-15T00:00:00Z",
"updatedAt": "2024-01-15T00:00:00Z",
"lastUsed": "2024-01-15T12:30:00Z"
}
}
Delete an existing API key
API key ID to delete
key_123456
Wallet address for authorization
0x4B0897b0513fdc7C541B6d9D7E929C4e5364D2dB
API key deleted successfully
Missing required parameters
API key not found or access denied
Internal server error
DELETE /api/api-keys HTTP/1.1
Host: app.trezalabs.com
Authorization: Bearer JWT
Accept: */*
{
"message": "API key deleted successfully"
}
Retrieve tasks for the authenticated user, optionally filtered by enclave
Wallet address to filter tasks
0x4B0897b0513fdc7C541B6d9D7E929C4e5364D2dB
Optional enclave ID to filter tasks
enc_123456
List of tasks
Missing wallet address
Internal server error
GET /api/tasks HTTP/1.1
Host: app.trezalabs.com
Authorization: Bearer JWT
Accept: */*
{
"tasks": [
{
"id": "task_123456",
"name": "Daily Price Monitor",
"description": "Monitor cryptocurrency prices and send alerts",
"enclaveId": "enc_123456",
"status": "pending",
"schedule": "0 9 * * *",
"walletAddress": "0x4B0897b0513fdc7C541B6d9D7E929C4e5364D2dB",
"createdAt": "2024-01-15T00:00:00Z",
"updatedAt": "2024-01-15T00:00:00Z",
"lastRun": "2024-01-15T09:00:00Z"
}
]
}
Create a new task within an enclave
Daily Price Monitor
Monitor cryptocurrency prices and send alerts
enc_123456
Cron-style schedule expression
0 9 * * *
0x4B0897b0513fdc7C541B6d9D7E929C4e5364D2dB
Task created successfully
Missing required fields
Internal server error
POST /api/tasks HTTP/1.1
Host: app.trezalabs.com
Authorization: Bearer JWT
Content-Type: application/json
Accept: */*
Content-Length: 201
{
"name": "Daily Price Monitor",
"description": "Monitor cryptocurrency prices and send alerts",
"enclaveId": "enc_123456",
"schedule": "0 9 * * *",
"walletAddress": "0x4B0897b0513fdc7C541B6d9D7E929C4e5364D2dB"
}
{
"task": {
"id": "task_123456",
"name": "Daily Price Monitor",
"description": "Monitor cryptocurrency prices and send alerts",
"enclaveId": "enc_123456",
"status": "pending",
"schedule": "0 9 * * *",
"walletAddress": "0x4B0897b0513fdc7C541B6d9D7E929C4e5364D2dB",
"createdAt": "2024-01-15T00:00:00Z",
"updatedAt": "2024-01-15T00:00:00Z",
"lastRun": "2024-01-15T09:00:00Z"
}
}
Update an existing task
task_123456
Updated Task Name
Updated task description
0 */6 * * *
running
Possible values: 0x4B0897b0513fdc7C541B6d9D7E929C4e5364D2dB
Task updated successfully
Missing required fields
Task not found or access denied
Internal server error
PUT /api/tasks HTTP/1.1
Host: app.trezalabs.com
Authorization: Bearer JWT
Content-Type: application/json
Accept: */*
Content-Length: 193
{
"id": "task_123456",
"name": "Updated Task Name",
"description": "Updated task description",
"schedule": "0 */6 * * *",
"status": "running",
"walletAddress": "0x4B0897b0513fdc7C541B6d9D7E929C4e5364D2dB"
}
{
"task": {
"id": "task_123456",
"name": "Daily Price Monitor",
"description": "Monitor cryptocurrency prices and send alerts",
"enclaveId": "enc_123456",
"status": "pending",
"schedule": "0 9 * * *",
"walletAddress": "0x4B0897b0513fdc7C541B6d9D7E929C4e5364D2dB",
"createdAt": "2024-01-15T00:00:00Z",
"updatedAt": "2024-01-15T00:00:00Z",
"lastRun": "2024-01-15T09:00:00Z"
}
}
Delete an existing task
Task ID to delete
task_123456
Wallet address for authorization
0x4B0897b0513fdc7C541B6d9D7E929C4e5364D2dB
Task deleted successfully
Missing required parameters
Task not found or access denied
Internal server error
DELETE /api/tasks HTTP/1.1
Host: app.trezalabs.com
Authorization: Bearer JWT
Accept: */*
{
"message": "Task deleted successfully"
}
Last updated