Rest API
Retrieve all enclaves associated with a wallet address
GET /api/enclaves HTTP/1.1
Host: app.treza.xyz
Authorization: Bearer JWT
Accept: */*
{
"enclaves": [
{
"id": "enc_123456",
"name": "Trading Bot Enclave",
"description": "Secure environment for automated trading strategies",
"status": "pending",
"region": "us-east-1",
"walletAddress": "[email protected]",
"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"
}
}
]
}
Create a new secure enclave
Trading Bot Enclave
Secure environment for automated trading strategies
us-east-1
[email protected]
aws-nitro
{"dockerImage":"my-app:latest","cpuCount":2,"memoryMiB":512}
POST /api/enclaves HTTP/1.1
Host: app.treza.xyz
Authorization: Bearer JWT
Content-Type: application/json
Accept: */*
Content-Length: 434
{
"name": "Trading Bot Enclave",
"description": "Secure environment for automated trading strategies",
"region": "us-east-1",
"walletAddress": "[email protected]",
"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",
"region": "us-east-1",
"walletAddress": "[email protected]",
"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"
}
}
}
Update an existing enclave
enc_123456
Updated Enclave Name
Updated description
us-west-2
[email protected]
aws-nitro
{"dockerImage":"my-app:v2","cpuCount":4,"memoryMiB":1024}
PUT /api/enclaves HTTP/1.1
Host: app.treza.xyz
Authorization: Bearer JWT
Content-Type: application/json
Accept: */*
Content-Length: 418
{
"id": "enc_123456",
"name": "Updated Enclave Name",
"description": "Updated description",
"region": "us-west-2",
"walletAddress": "[email protected]",
"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",
"region": "us-east-1",
"walletAddress": "[email protected]",
"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"
}
}
}
Delete an existing enclave
Enclave ID to delete
enc_123456
DELETE /api/enclaves HTTP/1.1
Host: app.treza.xyz
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
GET /api/providers HTTP/1.1
Host: app.treza.xyz
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
GET /api/github/auth HTTP/1.1
Host: app.treza.xyz
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
POST /api/github/auth HTTP/1.1
Host: app.treza.xyz
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
GET /api/github/callback HTTP/1.1
Host: app.treza.xyz
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
GET /api/github/repositories HTTP/1.1
Host: app.treza.xyz
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
POST /api/github/repositories HTTP/1.1
Host: app.treza.xyz
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
GET /api/api-keys HTTP/1.1
Host: app.treza.xyz
Authorization: Bearer JWT
Accept: */*
{
"apiKeys": [
{
"id": "key_123456",
"name": "Production API Key",
"key": "sk_live_1234567890abcdef1234567890abcdef",
"keyHash": "sha256_hash_of_key",
"permissions": [
"enclaves:read",
"tasks:read"
],
"status": "active",
"walletAddress": "[email protected]",
"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
POST /api/api-keys HTTP/1.1
Host: app.treza.xyz
Authorization: Bearer JWT
Content-Type: application/json
Accept: */*
Content-Length: 113
{
"name": "Production API Key",
"permissions": [
"enclaves:read",
"tasks:read"
],
"walletAddress": "[email protected]"
}
{
"apiKey": {
"id": "key_123456",
"name": "Production API Key",
"key": "sk_live_1234567890abcdef1234567890abcdef",
"keyHash": "sha256_hash_of_key",
"permissions": [
"enclaves:read",
"tasks:read"
],
"status": "active",
"walletAddress": "[email protected]",
"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: [email protected]
PUT /api/api-keys HTTP/1.1
Host: app.treza.xyz
Authorization: Bearer JWT
Content-Type: application/json
Accept: */*
Content-Length: 155
{
"id": "key_123456",
"name": "Updated API Key Name",
"permissions": [
"enclaves:read",
"enclaves:write"
],
"status": "active",
"walletAddress": "[email protected]"
}
{
"apiKey": {
"id": "key_123456",
"name": "Production API Key",
"key": "sk_live_1234567890abcdef1234567890abcdef",
"keyHash": "sha256_hash_of_key",
"permissions": [
"enclaves:read",
"tasks:read"
],
"status": "active",
"walletAddress": "[email protected]",
"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
DELETE /api/api-keys HTTP/1.1
Host: app.treza.xyz
Authorization: Bearer JWT
Accept: */*
{
"message": "API key deleted successfully"
}
Retrieve tasks for the authenticated user, optionally filtered by enclave
Optional enclave ID to filter tasks
enc_123456
GET /api/tasks HTTP/1.1
Host: app.treza.xyz
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": "[email protected]",
"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 * * *
[email protected]
POST /api/tasks HTTP/1.1
Host: app.treza.xyz
Authorization: Bearer JWT
Content-Type: application/json
Accept: */*
Content-Length: 179
{
"name": "Daily Price Monitor",
"description": "Monitor cryptocurrency prices and send alerts",
"enclaveId": "enc_123456",
"schedule": "0 9 * * *",
"walletAddress": "[email protected]"
}
{
"task": {
"id": "task_123456",
"name": "Daily Price Monitor",
"description": "Monitor cryptocurrency prices and send alerts",
"enclaveId": "enc_123456",
"status": "pending",
"schedule": "0 9 * * *",
"walletAddress": "[email protected]",
"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: [email protected]
PUT /api/tasks HTTP/1.1
Host: app.treza.xyz
Authorization: Bearer JWT
Content-Type: application/json
Accept: */*
Content-Length: 171
{
"id": "task_123456",
"name": "Updated Task Name",
"description": "Updated task description",
"schedule": "0 */6 * * *",
"status": "running",
"walletAddress": "[email protected]"
}
{
"task": {
"id": "task_123456",
"name": "Daily Price Monitor",
"description": "Monitor cryptocurrency prices and send alerts",
"enclaveId": "enc_123456",
"status": "pending",
"schedule": "0 9 * * *",
"walletAddress": "[email protected]",
"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
DELETE /api/tasks HTTP/1.1
Host: app.treza.xyz
Authorization: Bearer JWT
Accept: */*
{
"message": "Task deleted successfully"
}
Last updated