API Endpoint Trigger

Exposes a programmable HTTP endpoint backed by your workflow. Supports multiple HTTP methods, authentication, and synchronous responses — the caller waits for the workflow to finish and receives the result.

When to Use

Use API Endpoint when:

  • You want to build a custom REST API without writing server code
  • Callers need a synchronous response from your workflow
  • You need to authenticate incoming requests with an API key or bearer token

If callers do not need a synchronous response and you just want to react to events, use Webhook instead.

Output

API Endpoint creates one output handle per HTTP method you enable. For example, if you enable GET and POST, the node produces a GET handle and a POST handle.

Each handle emits an api_request object with this shape:

FieldTypeDescription
bodyanyParsed request body
headersobjectRequest headers
queryobjectURL query parameters
methodstringHTTP method used
pathstringRequest path

Settings

SettingTypeDefaultDescription
pathstring/apiRoute suffix. Example: /users
allowedMethodsmultiselectGET, POSTHTTP methods accepted. Each creates an output handle.
authTypeselectnoneAuthentication: none, api-key, or bearer-token
apiKeyLocationselectheaderWhere to read the API key: header or query.
apiKeyNamestringX-API-KeyHeader or query param name for the API key.
authorizationHeaderNamestringAuthorizationHeader name for the bearer token.
bearerPrefixstringBearerPrefix stripped from the Authorization header value.
secretsecretExpected API key or bearer token value. Stored securely.
parseBodyAsselectautoBody parsing: auto, json, text, or form
responseModeselectuse-workflow-responseHolds the connection until Return fires, or responds 200 immediately.
defaultStatusCodenumber200Status code for ack-immediately or when no Return fires.
mockMethodselectGETHTTP method to simulate during canvas testing.
mockPayloadJSONTest body injected during canvas testing.
mockHeadersJSONTest headers injected during canvas testing.
mockQueryJSONTest query params injected during canvas testing.

Returning a Response

When responseMode is use-workflow-response, you must connect a Return node somewhere in the workflow. Without it, the caller's connection will hang until the timeout.

The value wired into the Return node becomes the HTTP response body. Tensorify serializes it as JSON automatically.

A minimal synchronous API workflow:

API Endpoint (POST) → [your logic] → Return

Example

Build an endpoint that looks up a user and returns their profile:

  1. Set path to /users/lookup
  2. Set allowedMethods to POST
  3. Set authType to api-key
  4. Add an HTTP Request node connected to the POST handle — it calls your internal user service with {{ api_request.body.userId }}
  5. Connect the HTTP Request result to a Return node

Test with curl:

curl -X POST https://triggers.tensorify.io/your-endpoint/users/lookup \
  -H "X-API-Key: your-secret" \
  -H "Content-Type: application/json" \
  -d '{"userId": "usr_123"}'

Common Gotchas

  • Multiple methods: Each allowed method creates a separate output handle. You need to route them separately in your workflow if you want different logic per method.
  • Timeout: If your workflow takes longer than the configured timeout to produce a Return value, the connection drops and the caller receives a timeout error.
  • Auth: The secret field is stored encrypted. Never pass it through a workflow variable — it is only used for request validation.

See Also

On this page