Invoke a flow with an API endpoint using a Client Token
You can secure an API Endpoint flow with a client token. The flow is then only accessible to callers that send the correct client token in the x-api-client-token header of the request. Use this option when the caller is a service, script, or app that can store a static token, including systems that send webhooks. The invoke URL is constructed using a flow alias.
After you invoke a flow, it sends the flow output as a response object.
Create your flow
- In the Workflows Console, create a flow and select Add event.
- Under Built-in triggers, select API Endpoint.
To secure an existing API Endpoint flow, open the endpoint settings from the API Endpoint event card.
Configure your API endpoint settings
- In the API endpoint settings dialog, select Secure with client token as the security level. Workflows generates a Client token for the flow.
- Copy the Invoke URL and the Client token.
- Select Close to confirm the changed endpoint settings.
Test your API endpoint flow
Turn the flow on before you test it. To invoke the flow, perform a GET or POST request to the Invoke URL. Use the POST method if you need to send data in the body of the request. Include the client token in the x-api-client-token header.
Example request:
curl -X POST "<Invoke URL>" \
-H "x-api-client-token: <client token>" \
-H "Content-Type: application/json" \
-d '{"key": "value"}'
Pass the client token as a query parameter
We don't recommend passing the client token with the clientToken query parameter, although it's still supported. Web servers and proxies can record tokens in URLs, browsers can cache them, and screenshots, tickets, and chat can expose them. Don't use the clientToken query parameter and the x-api-client-token header in the same request.