@elevasis/sdk 0.5.13 → 0.5.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -120,35 +120,9 @@ type MyInput = z.infer<typeof myInput>;
120
120
 
121
121
  ## Platform Tools Overview
122
122
 
123
- Platform tools are pre-built integrations the platform provides. You call them from inside workflow steps using `platform.call()` without managing API keys in your code.
123
+ Platform tools are pre-built integrations the platform provides. You call them from inside workflow steps using `platform.call()` or typed adapters without managing API keys in your code. The platform supports 70+ tools across 12 categories including CRM, email, payments, AI, storage, and more. Credentials are stored securely on the platform and injected at runtime -- they never appear in your code.
124
124
 
125
- ### Tool Categories
126
-
127
- | Category | Tools | Example Use |
128
- | ------------- | -------------------------- | -------------------------------------------------- |
129
- | Communication | Gmail, Resend, email | Send transactional emails, notifications |
130
- | CRM | Attio (11 methods) | Create leads, update records, search contacts |
131
- | Documents | PDF, Google Sheets, Notion | Generate invoices, read spreadsheets, update pages |
132
- | AI | LLM (GPT, Gemini, Claude) | Classify text, extract data, generate content |
133
- | Storage | Dropbox, platform storage | Upload files, create signed URLs |
134
- | Scheduling | Scheduler | Run workflows on a schedule or after a delay |
135
- | Approvals | Approval gates | Pause workflow until a human approves |
136
- | Verification | Mailso | Verify email addresses |
137
- | E-Signatures | SignatureAPI | Create and manage document envelopes |
138
- | Marketing | Instantly | Send email campaigns |
139
- | Payments | Stripe | Create payment links, checkout sessions |
140
- | Automation | Apify | Run web scraping actors |
141
-
142
- ### How Credentials Work
143
-
144
- 1. Create a credential in the Elevasis platform (API key, OAuth token, etc.) via the command center UI
145
- 2. Give it a name (e.g., `my-gmail`, `production-attio`)
146
- 3. In your code, pass that name: `platform.call({ credential: 'my-gmail', ... })`
147
- 4. The platform injects the actual API key at runtime -- it never appears in your code
148
-
149
- ### What Happens When a Credential Name is Wrong
150
-
151
- You will see a `PlatformToolError` with the message "credential not found". Check for typos -- credential names are case-sensitive.
125
+ See [Platform Tools](platform-tools/index.mdx) for the complete catalog, credential setup, and code examples.
152
126
 
153
127
  ---
154
128
 
@@ -156,7 +130,7 @@ You will see a `PlatformToolError` with the message "credential not found". Chec
156
130
 
157
131
  | Error | How to Fix |
158
132
  | ----------------------------------------- | ------------------------------------------------------------------------------- |
159
- | `ELEVASIS_API_KEY not set` | Add `ELEVASIS_API_KEY=sk_...` to `.env` |
133
+ | `ELEVASIS_PLATFORM_KEY not set` | Add `ELEVASIS_PLATFORM_KEY=sk_...` to `.env` |
160
134
  | `Schema validation failed` | Compare error field names to your schema. Check types and required vs optional. |
161
135
  | `Cannot find module '@elevasis/sdk'` | Run `pnpm install` |
162
136
  | `PlatformToolError: credential not found` | Check spelling and case in the command center UI |
@@ -177,26 +151,13 @@ Use a single step when the workflow does one thing -- validate an email, format
177
151
 
178
152
  Use multiple steps when you have distinct phases (fetch data, process it, send a notification) or when you want separate error handling per phase. Each step failure is logged independently, making it easier to identify where something went wrong.
179
153
 
180
- ### dev vs production Status
181
-
182
- - **dev** -- Resource is visible in the dashboard and can be triggered manually, but will not auto-trigger from schedules or webhooks. Use while building and testing.
183
- - **production** -- Resource is fully live. All trigger sources work. Use when you are confident it works correctly.
184
-
185
- You can switch between them by changing `status` in the workflow config and redeploying.
186
-
187
154
  ### When to Use Conditional Routing
188
155
 
189
156
  Use `StepType.CONDITIONAL` when different inputs should follow different processing paths.
190
157
 
191
158
  Example: score >= 80 goes to the approve path, score >= 50 goes to the review path, everything else goes to the reject path. Each path can have its own steps and logic.
192
159
 
193
- Always include a `defaultTarget` fallback for inputs that do not match any condition. Without a fallback, an unmatched execution will fail.
194
-
195
- ### When to Use Platform Tools vs Custom Code
196
-
197
- Use platform tools when the integration exists in the tool catalog -- they handle auth, retries, and error normalization for you.
198
-
199
- Write custom code (e.g., using `fetch` directly) only when you need a service or API method that is not in the catalog, or when you need fine-grained control over the HTTP request.
160
+ Always include a `default` fallback step for inputs that do not match any condition. Without a fallback, an unmatched execution will fail.
200
161
 
201
162
  ---
202
163
 
@@ -1,297 +1,297 @@
1
- ---
2
- title: Execution API
3
- description: REST endpoints for executing resources, querying execution history, and managing deployments via the Elevasis external API
4
- loadWhen: "Calling the API directly or debugging API responses"
5
- ---
6
-
7
- The Elevasis external API exposes REST endpoints under `/api/external/` for executing your deployed resources and inspecting results. All endpoints require your `ELEVASIS_API_KEY` sent as a Bearer token. Organization is resolved server-side from the API key -- you never pass an org identifier in requests.
8
-
9
- **Authentication header:**
10
-
11
- ```
12
- Authorization: Bearer sk_...
13
- ```
14
-
15
- ---
16
-
17
- ## API Base URL
18
-
19
- | Environment | Base URL |
20
- | ----------- | -------- |
21
- | Production | `https://api.elevasis.io` |
22
- | Development | `http://localhost:<port>` |
23
-
24
- Override the base URL by setting `ELEVASIS_API_URL` in your environment or passing `--api-url` to any CLI command.
25
-
26
- ---
27
-
28
- ## Endpoints
29
-
30
- | Method | Path | Purpose |
31
- | ------ | ---- | ------- |
32
- | `GET` | `/api/external/resources` | List all resources for your organization |
33
- | `GET` | `/api/external/resources/:resourceId/definition` | Get resource metadata and schemas |
34
- | `POST` | `/api/external/execute` | Execute a resource synchronously |
35
- | `POST` | `/api/external/execute-async` | Execute a resource asynchronously |
36
- | `POST` | `/api/external/executions/:resourceId/:executionId/cancel` | Cancel a running execution |
37
- | `GET` | `/api/external/executions/:resourceId` | List execution history for a resource |
38
- | `GET` | `/api/external/executions/:resourceId/:executionId` | Get full execution detail |
39
- | `POST` | `/api/external/deploy` | Upload bundle and deploy resources |
40
- | `GET` | `/api/external/deployments` | List all deployments |
41
- | `GET` | `/api/external/deployments/:id` | Get a deployment by ID |
42
-
43
- ---
44
-
45
- ## Execution Endpoints
46
-
47
- ### POST /api/external/execute
48
-
49
- Execute a resource synchronously. The request waits for the resource to complete and returns the full result.
50
-
51
- **Request body:**
52
-
53
- ```json
54
- {
55
- "resourceId": "onboard-client",
56
- "input": {
57
- "clientName": "Jane",
58
- "email": "jane@example.com"
59
- }
60
- }
61
- ```
62
-
63
- **Response:**
64
-
65
- ```json
66
- {
67
- "executionId": "550e8400-e29b-41d4-a716-446655440000",
68
- "success": true,
69
- "data": {
70
- "success": true,
71
- "clientId": "client_1708521600000",
72
- "welcomeEmailSent": true
73
- }
74
- }
75
- ```
76
-
77
- ### POST /api/external/execute-async
78
-
79
- Execute a resource asynchronously. Returns immediately with an `executionId`. Poll `GET /executions/:resourceId/:executionId` to check status and retrieve output.
80
-
81
- **Request body:**
82
-
83
- ```json
84
- {
85
- "resourceId": "onboard-client",
86
- "input": { "clientName": "Jane" }
87
- }
88
- ```
89
-
90
- **Response:**
91
-
92
- ```json
93
- {
94
- "executionId": "550e8400-e29b-41d4-a716-446655440000",
95
- "status": "running"
96
- }
97
- ```
98
-
99
- ### POST /api/external/executions/:resourceId/:executionId/cancel
100
-
101
- Cancel a running execution. If the execution is found in memory, sends a cancellation signal immediately. Falls back to a database status update if no in-memory signal is found.
102
-
103
- **Response:**
104
-
105
- ```json
106
- {
107
- "success": true
108
- }
109
- ```
110
-
111
- ---
112
-
113
- ## Resource Endpoints
114
-
115
- ### GET /api/external/resources
116
-
117
- List all resources registered to your organization. In production, only `status: 'prod'` resources are returned.
118
-
119
- **Response:**
120
-
121
- ```json
122
- [
123
- {
124
- "resourceId": "onboard-client",
125
- "resourceType": "workflow",
126
- "name": "Onboard Client",
127
- "status": "prod"
128
- },
129
- {
130
- "resourceId": "email-assistant",
131
- "resourceType": "agent",
132
- "name": "Email Assistant",
133
- "status": "prod"
134
- }
135
- ]
136
- ```
137
-
138
- ### GET /api/external/resources/:resourceId/definition
139
-
140
- Get the full definition for a single resource: metadata, input schema, and output schema.
141
-
142
- **Response:**
143
-
144
- ```json
145
- {
146
- "resourceId": "onboard-client",
147
- "resourceType": "workflow",
148
- "name": "Onboard Client",
149
- "description": "Creates a client record and sends a welcome email",
150
- "status": "prod",
151
- "inputSchema": {
152
- "type": "object",
153
- "properties": {
154
- "clientName": { "type": "string" },
155
- "email": { "type": "string", "format": "email" }
156
- },
157
- "required": ["clientName", "email"]
158
- },
159
- "outputSchema": {
160
- "type": "object",
161
- "properties": {
162
- "success": { "type": "boolean" },
163
- "clientId": { "type": "string" }
164
- }
165
- }
166
- }
167
- ```
168
-
169
- Returns `404` if the resource is not found.
170
-
171
- ---
172
-
173
- ## Execution History Endpoints
174
-
175
- ### GET /api/external/executions/:resourceId
176
-
177
- List execution history for a resource.
178
-
179
- **Query parameters:**
180
-
181
- | Parameter | Description |
182
- | --------- | ----------- |
183
- | `limit` | Maximum number of results (default: 20) |
184
- | `status` | Filter by status: `running`, `completed`, `failed`, `cancelled` |
185
-
186
- **Response:**
187
-
188
- ```json
189
- [
190
- {
191
- "executionId": "550e8400-e29b-41d4-a716-446655440000",
192
- "resourceId": "onboard-client",
193
- "status": "completed",
194
- "createdAt": "2026-02-25T14:32:01Z",
195
- "durationMs": 1234
196
- }
197
- ]
198
- ```
199
-
200
- ### GET /api/external/executions/:resourceId/:executionId
201
-
202
- Get the full detail for a single execution including input, output, logs, and error.
203
-
204
- **Response:**
205
-
206
- ```json
207
- {
208
- "executionId": "550e8400-e29b-41d4-a716-446655440000",
209
- "resourceId": "onboard-client",
210
- "status": "completed",
211
- "createdAt": "2026-02-25T14:32:01Z",
212
- "durationMs": 1234,
213
- "input": {
214
- "clientName": "Jane",
215
- "email": "jane@example.com"
216
- },
217
- "output": {
218
- "success": true,
219
- "clientId": "client_1708521600000",
220
- "welcomeEmailSent": true
221
- },
222
- "logs": [
223
- { "timestamp": "2026-02-25T14:32:01.123Z", "message": "Starting onboard-client workflow" },
224
- { "timestamp": "2026-02-25T14:32:01.456Z", "message": "Created client record" }
225
- ],
226
- "error": null
227
- }
228
- ```
229
-
230
- ---
231
-
232
- ## Deployment Endpoints
233
-
234
- ### POST /api/external/deploy
235
-
236
- Upload a resource bundle and deploy it. Accepts a multipart request with the compiled bundle and resource metadata.
237
-
238
- **Response:**
239
-
240
- ```json
241
- {
242
- "deployId": "deploy_abc123",
243
- "status": "active",
244
- "resources": 4
245
- }
246
- ```
247
-
248
- Use `elevasis-sdk deploy` from the CLI rather than calling this endpoint directly -- the CLI handles bundling, metadata generation, and status streaming automatically.
249
-
250
- ### GET /api/external/deployments
251
-
252
- List all deployments for your organization.
253
-
254
- **Response:**
255
-
256
- ```json
257
- [
258
- {
259
- "id": "deploy_abc123",
260
- "status": "active",
261
- "createdAt": "2026-02-25T14:00:00Z",
262
- "resources": 4
263
- },
264
- {
265
- "id": "deploy_abc122",
266
- "status": "stopped",
267
- "createdAt": "2026-02-24T09:30:00Z",
268
- "resources": 3
269
- }
270
- ]
271
- ```
272
-
273
- ### GET /api/external/deployments/:id
274
-
275
- Get a single deployment by ID.
276
-
277
- **Response shape:** Same as a single item from `GET /deployments`.
278
-
279
- ---
280
-
281
- ## CLI Execution Commands
282
-
283
- The SDK CLI wraps all execution endpoints. Use these commands instead of calling the API directly during development:
284
-
285
- | Command | API call | Purpose |
286
- | ------- | -------- | ------- |
287
- | `elevasis-sdk resources` | `GET /api/external/resources` | List all resources |
288
- | `elevasis-sdk describe <resource>` | `GET /api/external/resources/:id/definition` | Show resource definition |
289
- | `elevasis-sdk exec <resource> --input '...'` | `POST /api/external/execute` | Execute synchronously |
290
- | `elevasis-sdk exec <resource> --input '...' --async` | `POST /api/external/execute-async` | Execute asynchronously |
291
- | `elevasis-sdk executions <resource>` | `GET /api/external/executions/:id` | List execution history |
292
- | `elevasis-sdk execution <resource> <id>` | `GET /api/external/executions/:id/:execId` | Get execution detail |
293
- | `elevasis-sdk deployments` | `GET /api/external/deployments` | List deployments |
294
-
295
- ---
296
-
297
- **Last Updated:** 2026-02-25
1
+ ---
2
+ title: Execution API
3
+ description: REST endpoints for executing resources, querying execution history, and managing deployments via the Elevasis external API
4
+ loadWhen: "Calling the API directly or debugging API responses"
5
+ ---
6
+
7
+ The Elevasis external API exposes REST endpoints under `/api/external/` for executing your deployed resources and inspecting results. All endpoints require your `ELEVASIS_PLATFORM_KEY` sent as a Bearer token. Organization is resolved server-side from the API key -- you never pass an org identifier in requests.
8
+
9
+ **Authentication header:**
10
+
11
+ ```
12
+ Authorization: Bearer sk_...
13
+ ```
14
+
15
+ ---
16
+
17
+ ## API Base URL
18
+
19
+ | Environment | Base URL |
20
+ | ----------- | --------------------------- |
21
+ | Production | `https://api.elevasis.io` |
22
+ | Development | `http://localhost:<port>` |
23
+
24
+ Override the base URL by setting `ELEVASIS_API_URL` in your environment or passing `--api-url` to any CLI command.
25
+
26
+ ---
27
+
28
+ ## Endpoints
29
+
30
+ | Method | Path | Purpose |
31
+ | ------ | ---------------------------------------------------------- | ---------------------------------------- |
32
+ | `GET` | `/api/external/resources` | List all resources for your organization |
33
+ | `GET` | `/api/external/resources/:resourceId/definition` | Get resource metadata and schemas |
34
+ | `POST` | `/api/external/execute` | Execute a resource synchronously |
35
+ | `POST` | `/api/external/execute-async` | Execute a resource asynchronously |
36
+ | `POST` | `/api/external/executions/:resourceId/:executionId/cancel` | Cancel a running execution |
37
+ | `GET` | `/api/external/executions/:resourceId` | List execution history for a resource |
38
+ | `GET` | `/api/external/executions/:resourceId/:executionId` | Get full execution detail |
39
+ | `POST` | `/api/external/deploy` | Upload bundle and deploy resources |
40
+ | `GET` | `/api/external/deployments` | List all deployments |
41
+ | `GET` | `/api/external/deployments/:id` | Get a deployment by ID |
42
+
43
+ ---
44
+
45
+ ## Execution Endpoints
46
+
47
+ ### POST /api/external/execute
48
+
49
+ Execute a resource synchronously. The request waits for the resource to complete and returns the full result.
50
+
51
+ **Request body:**
52
+
53
+ ```json
54
+ {
55
+ "resourceId": "onboard-client",
56
+ "input": {
57
+ "clientName": "Jane",
58
+ "email": "jane@example.com"
59
+ }
60
+ }
61
+ ```
62
+
63
+ **Response:**
64
+
65
+ ```json
66
+ {
67
+ "executionId": "550e8400-e29b-41d4-a716-446655440000",
68
+ "success": true,
69
+ "data": {
70
+ "success": true,
71
+ "clientId": "client_1708521600000",
72
+ "welcomeEmailSent": true
73
+ }
74
+ }
75
+ ```
76
+
77
+ ### POST /api/external/execute-async
78
+
79
+ Execute a resource asynchronously. Returns immediately with an `executionId`. Poll `GET /executions/:resourceId/:executionId` to check status and retrieve output.
80
+
81
+ **Request body:**
82
+
83
+ ```json
84
+ {
85
+ "resourceId": "onboard-client",
86
+ "input": { "clientName": "Jane" }
87
+ }
88
+ ```
89
+
90
+ **Response:**
91
+
92
+ ```json
93
+ {
94
+ "executionId": "550e8400-e29b-41d4-a716-446655440000",
95
+ "status": "running"
96
+ }
97
+ ```
98
+
99
+ ### POST /api/external/executions/:resourceId/:executionId/cancel
100
+
101
+ Cancel a running execution. If the execution is found in memory, sends a cancellation signal immediately. Falls back to a database status update if no in-memory signal is found.
102
+
103
+ **Response:**
104
+
105
+ ```json
106
+ {
107
+ "success": true
108
+ }
109
+ ```
110
+
111
+ ---
112
+
113
+ ## Resource Endpoints
114
+
115
+ ### GET /api/external/resources
116
+
117
+ List all resources registered to your organization. In production, only `status: 'prod'` resources are returned.
118
+
119
+ **Response:**
120
+
121
+ ```json
122
+ [
123
+ {
124
+ "resourceId": "onboard-client",
125
+ "resourceType": "workflow",
126
+ "name": "Onboard Client",
127
+ "status": "prod"
128
+ },
129
+ {
130
+ "resourceId": "email-assistant",
131
+ "resourceType": "agent",
132
+ "name": "Email Assistant",
133
+ "status": "prod"
134
+ }
135
+ ]
136
+ ```
137
+
138
+ ### GET /api/external/resources/:resourceId/definition
139
+
140
+ Get the full definition for a single resource: metadata, input schema, and output schema.
141
+
142
+ **Response:**
143
+
144
+ ```json
145
+ {
146
+ "resourceId": "onboard-client",
147
+ "resourceType": "workflow",
148
+ "name": "Onboard Client",
149
+ "description": "Creates a client record and sends a welcome email",
150
+ "status": "prod",
151
+ "inputSchema": {
152
+ "type": "object",
153
+ "properties": {
154
+ "clientName": { "type": "string" },
155
+ "email": { "type": "string", "format": "email" }
156
+ },
157
+ "required": ["clientName", "email"]
158
+ },
159
+ "outputSchema": {
160
+ "type": "object",
161
+ "properties": {
162
+ "success": { "type": "boolean" },
163
+ "clientId": { "type": "string" }
164
+ }
165
+ }
166
+ }
167
+ ```
168
+
169
+ Returns `404` if the resource is not found.
170
+
171
+ ---
172
+
173
+ ## Execution History Endpoints
174
+
175
+ ### GET /api/external/executions/:resourceId
176
+
177
+ List execution history for a resource.
178
+
179
+ **Query parameters:**
180
+
181
+ | Parameter | Description |
182
+ | --------- | --------------------------------------------------------------- |
183
+ | `limit` | Maximum number of results (default: 20) |
184
+ | `status` | Filter by status: `running`, `completed`, `failed`, `cancelled` |
185
+
186
+ **Response:**
187
+
188
+ ```json
189
+ [
190
+ {
191
+ "executionId": "550e8400-e29b-41d4-a716-446655440000",
192
+ "resourceId": "onboard-client",
193
+ "status": "completed",
194
+ "createdAt": "2026-02-25T14:32:01Z",
195
+ "durationMs": 1234
196
+ }
197
+ ]
198
+ ```
199
+
200
+ ### GET /api/external/executions/:resourceId/:executionId
201
+
202
+ Get the full detail for a single execution including input, output, logs, and error.
203
+
204
+ **Response:**
205
+
206
+ ```json
207
+ {
208
+ "executionId": "550e8400-e29b-41d4-a716-446655440000",
209
+ "resourceId": "onboard-client",
210
+ "status": "completed",
211
+ "createdAt": "2026-02-25T14:32:01Z",
212
+ "durationMs": 1234,
213
+ "input": {
214
+ "clientName": "Jane",
215
+ "email": "jane@example.com"
216
+ },
217
+ "output": {
218
+ "success": true,
219
+ "clientId": "client_1708521600000",
220
+ "welcomeEmailSent": true
221
+ },
222
+ "logs": [
223
+ { "timestamp": "2026-02-25T14:32:01.123Z", "message": "Starting onboard-client workflow" },
224
+ { "timestamp": "2026-02-25T14:32:01.456Z", "message": "Created client record" }
225
+ ],
226
+ "error": null
227
+ }
228
+ ```
229
+
230
+ ---
231
+
232
+ ## Deployment Endpoints
233
+
234
+ ### POST /api/external/deploy
235
+
236
+ Upload a resource bundle and deploy it. Accepts a multipart request with the compiled bundle and resource metadata.
237
+
238
+ **Response:**
239
+
240
+ ```json
241
+ {
242
+ "deployId": "deploy_abc123",
243
+ "status": "active",
244
+ "resources": 4
245
+ }
246
+ ```
247
+
248
+ Use `elevasis-sdk deploy` from the CLI rather than calling this endpoint directly -- the CLI handles bundling, metadata generation, and status streaming automatically.
249
+
250
+ ### GET /api/external/deployments
251
+
252
+ List all deployments for your organization.
253
+
254
+ **Response:**
255
+
256
+ ```json
257
+ [
258
+ {
259
+ "id": "deploy_abc123",
260
+ "status": "active",
261
+ "createdAt": "2026-02-25T14:00:00Z",
262
+ "resources": 4
263
+ },
264
+ {
265
+ "id": "deploy_abc122",
266
+ "status": "stopped",
267
+ "createdAt": "2026-02-24T09:30:00Z",
268
+ "resources": 3
269
+ }
270
+ ]
271
+ ```
272
+
273
+ ### GET /api/external/deployments/:id
274
+
275
+ Get a single deployment by ID.
276
+
277
+ **Response shape:** Same as a single item from `GET /deployments`.
278
+
279
+ ---
280
+
281
+ ## CLI Execution Commands
282
+
283
+ The SDK CLI wraps all execution endpoints. Use these commands instead of calling the API directly during development:
284
+
285
+ | Command | API call | Purpose |
286
+ | ------------------------------------------------------ | -------------------------------------------- | ------------------------ |
287
+ | `elevasis-sdk resources` | `GET /api/external/resources` | List all resources |
288
+ | `elevasis-sdk describe <resource>` | `GET /api/external/resources/:id/definition` | Show resource definition |
289
+ | `elevasis-sdk exec <resource> --input '...'` | `POST /api/external/execute` | Execute synchronously |
290
+ | `elevasis-sdk exec <resource> --input '...' --async` | `POST /api/external/execute-async` | Execute asynchronously |
291
+ | `elevasis-sdk executions <resource>` | `GET /api/external/executions/:id` | List execution history |
292
+ | `elevasis-sdk execution <resource> <id>` | `GET /api/external/executions/:id/:execId` | Get execution detail |
293
+ | `elevasis-sdk deployments` | `GET /api/external/deployments` | List deployments |
294
+
295
+ ---
296
+
297
+ **Last Updated:** 2026-02-25