Before you start, make sure difyctl is installed.
On a self-hosted deployment, set both OPENAPI_ENABLED and ENABLE_OAUTH_BEARER to true before you sign in. See Dify CLI and Programmatic API for the full variable reference.
Step 1: Sign In#
-
Sign in to your Dify host.
For Dify Cloud, use
https://cloud.dify.ai; on a self-hosted deployment, use the console API URL.difyctlprints a one-time code and a verification URL, then waits: -
Open the URL in a browser, enter the code, and sign in. Return to the terminal and you’ll see:
Step 2: Find Your App#
List the apps in your workspace:
You should see something like this:
Copy the ID of the app you want to run. The examples below use the two IDs from this table.
Step 3: Run Your App#
How you pass input depends on the app type.
Pass your message as a positional argument:
The reply prints to stdout. For Chatbot, Chatflow, and Agent apps, a hint also prints to stderr so you can continue the same conversation later:
Pass inputs as a single JSON object with --inputs:
The workflow’s outputs print to stdout as JSON:
Next Steps#
- The everyday commands, copy-paste ready: Common Tasks
- Where your token lives and how sessions work: Authenticate
- Everything else you can do with
difyctl: Command Index