diff --git a/docs/docs/API-Reference/api-build.md b/docs/docs/API-Reference/api-build.md index dce72ec0f274..85eb942e604e 100644 --- a/docs/docs/API-Reference/api-build.md +++ b/docs/docs/API-Reference/api-build.md @@ -32,6 +32,7 @@ curl -X POST \ "$LANGFLOW_URL/api/v1/build/$FLOW_ID/flow" \ -H "accept: application/json" \ -H "Content-Type: application/json" \ + -H "x-api-key: $LANGFLOW_API_KEY" \ -d '{ "inputs": { "input_value": "Tell me a story" @@ -59,7 +60,8 @@ curl -X POST \ ```text curl -X GET \ "$LANGFLOW_URL/api/v1/build/123e4567-e89b-12d3-a456-426614174000/events" \ - -H "accept: application/json" + -H "accept: application/json" \ + -H "x-api-key: $LANGFLOW_API_KEY" ``` @@ -84,7 +86,8 @@ To disable streaming and get all events at once, set `stream` to `false`. ```text curl -X GET \ "$LANGFLOW_URL/api/v1/build/123e4567-e89b-12d3-a456-426614174000/events?stream=false" \ - -H "accept: application/json" + -H "accept: application/json" \ + -H "x-api-key: $LANGFLOW_API_KEY" ``` ## Build headers @@ -134,6 +137,7 @@ curl -X POST \ "$LANGFLOW_URL/api/v1/build/$FLOW_ID/flow" \ -H "accept: application/json" \ -H "Content-Type: application/json" \ + -H "x-api-key: $LANGFLOW_API_KEY" \ -d '{ "data": { "nodes": [], diff --git a/docs/docs/API-Reference/api-files.md b/docs/docs/API-Reference/api-files.md index 2b20c44addda..5a3dc6b0d7bf 100644 --- a/docs/docs/API-Reference/api-files.md +++ b/docs/docs/API-Reference/api-files.md @@ -43,6 +43,7 @@ curl -X POST \ "$LANGFLOW_URL/api/v1/files/upload/$FLOW_ID" \ -H "accept: application/json" \ -H "Content-Type: multipart/form-data" \ + -H "x-api-key: $LANGFLOW_API_KEY" \ -F "file=@FILE_NAME.txt" ``` @@ -72,6 +73,7 @@ For more information, see [Supported environment variables](/environment-variabl ```bash curl -X POST "$LANGFLOW_URL/api/v1/files/upload/a430cc57-06bb-4c11-be39-d3d4de68d2c4" \ -H "Content-Type: multipart/form-data" \ + -H "x-api-key: $LANGFLOW_API_KEY" \ -F "file=@FILE_NAME.png" ``` @@ -91,7 +93,8 @@ The API returns the image file path in the format `"file_path":"/< ```bash curl -X POST \ "$LANGFLOW_URL/api/v1/run/a430cc57-06bb-4c11-be39-d3d4de68d2c4?stream=false" \ - -H 'Content-Type: application/json'\ + -H 'Content-Type: application/json' \ + -H "x-api-key: $LANGFLOW_API_KEY" \ -d '{ "output_type": "chat", "input_type": "chat", @@ -119,7 +122,8 @@ List all files associated with a specific flow. ```bash curl -X GET \ "$LANGFLOW_URL/api/v1/files/list/$FLOW_ID" \ - -H "accept: application/json" + -H "accept: application/json" \ + -H "x-api-key: $LANGFLOW_API_KEY" ``` @@ -145,6 +149,7 @@ Download a specific file from a flow. curl -X GET \ "$LANGFLOW_URL/api/v1/files/download/$FLOW_ID/2024-12-30_15-19-43_your_file.txt" \ -H "accept: application/json" \ + -H "x-api-key: $LANGFLOW_API_KEY" \ --output downloaded_file.txt ``` @@ -168,7 +173,8 @@ Delete a specific file from a flow. ```bash curl -X DELETE \ "$LANGFLOW_URL/api/v1/files/delete/$FLOW_ID/2024-12-30_15-19-43_your_file.txt" \ - -H "accept: application/json" + -H "accept: application/json" \ + -H "x-api-key: $LANGFLOW_API_KEY" ``` @@ -200,7 +206,8 @@ To retrieve your current `user_id`, call the `/whoami` endpoint. ```bash curl -X GET \ "$LANGFLOW_URL/api/v1/users/whoami" \ - -H "accept: application/json" + -H "accept: application/json" \ + -H "x-api-key: $LANGFLOW_API_KEY" ``` Result: @@ -279,6 +286,7 @@ In this example, the file uploaded to `/v2/files` is included with the `/v1/run` curl --request POST \ --url "$LANGFLOW_URL/api/v1/run/$FLOW_ID" \ --header "Content-Type: application/json" \ + --header "x-api-key: $LANGFLOW_API_KEY" \ --data '{ "input_value": "what do you see?", "output_type": "chat", diff --git a/docs/docs/API-Reference/api-flows-run.md b/docs/docs/API-Reference/api-flows-run.md index 33c86b184cde..f76580d7195e 100644 --- a/docs/docs/API-Reference/api-flows-run.md +++ b/docs/docs/API-Reference/api-flows-run.md @@ -22,6 +22,7 @@ This flow requires a chat input string (`input_value`), and uses default values curl -X POST \ "$LANGFLOW_SERVER_URL/api/v1/run/$FLOW_ID" \ -H "Content-Type: application/json" \ + -H "x-api-key: $LANGFLOW_API_KEY" \ -d '{ "input_value": "Tell me about something interesting!", "session_id": "chat-123", @@ -86,6 +87,7 @@ curl -X POST \ "$LANGFLOW_SERVER_URL/api/v1/run/$FLOW_ID?stream=true" \ -H "accept: application/json" \ -H "Content-Type: application/json" \ + -H "x-api-key: $LANGFLOW_API_KEY" \ -d '{ "message": "Tell me something interesting!", "session_id": "chat-123" @@ -152,7 +154,7 @@ curl -X POST \ "$LANGFLOW_SERVER_URL/api/v1/run/$FLOW_ID?stream=true" \ -H "Content-Type: application/json" \ -H "accept: application/json" \ - -H "x-api-key: sk-..." \ + -H "x-api-key: $LANGFLOW_API_KEY" \ -d '{ "input_value": "Tell me a story", "input_type": "chat", @@ -179,6 +181,7 @@ After you add a **Webhook** component to a flow, open the [**API access** pane]( curl -X POST \ "$LANGFLOW_SERVER_URL/api/v1/webhook/$FLOW_ID" \ -H "Content-Type: application/json" \ + -H "x-api-key: $LANGFLOW_API_KEY" \ -d '{"data": "example-data"}' ``` diff --git a/docs/docs/API-Reference/api-flows.md b/docs/docs/API-Reference/api-flows.md index 15e99eea7839..b98b6733d25e 100644 --- a/docs/docs/API-Reference/api-flows.md +++ b/docs/docs/API-Reference/api-flows.md @@ -22,6 +22,7 @@ curl -X POST \ "$LANGFLOW_URL/api/v1/flows/" \ -H "accept: application/json" \ -H "Content-Type: application/json" \ + -H "x-api-key: $LANGFLOW_API_KEY" \ -d '{ "name": "string2", "description": "string", @@ -74,6 +75,7 @@ curl -X POST \ "$LANGFLOW_URL/api/v1/flows/batch/" \ -H "accept: application/json" \ -H "Content-Type: application/json" \ + -H "x-api-key: $LANGFLOW_API_KEY" \ -d '{ "flows": [ { @@ -126,7 +128,8 @@ Retrieves a specific flow by its ID. ```bash curl -X GET \ "$LANGFLOW_URL/api/v1/flows/$FLOW_ID" \ - -H "accept: application/json" + -H "accept: application/json" \ + -H "x-api-key: $LANGFLOW_API_KEY" ``` @@ -160,7 +163,8 @@ Retrieve all flows with pagination: ```bash curl -X GET \ "$LANGFLOW_URL/api/v1/flows/?remove_example_flows=false&components_only=false&get_all=true&header_flows=false&page=1&size=50" \ - -H "accept: application/json" + -H "accept: application/json" \ + -H "x-api-key: $LANGFLOW_API_KEY" ``` To retrieve flows from a specific project, use the `project_id` query parameter: @@ -168,7 +172,8 @@ To retrieve flows from a specific project, use the `project_id` query parameter: ```bash curl -X GET \ "$LANGFLOW_URL/api/v1/flows/?remove_example_flows=true&components_only=false&get_all=false&project_id=$PROJECT_ID&header_flows=false&page=1&size=1" \ - -H "accept: application/json" + -H "accept: application/json" \ + -H "x-api-key: $LANGFLOW_API_KEY" ``` ## Read sample flows @@ -178,7 +183,8 @@ Retrieves a list of sample flows: ```bash curl -X GET \ "$LANGFLOW_URL/api/v1/flows/basic_examples/" \ - -H "accept: application/json" + -H "accept: application/json" \ + -H "x-api-key: $LANGFLOW_API_KEY" ``` ## Update flow @@ -195,6 +201,7 @@ curl -X PATCH \ "$LANGFLOW_URL/api/v1/flows/$FLOW_ID" \ -H "accept: application/json" \ -H "Content-Type: application/json" \ + -H "x-api-key: $LANGFLOW_API_KEY" \ -d '{ "name": "string", "description": "string", @@ -241,7 +248,8 @@ Deletes a specific flow by its ID. ```bash curl -X DELETE \ "$LANGFLOW_URL/api/v1/flows/$FLOW_ID" \ - -H "accept: application/json" + -H "accept: application/json" \ + -H "x-api-key: $LANGFLOW_API_KEY" ``` @@ -271,6 +279,7 @@ curl -X POST \ "$LANGFLOW_URL/api/v1/flows/download/" \ -H "accept: application/json" \ -H "Content-Type: application/json" \ + -H "x-api-key: $LANGFLOW_API_KEY" \ -d '[ "e1e40c77-0541-41a9-88ab-ddb3419398b5", "92f9a4c5-cfc8-4656-ae63-1f0881163c28" @@ -307,6 +316,7 @@ curl -X POST \ "$LANGFLOW_URL/api/v1/flows/upload/?project_id=$PROJECT_ID" \ -H "accept: application/json" \ -H "Content-Type: multipart/form-data" \ + -H "x-api-key: $LANGFLOW_API_KEY" \ -F "file=@agent-with-astra-db-tool.json;type=application/json" ``` diff --git a/docs/docs/API-Reference/api-logs.md b/docs/docs/API-Reference/api-logs.md index 07fb960a687b..b7b543549c5c 100644 --- a/docs/docs/API-Reference/api-logs.md +++ b/docs/docs/API-Reference/api-logs.md @@ -38,7 +38,8 @@ Stream logs in real-time using Server Sent Events (SSE). ```bash curl -X GET \ "$LANGFLOW_URL/logs-stream" \ - -H "accept: text/event-stream" + -H "accept: text/event-stream" \ + -H "x-api-key: $LANGFLOW_API_KEY" ``` @@ -84,7 +85,8 @@ With default values, the endpoint returns the last 10 lines of logs. ```bash curl -X GET \ "$LANGFLOW_URL/logs?lines_before=0&lines_after=0×tamp=0" \ - -H "accept: application/json" + -H "accept: application/json" \ + -H "x-api-key: $LANGFLOW_API_KEY" ``` diff --git a/docs/docs/API-Reference/api-monitor.md b/docs/docs/API-Reference/api-monitor.md index d7bc135b37ca..b76379bab2d4 100644 --- a/docs/docs/API-Reference/api-monitor.md +++ b/docs/docs/API-Reference/api-monitor.md @@ -18,7 +18,8 @@ Retrieve Vertex builds for a specific flow. ```bash curl -X GET \ "$LANGFLOW_URL/api/v1/monitor/builds?flow_id=$FLOW_ID" \ - -H "accept: application/json" + -H "accept: application/json" \ + -H "x-api-key: $LANGFLOW_API_KEY" ``` @@ -397,7 +398,8 @@ Delete Vertex builds for a specific flow. ```bash curl -X DELETE \ "$LANGFLOW_URL/api/v1/monitor/builds?flow_id=$FLOW_ID" \ - -H "accept: */*" + -H "accept: */*" \ + -H "x-api-key: $LANGFLOW_API_KEY" ``` @@ -417,7 +419,8 @@ Retrieve a list of all messages: ```bash curl -X GET \ "$LANGFLOW_URL/api/v1/monitor/messages" \ - -H "accept: application/json" + -H "accept: application/json" \ + -H "x-api-key: $LANGFLOW_API_KEY" ``` To filter messages, use the `flow_id`, `session_id`, `sender`, and `sender_name` query parameters. @@ -432,7 +435,8 @@ This example retrieves messages sent by `Machine` and `AI` in a given chat sessi ```bash curl -X GET \ "$LANGFLOW_URL/api/v1/monitor/messages?flow_id=$FLOW_ID&session_id=01ce083d-748b-4b8d-97b6-33adbb6a528a&sender=Machine&sender_name=AI&order_by=timestamp" \ - -H "accept: application/json" + -H "accept: application/json" \ + -H "x-api-key: $LANGFLOW_API_KEY" ``` @@ -488,6 +492,7 @@ curl -v -X DELETE \ "$LANGFLOW_URL/api/v1/monitor/messages" \ -H "accept: */*" \ -H "Content-Type: application/json" \ + -H "x-api-key: $LANGFLOW_API_KEY" \ -d '["MESSAGE_ID_1", "MESSAGE_ID_2"]' ``` @@ -515,6 +520,7 @@ curl -X PUT \ "$LANGFLOW_URL/api/v1/monitor/messages/3ab66cc6-c048-48f8-ab07-570f5af7b160" \ -H "accept: application/json" \ -H "Content-Type: application/json" \ + -H "x-api-key: $LANGFLOW_API_KEY" \ -d '{ "text": "testing 1234" }' @@ -566,7 +572,8 @@ This example updates the `session_ID` value `01ce083d-748b-4b8d-97b6-33adbb6a528 ```bash curl -X PATCH \ "$LANGFLOW_URL/api/v1/monitor/messages/session/01ce083d-748b-4b8d-97b6-33adbb6a528a?new_session_id=different_session_id" \ - -H "accept: application/json" + -H "accept: application/json" \ + -H "x-api-key: $LANGFLOW_API_KEY" ``` @@ -618,7 +625,8 @@ Delete all messages for a specific session. ```bash curl -X DELETE \ "$LANGFLOW_URL/api/v1/monitor/messages/session/different_session_id_2" \ - -H "accept: */*" + -H "accept: */*" \ + -H "x-api-key: $LANGFLOW_API_KEY" ``` @@ -641,7 +649,8 @@ Retrieve all transactions, which are interactions between components, for a spec ```bash curl -X GET \ "$LANGFLOW_URL/api/v1/monitor/transactions?flow_id=$FLOW_ID&page=1&size=50" \ - -H "accept: application/json" + -H "accept: application/json" \ + -H "x-api-key: $LANGFLOW_API_KEY" ``` diff --git a/docs/docs/API-Reference/api-projects.md b/docs/docs/API-Reference/api-projects.md index 86b90e15c3c6..c5a285365ccf 100644 --- a/docs/docs/API-Reference/api-projects.md +++ b/docs/docs/API-Reference/api-projects.md @@ -20,7 +20,8 @@ Get a list of Langflow projects, including project IDs, names, and descriptions. ```bash curl -X GET \ "$LANGFLOW_URL/api/v1/projects/" \ - -H "accept: application/json" + -H "accept: application/json" \ + -H "x-api-key: $LANGFLOW_API_KEY" ``` @@ -51,6 +52,7 @@ Create a new project. curl -X POST \ "$LANGFLOW_URL/api/v1/projects/" \ -H "Content-Type: application/json" \ + -H "x-api-key: $LANGFLOW_API_KEY" \ -d '{ "name": "new_project_name", "description": "string", @@ -83,6 +85,7 @@ curl -X POST \ "$LANGFLOW_URL/api/v1/projects/" \ -H "accept: application/json" \ -H "Content-Type: application/json" \ + -H "x-api-key: $LANGFLOW_API_KEY" \ -d '{ "name": "new_project_name", "description": "string", @@ -107,7 +110,8 @@ To find the UUID of your project, call the [read projects](#read-projects) endpo ```bash curl -X GET \ "$LANGFLOW_URL/api/v1/projects/$PROJECT_ID" \ - -H "accept: application/json" + -H "accept: application/json" \ + -H "x-api-key: $LANGFLOW_API_KEY" ``` @@ -142,6 +146,7 @@ If you send the same values multiple times, the update is still processed, even curl -X PATCH \ "$LANGFLOW_URL/api/v1/projects/b408ddb9-6266-4431-9be8-e04a62758331" \ -H "accept: application/json" \ + -H "x-api-key: $LANGFLOW_API_KEY" \ -d '{ "name": "string", "description": "string", @@ -180,7 +185,8 @@ Delete a specific project. ```bash curl -X DELETE \ "$LANGFLOW_URL/api/v1/projects/$PROJECT_ID" \ - -H "accept: */*" + -H "accept: */*" \ + -H "x-api-key: $LANGFLOW_API_KEY" ``` @@ -203,6 +209,7 @@ The `--output` flag is optional. curl -X GET \ "$LANGFLOW_URL/api/v1/projects/download/b408ddb9-6266-4431-9be8-e04a62758331" \ -H "accept: application/json" \ + -H "x-api-key: $LANGFLOW_API_KEY" \ --output langflow-project.zip ``` @@ -215,5 +222,6 @@ curl -X POST \ "$LANGFLOW_URL/api/v1/projects/upload/" \ -H "accept: application/json" \ -H "Content-Type: multipart/form-data" \ + -H "x-api-key: $LANGFLOW_API_KEY" \ -F "file=@20241230_135006_langflow_flows.zip;type=application/zip" ``` diff --git a/docs/docs/API-Reference/api-reference-api-examples.md b/docs/docs/API-Reference/api-reference-api-examples.md index 301bdfe263ab..288ae92dba39 100644 --- a/docs/docs/API-Reference/api-reference-api-examples.md +++ b/docs/docs/API-Reference/api-reference-api-examples.md @@ -47,40 +47,34 @@ curl --request POST \ ### Base URL - - -Local deployments serve the Langflow API at `http://localhost:LANGFLOW_PORT/api`. -The default port is 7868 or 7860: - -* Local Langflow Desktop: `http://localhost:7868/api` -* Local Langflow OSS: `http://localhost:7860/api` -* Local Langflow Docker image: `http://localhost:7860/api` - -Remotely hosted Langflow deployments are available at the domain set by the hosting service. -For example: * `https://UUID.ngrok.app/api` * `http://IP_OR_DNS/api` * `http://IP_OR_DNS:LANGFLOW_PORT/api` -:::tip -The Langflow port number is set in the `LANGFLOW_PORT` [environment variable](/environment-variables). -:::: - ### Authentication -Your [Langflow deployment's authentication settings](/configuration-authentication) determine whether Langflow API requests require explicit authentication with a Langflow API key. +As of Langflow v1.5, all API requests require a Langflow API key, even when `AUTO_LOGIN` is enabled. + +The only exceptions are the MCP endpoints at `/v1/mcp`, `/v1/mcp-projects`, and `/v2/mcp`. +These endpoints don't require authentication, regardless of the `AUTO_LOGIN` setting. -If explicit authentication is required, you must provide a valid Langflow API key in either an `x-api-key` header or query parameter. +You must provide a valid Langflow API key in either an `x-api-key` header or a query parameter. For more information, see [API keys](/configuration-api-keys). -Because authentication isn't always required, Langflow API examples in the Langflow documentation often omit authentication. +
+Auto-login and API key authentication in earlier Langflow versions + +Prior to Langflow v1.5, when `AUTO_LOGIN` was enabled with `AUTO_LOGIN=true`, Langflow automatically logged users in as a superuser without requiring authentication, and API requests could be made without a Langflow API key. + +If you set `SKIP_AUTH_AUTO_LOGIN=true` and `AUTO_LOGIN=true`, authentication will be skipped entirely, and API requests will not require a Langflow API key. + +
As with any API, follow industry best practices for storing and referencing sensitive credentials. For example, you can [set environment variables](#set-environment-variables) for your API keys, and then reference those environment variables in your API requests. @@ -114,6 +108,8 @@ For example: export LANGFLOW_API_KEY="sk..." export LANGFLOW_SERVER_URL="https://localhost:7860" export FLOW_ID="359cd752-07ea-46f2-9d3b-a4407ef618da" +export PROJECT_ID="1415de42-8f01-4f36-bf34-539f23e47466" +export LANGFLOW_API_KEY="sk-..." # Use environment variables in API requests curl --request POST \ @@ -140,8 +136,6 @@ You can retrieve flow IDs from the [**API access** pane](/concepts-publish#api-a Once you have your Langflow server URL, try calling these endpoints that return Langflow metadata. -If authentication is required, include an `x-api-key` header or query parameter with a valid [Langflow API key](/configuration-api-keys), such as `-H 'x-api-key: $API_KEY'`. - ### Get version Returns the current Langflow API version: @@ -150,6 +144,7 @@ Returns the current Langflow API version: curl -X GET \ "$LANGFLOW_SERVER_URL/api/v1/version" \ -H "accept: application/json" + -H "x-api-key: $LANGFLOW_API_KEY" ```
@@ -171,6 +166,7 @@ Returns configuration details for your Langflow deployment: curl -X GET \ "$LANGFLOW_SERVER_URL/api/v1/config" \ -H "accept: application/json" + -H "x-api-key: $LANGFLOW_API_KEY" ```
@@ -196,7 +192,8 @@ Returns a dictionary of all Langflow components: ```bash curl -X GET \ "$LANGFLOW_SERVER_URL/api/v1/all" \ - -H "accept: application/json" + -H "accept: application/json" \ + -H "x-api-key: $LANGFLOW_API_KEY" ``` ## Next steps diff --git a/docs/docs/API-Reference/api-users.md b/docs/docs/API-Reference/api-users.md index d35b8d7a3c7d..ee4a364e979e 100644 --- a/docs/docs/API-Reference/api-users.md +++ b/docs/docs/API-Reference/api-users.md @@ -24,6 +24,7 @@ This creates a new UUID for the user's `id`, which is mapped to `user_id` in the curl -X POST \ "$LANGFLOW_URL/api/v1/users/" \ -H "Content-Type: application/json" \ + -H "x-api-key: $LANGFLOW_API_KEY" \ -d '{ "username": "newuser2", "password": "securepassword123" diff --git a/docs/docs/Components/components-data.md b/docs/docs/Components/components-data.md index b675804072b7..25bcd318bc05 100644 --- a/docs/docs/Components/components-data.md +++ b/docs/docs/Components/components-data.md @@ -421,16 +421,16 @@ This component defines a webhook trigger that runs a flow when it receives an HT If the input is not valid JSON, the component wraps it in a `payload` object so that it can be processed and still trigger the flow. -When you add a **Webhook** component to a flow, the flow's [**API access** pane](/concepts-publish#api-access) exposes an additional **Webhook cURL** tab that contains a `POST /v1/webhook/$FLOW_ID` code snippet. -You can use this request to send data to the **Webhook** component and trigger the flow. -For example: +When a **Webhook** component is added to the workspace, a new **Webhook cURL** tab becomes available in the **API** pane that contains an HTTP POST request for triggering the webhook component. For example: +Replace `LANGFLOW_SERVER_ADDRESS`, `FLOW_ID`, and `LANGFLOW_API_KEY` with the values from your Langflow deployment. ```bash curl -X POST \ - "$LANGFLOW_SERVER_URL/api/v1/webhook/$FLOW_ID" \ - -H 'Content-Type: application/json'\ + "http://LANGFLOW_SERVER_ADDRESS/api/v1/webhook/FLOW_ID" \ + -H 'Content-Type: application/json' \ + -H 'x-api-key: LANGFLOW_API_KEY' \ -d '{"any": "data"}' - ``` +``` The **Webhook** component is often paired with a [**Parser** component](/components-processing#parser) to extract relevant data from the raw payload. For more information, see [Trigger flows with webhooks](/webhook). diff --git a/docs/docs/Components/components-io.md b/docs/docs/Components/components-io.md index 6c26e72bb35d..b4ef5319a4d1 100644 --- a/docs/docs/Components/components-io.md +++ b/docs/docs/Components/components-io.md @@ -206,59 +206,70 @@ The output does not appear in the **Playground**. The **Chat Input** component is often the entry point for passing messages to the Langflow API. To send the same example messages programmatically to your Langflow server, do the following: -1. To get your Langflow endpoint, click **Publish**, and then click **API access**. +1. To get your Langflow endpoint, click **Share**, and then click **API access**. 2. Copy the command from the **cURL** tab, and then paste it in your terminal. - It looks similar to this: - ```text - curl --request POST \ - --url 'http://localhost:7860/api/v1/run/51eed711-4530-4fdc-9bce-5db4351cc73a?stream=false' \ - --header 'Content-Type: application/json' \ - --data '{ - "input_value": "What's the recommended way to install Docker on Mac M1?", - "output_type": "chat", - "input_type": "chat" - }' - ``` + +The values for `LANGFLOW_SERVER_ADDRESS`, `FLOW_ID`, and `LANGFLOW_API_KEY` are automatically completed with values from your Langflow deployment. +If your values are different, you must replace them. +```text +curl --request POST \ + --url "http://LANGFLOW_SERVER_ADDRESS/api/v1/run/FLOW_ID" \ + --header "Content-Type: application/json" \ + --header "x-api-key: LANGFLOW_API_KEY" \ + --data '{ + "input_value": "What's the recommended way to install Docker on Mac M1?", + "output_type": "chat", + "input_type": "chat" +}' +``` + 3. Modify `input_value` so it contains the question, `What's the recommended way to install Docker on Mac M1?`. Note the `output_type` and `input_type` parameters that are passed with the message. The `chat` type provides additional configuration options, and the messages appear in the **Playground**. The `text` type returns only text strings, and does not appear in the **Playground**. 4. Add a custom `session_id` to the message's `data` object. - ```text - curl --request POST \ - --url 'http://localhost:7860/api/v1/run/51eed711-4530-4fdc-9bce-5db4351cc73a?stream=false' \ - --header 'Content-Type: application/json' \ - --data '{ - "input_value": "Whats the recommended way to install Docker on Mac M1", - "session_id": "docker-question-on-m1", - "output_type": "chat", - "input_type": "chat" - }' - ``` - The custom `session_id` value starts a new chat session between your client and the Langflow server, and can be useful in keeping conversations and AI context separate. + +```text +curl --request POST \ + --url "http://LANGFLOW_SERVER_ADDRESS/api/v1/run/FLOW_ID" \ + --header "Content-Type: application/json" \ + --header "x-api-key: LANGFLOW_API_KEY" \ + --data '{ + "input_value": "Whats the recommended way to install Docker on Mac M1", + "session_id": "docker-question-on-m1", + "output_type": "chat", + "input_type": "chat" +}' +``` +The custom `session_id` value starts a new chat session between your client and the Langflow server, and can be useful in keeping conversations and AI context separate. 5. Send the POST request. Your request is answered. 6. Navigate to the **Playground**. A new chat session called `docker-question-on-m1` has appeared, using your unique `session_id`. -7. To modify additional parameters with **Tweaks** for your **Chat Input** and **Chat Output** components, click **Publish**, and then click **API access**. -8. Click **Tweaks** to modify parameters in the component's `data` object. - For example, disabling storing messages from the **Chat Input** component adds a **Tweak** to your command: - ```text - curl --request POST \ - --url 'http://localhost:7860/api/v1/run/51eed711-4530-4fdc-9bce-5db4351cc73a?stream=false' \ - --header 'Content-Type: application/json' \ - --data '{ - "input_value": "Text to input to the flow", - "output_type": "chat", - "input_type": "chat", - "tweaks": { - "ChatInput-4WKag": { - "should_store_message": false - } - } - }' - ``` +7. To modify additional parameters with **Tweaks** for your **Chat Input** and **Chat Output** components, click **Share**, and then click **API access**. +8. Click **Input schema** to modify parameters in the component's `data` object. +For example, disabling storing messages from the **Chat Input** component adds a **Tweak** to your command: +```text +curl --request POST \ + --url "http://LANGFLOW_SERVER_ADDRESS/api/v1/run/FLOW_ID" \ + --header "Content-Type: application/json" \ + --header "x-api-key: LANGFLOW_API_KEY" \ + --data '{ + "input_value": "Text to input to the flow", + "output_type": "chat", + "input_type": "chat", + "tweaks": { + "ChatInput-4WKag": { + "should_store_message": false + } + } +}' +``` + +To confirm your command is using the tweak, navigate to the **Logs** pane and view the request from the **Chat Input** component. +The value for `should_store_message` is `false`. + +## See also - To confirm your command is using the tweak, navigate to the **Logs** pane and view the request from the **Chat Input** component. - The value for `should_store_message` is `false`. \ No newline at end of file +- [Session ID](/session-id) diff --git a/docs/docs/Components/components-processing.md b/docs/docs/Components/components-processing.md index 99061f51a857..991c0c03e90a 100644 --- a/docs/docs/Components/components-processing.md +++ b/docs/docs/Components/components-processing.md @@ -70,34 +70,35 @@ This component performs operations on [Data](/concepts-objects#data-object) obje All operations in the component require at least one [Data](/concepts-objects#data-object) input. 2. In the **Operations** field, select the operation you want to perform. For example, send this request to the **Webhook** component. -Replace `YOUR_FLOW_ID` with your flow ID. - ```bash - curl -X POST "http://127.0.0.1:7860/api/v1/webhook/YOUR_FLOW_ID" \ - -H 'Content-Type: application/json' \ - -d '{ - "id": 1, - "name": "Leanne Graham", - "username": "Bret", - "email": "Sincere@april.biz", - "address": { - "street": "Kulas Light", - "suite": "Apt. 556", - "city": "Gwenborough", - "zipcode": "92998-3874", - "geo": { - "lat": "-37.3159", - "lng": "81.1496" - } - }, - "phone": "1-770-736-8031 x56442", - "website": "hildegard.org", - "company": { - "name": "Romaguera-Crona", - "catchPhrase": "Multi-layered client-server neural-net", - "bs": "harness real-time e-markets" - } - }' - ``` +Replace `FLOW_ID` and `LANGFLOW_API_KEY` with the values from your deployment. +```bash +curl -X POST "http://localhost:7860/api/v1/webhook/FLOW_ID" \ +-H 'Content-Type: application/json' \ +-H 'x-api-key: LANGFLOW_API_KEY' \ +-d '{ + "id": 1, + "name": "Leanne Graham", + "username": "Bret", + "email": "Sincere@april.biz", + "address": { + "street": "Kulas Light", + "suite": "Apt. 556", + "city": "Gwenborough", + "zipcode": "92998-3874", + "geo": { + "lat": "-37.3159", + "lng": "81.1496" + } + }, + "phone": "1-770-736-8031 x56442", + "website": "hildegard.org", + "company": { + "name": "Romaguera-Crona", + "catchPhrase": "Multi-layered client-server neural-net", + "bs": "harness real-time e-markets" + } +}' +``` 3. In the **Data Operations** component, select the **Select Keys** operation to extract specific user information. To add additional keys, click **Add more**. @@ -176,17 +177,20 @@ Avoid punctuation in the **Instructions** field, as it can cause errors. 5. To run the flow, in the **Smart Filter** component, click