Guide: Build a REST API Endpoint
Build a workflow that acts as a REST API endpoint — it receives a request, calls an external service, and returns a structured JSON response synchronously to the caller.
What you will build:
API Endpoint (POST) → HTTP Request (fetch data) → Transform → Return
Time: ~10 minutes
Prerequisites:
- Tensorify account with a workspace
- CLI installed (only for local testing):
curl -fsSL https://cli.tensorify.io/install | sh— or skip and deploy with Managed mode
- Go to app.tensorify.io → dashboard
- Click New Workflow and name it
user-lookup-api - Click Create
Drag an API Endpoint node onto the canvas. In its settings:
- Path:
/users/lookup - Allowed Methods:
POST - Auth Type:
api-key - API Key Name:
X-API-Key - Secret: a random string (e.g.,
openssl rand -hex 16) - Response Mode:
use-workflow-response
Because responseMode is use-workflow-response, you must connect a Return node by the end of this guide or test calls will hang.
This node will look up a user from a public API. For this example, we use jsonplaceholder.typicode.com as a stand-in for your real user service.
Drag an HTTP Request node onto the canvas. Connect the API Endpoint's POST output to HTTP Request's body input.
In its settings:
- Method:
GET - URL:
https://jsonplaceholder.typicode.com/users/{{ api_request.body.userId }}
The URL uses a {{ }} binding to inject the userId field from the incoming request body.
Drag a Transform node and connect HTTP Request's response to its input.
In the template, shape the response to only return what the caller needs:
{
"id": "{{ http_request.data.id }}",
"name": "{{ http_request.data.name }}",
"email": "{{ http_request.data.email }}",
"company": "{{ http_request.data.company.name }}",
"found": true
}
Drag a Return node onto the canvas. Connect Transform's result to Return's input.
The caller will receive the transformed object as the JSON response body.
Using Managed mode? Skip this step — deploy directly from Step 7 with Managed execution and test via curl.
tensorify init
tensorify login # opens browser — or use --api-key on init
tensorify runner start
In the API Endpoint node settings, set a mock payload:
{ "userId": 1 }
And a mock header:
{ "X-API-Key": "your-secret" }
Click Test → select the Return node → click Run to Selected.
The canvas will show the transformed user object in the Return node's output panel.
- Click Deploy in the toolbar
- Note your endpoint URL — something like
https://triggers.tensorify.io/your-workspace/users/lookup - Set execution mode to CLI or Managed
If using self-hosted execution, ensure your runner is connected (tensorify runner start), then deploy from the Deploy dialog with execution mode CLI or Auto.
curl -X POST https://triggers.tensorify.io/your-workspace/users/lookup \
-H "X-API-Key: your-secret" \
-H "Content-Type: application/json" \
-d '{"userId": 3}'
Expected response:
{
"id": 3,
"name": "Clementine Bauch",
"email": "[email protected]",
"company": "Romaguera-Jacobson",
"found": true
}
- How to configure an API Endpoint trigger with API key authentication
- How to use
{{ }}bindings in the HTTP Request URL to pass request data dynamically - How to use Transform to shape the external API response
- How to use Return to send a synchronous JSON response back to the caller
- API Endpoint reference — full settings including bearer token auth and multiple methods
- Return reference — how Return works with subworkflows
- Send Email on Trigger — simpler first workflow
- Deploying Workflows — production deployment with CLI or managed cloud
API Endpoints (this guide) are for when you define the interface — your workflow acts as a backend service that callers invoke on demand and receive a synchronous response. Use this for building internal tools, microservices, or public APIs.
Webhooks are for when an external service pushes events to you — Stripe sends a payment event, GitHub sends a push notification. Your workflow reacts asynchronously; the caller doesn't wait for a response. See the Webhook Automation guide for that pattern.
