Rest API

Get user enclaves

get

Retrieve all enclaves associated with a wallet address

Authorizations
Query parameters
walletstringRequired

Wallet address to filter enclaves

Example: [email protected]
Responses
200
List of enclaves
application/json
get
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 new enclave

post

Create a new secure enclave

Authorizations
Body
namestringRequiredExample: Trading Bot Enclave
descriptionstringRequiredExample: Secure environment for automated trading strategies
regionstringRequiredExample: us-east-1
walletAddressstringRequiredExample: [email protected]
providerIdstringRequiredExample: aws-nitro
providerConfigobjectOptionalExample: {"dockerImage":"my-app:latest","cpuCount":2,"memoryMiB":512}
Responses
201
Enclave created successfully
application/json
post
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 enclave

put

Update an existing enclave

Authorizations
Body
idstringRequiredExample: enc_123456
namestringOptionalExample: Updated Enclave Name
descriptionstringOptionalExample: Updated description
regionstringOptionalExample: us-west-2
walletAddressstringRequiredExample: [email protected]
providerIdstringOptionalExample: aws-nitro
providerConfigobjectOptionalExample: {"dockerImage":"my-app:v2","cpuCount":4,"memoryMiB":1024}
Responses
200
Enclave updated successfully
application/json
put
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 enclave

delete

Delete an existing enclave

Authorizations
Query parameters
idstringRequired

Enclave ID to delete

Example: enc_123456
walletstringRequired

Wallet address for authorization

Example: [email protected]
Responses
200
Enclave deleted successfully
application/json
delete
DELETE /api/enclaves HTTP/1.1
Host: app.treza.xyz
Authorization: Bearer JWT
Accept: */*
{
  "message": "Enclave deleted successfully"
}

Get available providers

get

Retrieve all available enclave providers or a specific provider by ID

Authorizations
Query parameters
idstringOptional

Specific provider ID to retrieve

Example: aws-nitro
Responses
200
Provider(s) retrieved successfully
application/json
Responseone of
or
get
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
          }
        }
      }
    }
  ]
}

Initiate GitHub OAuth flow

get

Get GitHub OAuth authorization URL

Authorizations
Query parameters
statestringOptional

Optional state parameter for OAuth flow

Responses
200
GitHub OAuth URL generated
application/json
get
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 OAuth code for access token

post

Exchange GitHub OAuth authorization code for access token

Authorizations
Body
codestringRequired

OAuth authorization code from GitHub

Example: abcdef123456
statestringOptional

State parameter from OAuth flow

Example: abc123
Responses
200
Access token obtained successfully
application/json
post
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"
  }
}

GitHub OAuth callback

get

Handle GitHub OAuth callback and redirect to platform

Authorizations
Query parameters
codestringOptional

OAuth authorization code

statestringOptional

OAuth state parameter

errorstringOptional

OAuth error if any

Responses
302
Redirect to platform page with success or error parameters
get
GET /api/github/callback HTTP/1.1
Host: app.treza.xyz
Authorization: Bearer JWT
Accept: */*
302

Redirect to platform page with success or error parameters

No content

Get user repositories

get

Fetch GitHub repositories for authenticated user

Authorizations
Query parameters
tokenstringRequired

GitHub access token

Example: gho_xxxxxxxxxxxxxxxxxxxx
Responses
200
List of repositories
application/json
get
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"
    }
  ]
}

Get repository branches

post

Fetch branches for a specific repository

Authorizations
Body
accessTokenstringRequiredExample: gho_xxxxxxxxxxxxxxxxxxxx
repositorystringRequiredExample: username/repo-name
Responses
200
List of branches
application/json
post
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"
      }
    }
  ]
}

Get API keys

get

Retrieve all API keys for the authenticated user

Authorizations
Query parameters
walletstringRequired

Wallet address to filter API keys

Example: [email protected]
Responses
200
List of API keys
application/json
get
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 API key

post

Create a new API key with specified permissions

Authorizations
Body
namestringRequiredExample: Production API Key
walletAddressstringRequiredExample: [email protected]
Responses
201
API key created successfully
application/json
post
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 API key

put

Update an existing API key

Authorizations
Body
idstringRequiredExample: key_123456
namestringOptionalExample: Updated API Key Name
statusstring · enumOptionalExample: activePossible values:
walletAddressstringRequiredExample: [email protected]
Responses
200
API key updated successfully
application/json
put
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 API key

delete

Delete an existing API key

Authorizations
Query parameters
idstringRequired

API key ID to delete

Example: key_123456
walletstringRequired

Wallet address for authorization

Example: [email protected]
Responses
200
API key deleted successfully
application/json
delete
DELETE /api/api-keys HTTP/1.1
Host: app.treza.xyz
Authorization: Bearer JWT
Accept: */*
{
  "message": "API key deleted successfully"
}

Get tasks

get

Retrieve tasks for the authenticated user, optionally filtered by enclave

Authorizations
Query parameters
walletstringRequired

Wallet address to filter tasks

Example: [email protected]
enclavestringOptional

Optional enclave ID to filter tasks

Example: enc_123456
Responses
200
List of tasks
application/json
get
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 task

post

Create a new task within an enclave

Authorizations
Body
namestringRequiredExample: Daily Price Monitor
descriptionstringRequiredExample: Monitor cryptocurrency prices and send alerts
enclaveIdstringRequiredExample: enc_123456
schedulestringRequired

Cron-style schedule expression

Example: 0 9 * * *
walletAddressstringRequiredExample: [email protected]
Responses
201
Task created successfully
application/json
post
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 task

put

Update an existing task

Authorizations
Body
idstringRequiredExample: task_123456
namestringOptionalExample: Updated Task Name
descriptionstringOptionalExample: Updated task description
schedulestringOptionalExample: 0 */6 * * *
statusstring · enumOptionalExample: runningPossible values:
walletAddressstringRequiredExample: [email protected]
Responses
200
Task updated successfully
application/json
put
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 task

delete

Delete an existing task

Authorizations
Query parameters
idstringRequired

Task ID to delete

Example: task_123456
walletstringRequired

Wallet address for authorization

Example: [email protected]
Responses
200
Task deleted successfully
application/json
delete
DELETE /api/tasks HTTP/1.1
Host: app.treza.xyz
Authorization: Bearer JWT
Accept: */*
{
  "message": "Task deleted successfully"
}

Last updated