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:
npm install -g @tensorify.io/cli
- 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.
export TENSORIFY_API_KEY="your_key_here"
tensorify watch user-lookup-api-workflow-id
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 CLI mode:
tensorify run user-lookup-api-workflow-id
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
