Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/docs/content/docs/de/execution/api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Alle API-Anfragen erfordern einen API-Schlüssel, der im Header `x-api-key` übe

```bash
curl -H "x-api-key: YOUR_API_KEY" \
https://sim.ai/api/v1/logs?workspaceId=YOUR_WORKSPACE_ID
https://api.sim.ai/api/v1/logs?workspaceId=YOUR_WORKSPACE_ID
```

Sie können API-Schlüssel in Ihren Benutzereinstellungen im Sim-Dashboard generieren.
Expand Down Expand Up @@ -528,7 +528,7 @@ async function pollLogs() {
}

const response = await fetch(
`https://sim.ai/api/v1/logs?${params}`,
`https://api.sim.ai/api/v1/logs?${params}`,
{
headers: {
'x-api-key': 'YOUR_API_KEY'
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/docs/de/execution/costs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ GET /api/users/me/usage-limits
**Beispielanfrage:**

```bash
curl -X GET -H "X-API-Key: YOUR_API_KEY" -H "Content-Type: application/json" https://sim.ai/api/users/me/usage-limits
curl -X GET -H "X-API-Key: YOUR_API_KEY" -H "Content-Type: application/json" https://api.sim.ai/api/users/me/usage-limits
```

**Beispielantwort:**
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/docs/de/sdks/python.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ def stream_workflow():

def generate():
response = requests.post(
'https://sim.ai/api/workflows/WORKFLOW_ID/execute',
'https://api.sim.ai/api/workflows/WORKFLOW_ID/execute',
headers={
'Content-Type': 'application/json',
'X-API-Key': os.getenv('SIM_API_KEY')
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/docs/de/sdks/typescript.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -965,7 +965,7 @@ function StreamingWorkflow() {

// IMPORTANT: Make this API call from your backend server, not the browser
// Never expose your API key in client-side code
const response = await fetch('https://sim.ai/api/workflows/WORKFLOW_ID/execute', {
const response = await fetch('https://api.sim.ai/api/workflows/WORKFLOW_ID/execute', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Expand Down
4 changes: 2 additions & 2 deletions apps/docs/content/docs/en/execution/api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ All API requests require an API key passed in the `x-api-key` header:

```bash
curl -H "x-api-key: YOUR_API_KEY" \
https://sim.ai/api/v1/logs?workspaceId=YOUR_WORKSPACE_ID
https://api.sim.ai/api/v1/logs?workspaceId=YOUR_WORKSPACE_ID
```

You can generate API keys from your user settings in the Sim dashboard.
Expand Down Expand Up @@ -513,7 +513,7 @@ async function pollLogs() {
}

const response = await fetch(
`https://sim.ai/api/v1/logs?${params}`,
`https://api.sim.ai/api/v1/logs?${params}`,
{
headers: {
'x-api-key': 'YOUR_API_KEY'
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/docs/en/execution/costs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ GET /api/users/me/usage-limits

**Example Request:**
```bash
curl -X GET -H "X-API-Key: YOUR_API_KEY" -H "Content-Type: application/json" https://sim.ai/api/users/me/usage-limits
curl -X GET -H "X-API-Key: YOUR_API_KEY" -H "Content-Type: application/json" https://api.sim.ai/api/users/me/usage-limits
```

**Example Response:**
Expand Down
8 changes: 4 additions & 4 deletions apps/docs/content/docs/en/execution/form.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Submit forms programmatically:
<Tabs items={['cURL', 'TypeScript']}>
<Tab value="cURL">
```bash
curl -X POST https://sim.ai/api/form/your-identifier \
curl -X POST https://api.sim.ai/api/form/your-identifier \
-H "Content-Type: application/json" \
-d '{
"formData": {
Expand All @@ -94,7 +94,7 @@ curl -X POST https://sim.ai/api/form/your-identifier \
</Tab>
<Tab value="TypeScript">
```typescript
const response = await fetch('https://sim.ai/api/form/your-identifier', {
const response = await fetch('https://api.sim.ai/api/form/your-identifier', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
Expand All @@ -115,14 +115,14 @@ const result = await response.json();

For password-protected forms:
```bash
curl -X POST https://sim.ai/api/form/your-identifier \
curl -X POST https://api.sim.ai/api/form/your-identifier \
-H "Content-Type: application/json" \
-d '{ "password": "secret", "formData": { "name": "John" } }'
```

For email-protected forms:
```bash
curl -X POST https://sim.ai/api/form/your-identifier \
curl -X POST https://api.sim.ai/api/form/your-identifier \
-H "Content-Type: application/json" \
-d '{ "email": "allowed@example.com", "formData": { "name": "John" } }'
```
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/docs/en/sdks/python.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ def stream_workflow():

def generate():
response = requests.post(
'https://sim.ai/api/workflows/WORKFLOW_ID/execute',
'https://api.sim.ai/api/workflows/WORKFLOW_ID/execute',
headers={
'Content-Type': 'application/json',
'X-API-Key': os.getenv('SIM_API_KEY')
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/docs/en/sdks/typescript.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,7 @@ function StreamingWorkflow() {

// IMPORTANT: Make this API call from your backend server, not the browser
// Never expose your API key in client-side code
const response = await fetch('https://sim.ai/api/workflows/WORKFLOW_ID/execute', {
const response = await fetch('https://api.sim.ai/api/workflows/WORKFLOW_ID/execute', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Expand Down
4 changes: 2 additions & 2 deletions apps/docs/content/docs/es/execution/api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Todas las solicitudes a la API requieren una clave de API pasada en el encabezad

```bash
curl -H "x-api-key: YOUR_API_KEY" \
https://sim.ai/api/v1/logs?workspaceId=YOUR_WORKSPACE_ID
https://api.sim.ai/api/v1/logs?workspaceId=YOUR_WORKSPACE_ID
```

Puedes generar claves de API desde la configuración de usuario en el panel de control de Sim.
Expand Down Expand Up @@ -528,7 +528,7 @@ async function pollLogs() {
}

const response = await fetch(
`https://sim.ai/api/v1/logs?${params}`,
`https://api.sim.ai/api/v1/logs?${params}`,
{
headers: {
'x-api-key': 'YOUR_API_KEY'
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/docs/es/execution/costs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ GET /api/users/me/usage-limits
**Solicitud de ejemplo:**

```bash
curl -X GET -H "X-API-Key: YOUR_API_KEY" -H "Content-Type: application/json" https://sim.ai/api/users/me/usage-limits
curl -X GET -H "X-API-Key: YOUR_API_KEY" -H "Content-Type: application/json" https://api.sim.ai/api/users/me/usage-limits
```

**Respuesta de ejemplo:**
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/docs/es/sdks/python.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ def stream_workflow():

def generate():
response = requests.post(
'https://sim.ai/api/workflows/WORKFLOW_ID/execute',
'https://api.sim.ai/api/workflows/WORKFLOW_ID/execute',
headers={
'Content-Type': 'application/json',
'X-API-Key': os.getenv('SIM_API_KEY')
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/docs/es/sdks/typescript.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -965,7 +965,7 @@ function StreamingWorkflow() {

// IMPORTANT: Make this API call from your backend server, not the browser
// Never expose your API key in client-side code
const response = await fetch('https://sim.ai/api/workflows/WORKFLOW_ID/execute', {
const response = await fetch('https://api.sim.ai/api/workflows/WORKFLOW_ID/execute', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Expand Down
4 changes: 2 additions & 2 deletions apps/docs/content/docs/fr/execution/api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Toutes les requêtes API nécessitent une clé API transmise dans l'en-tête `x-

```bash
curl -H "x-api-key: YOUR_API_KEY" \
https://sim.ai/api/v1/logs?workspaceId=YOUR_WORKSPACE_ID
https://api.sim.ai/api/v1/logs?workspaceId=YOUR_WORKSPACE_ID
```

Vous pouvez générer des clés API depuis vos paramètres utilisateur dans le tableau de bord Sim.
Expand Down Expand Up @@ -528,7 +528,7 @@ async function pollLogs() {
}

const response = await fetch(
`https://sim.ai/api/v1/logs?${params}`,
`https://api.sim.ai/api/v1/logs?${params}`,
{
headers: {
'x-api-key': 'YOUR_API_KEY'
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/docs/fr/execution/costs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ GET /api/users/me/usage-limits
**Exemple de requête :**

```bash
curl -X GET -H "X-API-Key: YOUR_API_KEY" -H "Content-Type: application/json" https://sim.ai/api/users/me/usage-limits
curl -X GET -H "X-API-Key: YOUR_API_KEY" -H "Content-Type: application/json" https://api.sim.ai/api/users/me/usage-limits
```

**Exemple de réponse :**
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/docs/fr/sdks/python.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ def stream_workflow():

def generate():
response = requests.post(
'https://sim.ai/api/workflows/WORKFLOW_ID/execute',
'https://api.sim.ai/api/workflows/WORKFLOW_ID/execute',
headers={
'Content-Type': 'application/json',
'X-API-Key': os.getenv('SIM_API_KEY')
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/docs/fr/sdks/typescript.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -965,7 +965,7 @@ function StreamingWorkflow() {

// IMPORTANT: Make this API call from your backend server, not the browser
// Never expose your API key in client-side code
const response = await fetch('https://sim.ai/api/workflows/WORKFLOW_ID/execute', {
const response = await fetch('https://api.sim.ai/api/workflows/WORKFLOW_ID/execute', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Expand Down
4 changes: 2 additions & 2 deletions apps/docs/content/docs/ja/execution/api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Simは、ワークフローの実行ログを照会したり、ワークフロ

```bash
curl -H "x-api-key: YOUR_API_KEY" \
https://sim.ai/api/v1/logs?workspaceId=YOUR_WORKSPACE_ID
https://api.sim.ai/api/v1/logs?workspaceId=YOUR_WORKSPACE_ID
```

SimダッシュボードのユーザーセッティングからAPIキーを生成できます。
Expand Down Expand Up @@ -528,7 +528,7 @@ async function pollLogs() {
}

const response = await fetch(
`https://sim.ai/api/v1/logs?${params}`,
`https://api.sim.ai/api/v1/logs?${params}`,
{
headers: {
'x-api-key': 'YOUR_API_KEY'
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/docs/ja/execution/costs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ GET /api/users/me/usage-limits
**リクエスト例:**

```bash
curl -X GET -H "X-API-Key: YOUR_API_KEY" -H "Content-Type: application/json" https://sim.ai/api/users/me/usage-limits
curl -X GET -H "X-API-Key: YOUR_API_KEY" -H "Content-Type: application/json" https://api.sim.ai/api/users/me/usage-limits
```

**レスポンス例:**
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/docs/ja/sdks/python.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ def stream_workflow():

def generate():
response = requests.post(
'https://sim.ai/api/workflows/WORKFLOW_ID/execute',
'https://api.sim.ai/api/workflows/WORKFLOW_ID/execute',
headers={
'Content-Type': 'application/json',
'X-API-Key': os.getenv('SIM_API_KEY')
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/docs/ja/sdks/typescript.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -965,7 +965,7 @@ function StreamingWorkflow() {

// IMPORTANT: Make this API call from your backend server, not the browser
// Never expose your API key in client-side code
const response = await fetch('https://sim.ai/api/workflows/WORKFLOW_ID/execute', {
const response = await fetch('https://api.sim.ai/api/workflows/WORKFLOW_ID/execute', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Expand Down
4 changes: 2 additions & 2 deletions apps/docs/content/docs/zh/execution/api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Sim 提供了一个全面的外部 API,用于查询工作流执行日志,并

```bash
curl -H "x-api-key: YOUR_API_KEY" \
https://sim.ai/api/v1/logs?workspaceId=YOUR_WORKSPACE_ID
https://api.sim.ai/api/v1/logs?workspaceId=YOUR_WORKSPACE_ID
```

您可以在 Sim 仪表板的用户设置中生成 API 密钥。
Expand Down Expand Up @@ -528,7 +528,7 @@ async function pollLogs() {
}

const response = await fetch(
`https://sim.ai/api/v1/logs?${params}`,
`https://api.sim.ai/api/v1/logs?${params}`,
{
headers: {
'x-api-key': 'YOUR_API_KEY'
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/docs/zh/execution/costs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ GET /api/users/me/usage-limits
**请求示例:**

```bash
curl -X GET -H "X-API-Key: YOUR_API_KEY" -H "Content-Type: application/json" https://sim.ai/api/users/me/usage-limits
curl -X GET -H "X-API-Key: YOUR_API_KEY" -H "Content-Type: application/json" https://api.sim.ai/api/users/me/usage-limits
```

**响应示例:**
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/docs/zh/sdks/python.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ def stream_workflow():

def generate():
response = requests.post(
'https://sim.ai/api/workflows/WORKFLOW_ID/execute',
'https://api.sim.ai/api/workflows/WORKFLOW_ID/execute',
headers={
'Content-Type': 'application/json',
'X-API-Key': os.getenv('SIM_API_KEY')
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/docs/zh/sdks/typescript.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -965,7 +965,7 @@ function StreamingWorkflow() {

// IMPORTANT: Make this API call from your backend server, not the browser
// Never expose your API key in client-side code
const response = await fetch('https://sim.ai/api/workflows/WORKFLOW_ID/execute', {
const response = await fetch('https://api.sim.ai/api/workflows/WORKFLOW_ID/execute', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
ModalTabsList,
ModalTabsTrigger,
} from '@/components/emcn'
import { getBaseUrl } from '@/lib/core/utils/urls'
import { getApiUrl } from '@/lib/core/utils/urls'
import { getInputFormatExample as getInputFormatExampleUtil } from '@/lib/workflows/operations/deployment-utils'
import { useUserPermissionsContext } from '@/app/workspace/[workspaceId]/providers/workspace-permissions-provider'
import { CreateApiKeyModal } from '@/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/api-keys/components'
Expand Down Expand Up @@ -201,7 +201,7 @@ export function DeployModal({
return null
}

const endpoint = `${getBaseUrl()}/api/workflows/${workflowId}/execute`
const endpoint = `${getApiUrl()}/api/workflows/${workflowId}/execute`
const inputFormatExample = getInputFormatExample(selectedStreamingOutputs.length > 0)
const placeholderKey = getApiHeaderPlaceholder()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { v4 as uuidv4 } from 'uuid'
import { getApiUrl } from '@/lib/core/utils/urls'
import type { ExecutionResult, StreamingExecution } from '@/executor/types'
import { useExecutionStore } from '@/stores/execution'
import { useTerminalConsoleStore } from '@/stores/terminal'
Expand Down Expand Up @@ -41,7 +42,8 @@ export async function executeWorkflowWithFullLogging(
isClientSession: true,
}

const response = await fetch(`/api/workflows/${activeWorkflowId}/execute`, {
const apiUrl = getApiUrl()
const response = await fetch(`${apiUrl}/api/workflows/${activeWorkflowId}/execute`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Expand Down
2 changes: 1 addition & 1 deletion apps/sim/blocks/blocks/api_trigger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const ApiTriggerBlock: BlockConfig = {
bestPractices: `
- Can run the workflow manually to test implementation when this is the trigger point.
- The input format determines variables accesssible in the following blocks. E.g. <api1.paramName>. You can set the value in the input format to test the workflow manually.
- In production, the curl would come in as e.g. curl -X POST -H "X-API-Key: $SIM_API_KEY" -H "Content-Type: application/json" -d '{"paramName":"example"}' https://www.staging.sim.ai/api/workflows/9e7e4f26-fc5e-4659-b270-7ea474b14f4a/execute -- If user asks to test via API, you might need to clarify the API key.
- In production, the curl would come in as e.g. curl -X POST -H "X-API-Key: $SIM_API_KEY" -H "Content-Type: application/json" -d '{"paramName":"example"}' https://api.sim.ai/api/workflows/9e7e4f26-fc5e-4659-b270-7ea474b14f4a/execute -- If user asks to test via API, you might need to clarify the API key.
`,
category: 'triggers',
hideFromToolbar: true,
Expand Down
17 changes: 12 additions & 5 deletions apps/sim/hooks/use-execution-stream.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useCallback, useRef } from 'react'
import { createLogger } from '@sim/logger'
import { getApiUrl } from '@/lib/core/utils/urls'
import type {
BlockCompletedData,
BlockErrorData,
Expand Down Expand Up @@ -151,7 +152,8 @@ export function useExecutionStream() {
currentExecutionRef.current = null

try {
const response = await fetch(`/api/workflows/${workflowId}/execute`, {
const apiUrl = getApiUrl()
const response = await fetch(`${apiUrl}/api/workflows/${workflowId}/execute`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Expand Down Expand Up @@ -211,7 +213,8 @@ export function useExecutionStream() {
currentExecutionRef.current = null

try {
const response = await fetch(`/api/workflows/${workflowId}/execute-from-block`, {
const apiUrl = getApiUrl()
const response = await fetch(`${apiUrl}/api/workflows/${workflowId}/execute-from-block`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Expand Down Expand Up @@ -266,9 +269,13 @@ export function useExecutionStream() {
const cancel = useCallback(() => {
const execution = currentExecutionRef.current
if (execution) {
fetch(`/api/workflows/${execution.workflowId}/executions/${execution.executionId}/cancel`, {
method: 'POST',
}).catch(() => {})
const apiUrl = getApiUrl()
fetch(
`${apiUrl}/api/workflows/${execution.workflowId}/executions/${execution.executionId}/cancel`,
{
method: 'POST',
}
).catch(() => {})
}

if (abortControllerRef.current) {
Expand Down
Loading