Back to Dify

OpenAPI

api/openapi/markdown/openapi-openapi.md

1.16.036.2 KB
Original Source

OpenAPI

User-scoped programmatic API (bearer auth)

Version: 1.0

Available authorizations

Bearer (HTTP, bearer)

Use the Service API key as a Bearer token in the Authorization header. Bearer format: API_KEY


openapi

User-scoped operations

[GET] /_health

Responses

CodeDescriptionSchema
200Health checkapplication/json: HealthResponse
defaultErrorapplication/json: ErrorBody

[GET] /_version

Responses

CodeDescriptionSchema
200Server versionapplication/json: ServerVersionResponse
defaultErrorapplication/json: ErrorBody

[GET] /account

Responses

CodeDescriptionSchema
200Account infoapplication/json: AccountResponse
defaultErrorapplication/json: ErrorBody

[GET] /account/sessions

Parameters

NameLocated inDescriptionRequiredSchema
limitqueryNointeger,
Default: 100
pagequeryNointeger,
Default: 1

Responses

CodeDescriptionSchema
200Session listapplication/json: SessionListResponse
422Validation errorapplication/json: ErrorBody
defaultErrorapplication/json: ErrorBody

[DELETE] /account/sessions/self

Responses

CodeDescriptionSchema
200Session revokedapplication/json: RevokeResponse
defaultErrorapplication/json: ErrorBody

[DELETE] /account/sessions/{session_id}

Parameters

NameLocated inDescriptionRequiredSchema
session_idpathYesstring

Responses

CodeDescriptionSchema
200Session revokedapplication/json: RevokeResponse
defaultErrorapplication/json: ErrorBody

[GET] /apps

Parameters

NameLocated inDescriptionRequiredSchema
limitqueryNointeger,
Default: 20
modequeryApp types the app usage face (get app) lists and filters. A curated subset of :class:AppMode: the real, user-facing app categories. Excludes runtime-only mode tags that are not standalone apps (rag-pipeline is a knowledge Pipeline; channel is unused) and the roster-owned agent type (surfaced through the roster, not this list). Members reference AppMode.*.value so the subset relationship is type-checked: dropping a member from AppMode breaks this at import. This is the single source for the listable set — params, filters, and the generated CLI whitelist all derive from it.Nostring,
Available values: "advanced-chat", "agent-chat", "chat", "completion", "workflow"
namequeryNostring
pagequeryNointeger,
Default: 1
workspace_idqueryYesstring

Responses

CodeDescriptionSchema
200App listapplication/json: AppListResponse
422Validation errorapplication/json: ErrorBody
defaultErrorapplication/json: ErrorBody

[GET] /apps/{app_id}

Parameters

NameLocated inDescriptionRequiredSchema
fieldsqueryNostring
app_idpathYesstring

Responses

CodeDescriptionSchema
200App descriptionapplication/json: AppDescribeResponse
422Validation errorapplication/json: ErrorBody
defaultErrorapplication/json: ErrorBody

[GET] /apps/{app_id}/dependencies:check

Parameters

NameLocated inDescriptionRequiredSchema
app_idpathYesstring

Responses

CodeDescriptionSchema
200Dependencies checkedapplication/json: CheckDependenciesResult
defaultErrorapplication/json: ErrorBody

[GET] /apps/{app_id}/dsl

Parameters

NameLocated inDescriptionRequiredSchema
include_secretqueryInclude encrypted secret values in the exported DSLNoboolean
workflow_idqueryExport a specific workflow version instead of the current draftNostring
app_idpathYesstring

Responses

CodeDescriptionSchema
200Export successfulapplication/json: AppDslExportResponse
422Validation errorapplication/json: ErrorBody
defaultErrorapplication/json: ErrorBody

[POST] /apps/{app_id}/files

Upload a file to use as an input variable when running the app

Parameters

NameLocated inDescriptionRequiredSchema
app_idpathYesstring

Responses

CodeDescriptionSchema
201File uploaded successfullyapplication/json: FileResponse
400Bad request — no file or filename missing
401Unauthorized — invalid or expired bearer token
413File too large
415Unsupported file type or blocked extension
defaultErrorapplication/json: ErrorBody

[GET] /apps/{app_id}/human-input-forms/{form_token}

Parameters

NameLocated inDescriptionRequiredSchema
app_idpathYesstring
form_tokenpathYesstring

Responses

CodeDescriptionSchema
200Form definitionapplication/json: HumanInputFormDefinitionResponse

[POST] /apps/{app_id}/human-input-forms/{form_token}:submit

Parameters

NameLocated inDescriptionRequiredSchema
app_idpathYesstring
form_tokenpathYesstring

Request Body

RequiredSchema
Yesapplication/json: HumanInputFormSubmitPayload

Responses

CodeDescriptionSchema
200Form submittedapplication/json: FormSubmitResponse
422Validation errorapplication/json: ErrorBody
defaultErrorapplication/json: ErrorBody

[GET] /apps/{app_id}/tasks/{task_id}/events

Parameters

NameLocated inDescriptionRequiredSchema
continue_on_pausequeryWhether to keep the event stream open on pauseNoboolean
include_state_snapshotqueryWhether to include workflow state snapshotsNoboolean
app_idpathYesstring
task_idpathYesstring

Responses

CodeDescriptionSchema
200SSE event streamapplication/json: EventStreamResponse

[POST] /apps/{app_id}/tasks/{task_id}:stop

Parameters

NameLocated inDescriptionRequiredSchema
app_idpathYesstring
task_idpathYesstring

Responses

CodeDescriptionSchema
200Task stoppedapplication/json: TaskStopResponse
defaultErrorapplication/json: ErrorBody

[POST] /apps/{app_id}:run

Parameters

NameLocated inDescriptionRequiredSchema
app_idpathYesstring

Request Body

RequiredSchema
Yesapplication/json: AppRunRequest

Responses

CodeDescriptionSchema
200Run result (SSE stream)application/json: EventStreamResponse
422Validation errorapplication/json: ErrorBody

[POST] /oauth/device/approve

Request Body

RequiredSchema
Yesapplication/json: DeviceMutateRequest

Responses

CodeDescriptionSchema
200Approvedapplication/json: DeviceMutateResponse

[POST] /oauth/device/code

Request Body

RequiredSchema
Yesapplication/json: DeviceCodeRequest

Responses

CodeDescriptionSchema
200Device code createdapplication/json: DeviceCodeResponse

[POST] /oauth/device/deny

Request Body

RequiredSchema
Yesapplication/json: DeviceMutateRequest

Responses

CodeDescriptionSchema
200Deniedapplication/json: DeviceMutateResponse

[GET] /oauth/device/lookup

Parameters

NameLocated inDescriptionRequiredSchema
user_codequeryYesstring

Responses

CodeDescriptionSchema
200Device lookup resultapplication/json: DeviceLookupResponse

[POST] /oauth/device/token

Request Body

RequiredSchema
Yesapplication/json: DevicePollRequest

Responses

CodeDescriptionSchema
200Device tokenapplication/json: DeviceTokenResponse

[GET] /permitted-external-apps

Parameters

NameLocated inDescriptionRequiredSchema
limitqueryNointeger,
Default: 20
modequeryApp types the app usage face (get app) lists and filters. A curated subset of :class:AppMode: the real, user-facing app categories. Excludes runtime-only mode tags that are not standalone apps (rag-pipeline is a knowledge Pipeline; channel is unused) and the roster-owned agent type (surfaced through the roster, not this list). Members reference AppMode.*.value so the subset relationship is type-checked: dropping a member from AppMode breaks this at import. This is the single source for the listable set — params, filters, and the generated CLI whitelist all derive from it.Nostring,
Available values: "advanced-chat", "agent-chat", "chat", "completion", "workflow"
namequeryNostring
pagequeryNointeger,
Default: 1

Responses

CodeDescriptionSchema
200Permitted external apps listapplication/json: PermittedExternalAppsListResponse
422Validation errorapplication/json: ErrorBody
defaultErrorapplication/json: ErrorBody

[GET] /permitted-external-apps/{app_id}

Parameters

NameLocated inDescriptionRequiredSchema
fieldsqueryNostring
app_idpathYesstring

Responses

CodeDescriptionSchema
200Permitted external app descriptionapplication/json: AppDescribeResponse
422Validation errorapplication/json: ErrorBody
defaultErrorapplication/json: ErrorBody

[GET] /workspaces

Responses

CodeDescriptionSchema
200Workspace listapplication/json: WorkspaceListResponse
defaultErrorapplication/json: ErrorBody

[GET] /workspaces/{workspace_id}

Parameters

NameLocated inDescriptionRequiredSchema
workspace_idpathYesstring

Responses

CodeDescriptionSchema
200Workspace detailapplication/json: WorkspaceDetailResponse
defaultErrorapplication/json: ErrorBody

[POST] /workspaces/{workspace_id}/apps/imports

Parameters

NameLocated inDescriptionRequiredSchema
workspace_idpathYesstring

Request Body

RequiredSchema
Yesapplication/json: AppDslImportPayload

Responses

CodeDescriptionSchema
200Import completedapplication/json: Import
202Import pending confirmationapplication/json: Import
400Import failedapplication/json: Import
422Validation errorapplication/json: ErrorBody
defaultErrorapplication/json: ErrorBody

[POST] /workspaces/{workspace_id}/apps/imports/{import_id}:confirm

Parameters

NameLocated inDescriptionRequiredSchema
import_idpathYesstring
workspace_idpathYesstring

Responses

CodeDescriptionSchema
200Import confirmedapplication/json: Import
400Import failedapplication/json: Import
defaultErrorapplication/json: ErrorBody

[GET] /workspaces/{workspace_id}/members

Parameters

NameLocated inDescriptionRequiredSchema
limitqueryNointeger,
Default: 20
pagequeryNointeger,
Default: 1
workspace_idpathYesstring

Responses

CodeDescriptionSchema
200Member listapplication/json: MemberListResponse
422Validation errorapplication/json: ErrorBody
defaultErrorapplication/json: ErrorBody

[POST] /workspaces/{workspace_id}/members

Parameters

NameLocated inDescriptionRequiredSchema
workspace_idpathYesstring

Request Body

RequiredSchema
Yesapplication/json: MemberInvitePayload

Responses

CodeDescriptionSchema
201Member invitedapplication/json: MemberInviteResponse
422Validation errorapplication/json: ErrorBody
defaultErrorapplication/json: ErrorBody

[DELETE] /workspaces/{workspace_id}/members/{member_id}

Parameters

NameLocated inDescriptionRequiredSchema
member_idpathYesstring
workspace_idpathYesstring

Responses

CodeDescriptionSchema
200Member removedapplication/json: MemberActionResponse
defaultErrorapplication/json: ErrorBody

[PATCH] /workspaces/{workspace_id}/members/{member_id}

Parameters

NameLocated inDescriptionRequiredSchema
member_idpathYesstring
workspace_idpathYesstring

Request Body

RequiredSchema
Yesapplication/json: MemberRoleUpdatePayload

Responses

CodeDescriptionSchema
200Role updatedapplication/json: MemberActionResponse
422Validation errorapplication/json: ErrorBody
defaultErrorapplication/json: ErrorBody

[POST] /workspaces/{workspace_id}:switch

Parameters

NameLocated inDescriptionRequiredSchema
workspace_idpathYesstring

Responses

CodeDescriptionSchema
200Workspace detailapplication/json: WorkspaceDetailResponse
defaultErrorapplication/json: ErrorBody

Schemas

AccountPayload

NameTypeDescriptionRequired
emailstringYes
idstringYes
namestringYes

AccountResponse

NameTypeDescriptionRequired
accountAccountPayloadNo
default_workspace_idstringNo
subject_emailstringNo
subject_issuerstringNo
subject_typestringYes
workspaces[ WorkspacePayload ],
Default:No

AppDescribeInfo

NameTypeDescriptionRequired
descriptionstringNo
idstringYes
is_agentbooleanNo
modestringYes
namestringYes
service_api_enabledbooleanYes
updated_atstringNo

AppDescribeQuery

?fields= allow-list for GET /apps/<id>.

Empty / omitted → all blocks. Unknown member → ValidationError → 422.

NameTypeDescriptionRequired
fieldsstringNo

AppDescribeResponse

NameTypeDescriptionRequired
infoAppDescribeInfoNo
input_schemaobjectNo
parametersobjectNo

AppDslExportQuery

Query parameters for GET /apps/<app_id>/dsl.

NameTypeDescriptionRequired
include_secretbooleanInclude encrypted secret values in the exported DSLNo
workflow_idstringExport a specific workflow version instead of the current draftNo

AppDslExportResponse

Export DSL response.

NameTypeDescriptionRequired
datastringDSL YAML stringYes

AppDslImportPayload

Request body for POST /workspaces/<workspace_id>/apps/imports.

NameTypeDescriptionRequired
app_idstringExisting app ID to overwrite (workflow/advanced-chat apps only)No
descriptionstringOverride the app description from the DSLNo
iconstringNo
icon_backgroundstringNo
icon_typestringNo
modestring,
Available values: "yaml-content", "yaml-url"Import mode: yaml-content or yaml-url
Enum: "yaml-content", "yaml-url"Yes
namestringOverride the app name from the DSLNo
yaml_contentstringInline YAML DSL string (required when mode is yaml-content)No
yaml_urlstringRemote URL to fetch YAML from (required when mode is yaml-url)No

AppInfo

NameTypeDescriptionRequired
descriptionstringNo
idstringYes
modestringYes
namestringYes

AppListQuery

mode is a closed enum of listable app types.

NameTypeDescriptionRequired
limitinteger,
Default: 20No
modeSupportedAppTypeNo
namestringNo
pageinteger,
Default: 1No
workspace_idstringYes

AppListResponse

NameTypeDescriptionRequired
data[ AppListRow ]Yes
has_morebooleanYes
limitintegerYes
pageintegerYes
totalintegerYes

AppListRow

NameTypeDescriptionRequired
descriptionstringNo
idstringYes
modeAppModeYes
namestringYes
updated_atstringNo
workspace_idstringNo
workspace_namestringNo

AppMode

NameTypeDescriptionRequired
AppModestring

AppRunRequest

NameTypeDescriptionRequired
auto_generate_nameboolean,
Default: trueNo
conversation_idstringNo
files[ object ]No
inputsobjectYes
querystringNo
workflow_idstringNo
workspace_idstringNo

CheckDependenciesResult

NameTypeDescriptionRequired
leaked_dependencies[ PluginDependency ]No

DeviceCodeRequest

NameTypeDescriptionRequired
client_idstringYes
device_labelstringYes

DeviceCodeResponse

NameTypeDescriptionRequired
device_codestringYes
expires_inintegerYes
intervalintegerYes
user_codestringYes
verification_uristringYes

DeviceLookupQuery

NameTypeDescriptionRequired
user_codestringYes

DeviceLookupResponse

NameTypeDescriptionRequired
client_idstringNo
expires_in_remainingintegerNo
validbooleanYes

DeviceMutateRequest

NameTypeDescriptionRequired
user_codestringYes

DeviceMutateResponse

NameTypeDescriptionRequired
statusstringYes

DevicePollRequest

NameTypeDescriptionRequired
client_idstringYes
device_codestringYes

DeviceTokenResponse

NameTypeDescriptionRequired
accountAccountPayloadNo
default_workspace_idstringNo
expires_atstringYes
subject_emailstringNo
subject_issuerstringNo
subject_typestring,
Available values: "account", "external_sso"Enum: "account", "external_sso"Yes
tokenstringYes
token_idstringYes
workspaces[ WorkspacePayload ],
Default:No

DslImportWarning

Portable DSL reference that could not be restored in the target workspace.

NameTypeDescriptionRequired
codestringYes
detailsobjectNo
messagestringYes
pathstringYes

ErrorBody

Canonical non-2xx body. code is typed str (not the enum) so the generated client schema stays an open enum — old CLIs keep parsing when a future server adds a code. Formatter tests pin emitted values to the enum.

NameTypeDescriptionRequired
codestringYes
details[ ErrorDetail ]No
hintstringNo
messagestringYes
statusintegerYes

ErrorDetail

NameTypeDescriptionRequired
loc[ string
integer ]No
msgstringYes
typestringYes

EventStreamResponse

NameTypeDescriptionRequired
EventStreamResponsestring

FileResponse

NameTypeDescriptionRequired
conversation_idstringNo
created_atintegerNo
created_bystringNo
extensionstringNo
file_keystringNo
idstringYes
mime_typestringNo
namestringYes
original_urlstringNo
preview_urlstringNo
referencestringNo
sizeintegerYes
source_urlstringNo
tenant_idstringNo
user_idstringNo

FormSubmitResponse

Empty 200 body for POST /apps/<id>/human-input-forms/<token>:submit. extra='forbid' pins additionalProperties: false so the generated contract is an exact {} rather than an under-annotated open object.

NameTypeDescriptionRequired

Github

NameTypeDescriptionRequired
github_plugin_unique_identifierstringYes
packagestringYes
repostringYes
versionstringYes

HealthResponse

Liveness payload for GET /openapi/v1/_health — no auth required.

NameTypeDescriptionRequired
okbooleanYes

HumanInputFormDefinitionResponse

NameTypeDescriptionRequired
expiration_timeintegerNo
form_contentstringYes
inputs[ object ]No
resolved_default_valuesobjectYes
user_actions[ object ]No

HumanInputFormSubmitPayload

NameTypeDescriptionRequired
actionstringID of the action button the recipient selected. Must match one of the id values from the form's user_actions list.Yes
inputsobjectSubmitted human input values keyed by output variable name. Use a string for paragraph or select input values, a file mapping for file inputs, and a list of file mappings for file-list inputs. Local file mappings use transfer_method=local_file with upload_file_id; remote file mappings use transfer_method=remote_url with url or remote_url.Yes

Import

NameTypeDescriptionRequired
app_idstringNo
app_modestringNo
current_dsl_versionstring,
Default: 0.7.0No
errorstringNo
idstringYes
imported_dsl_versionstringNo
permission_keys[ string ]No
statusImportStatusYes
warnings[ DslImportWarning ]No

ImportStatus

NameTypeDescriptionRequired
ImportStatusstring

JsonValue

NameTypeDescriptionRequired
JsonValue

Marketplace

NameTypeDescriptionRequired
marketplace_plugin_unique_identifierstringYes
versionstringNo

MemberActionResponse

NameTypeDescriptionRequired
resultstring,
Default: successNo

MemberInvitePayload

NameTypeDescriptionRequired
emailstringYes
rolestring,
Available values: "admin", "normal"Enum: "admin", "normal"Yes

MemberInviteResponse

NameTypeDescriptionRequired
emailstringYes
invite_urlstringYes
member_idstringYes
resultstring,
Default: successNo
rolestringYes
tenant_idstringYes

MemberListQuery

Strict (extra='forbid').

NameTypeDescriptionRequired
limitinteger,
Default: 20No
pageinteger,
Default: 1No

MemberListResponse

NameTypeDescriptionRequired
data[ MemberResponse ]Yes
has_morebooleanYes
limitintegerYes
pageintegerYes
totalintegerYes

MemberResponse

NameTypeDescriptionRequired
avatarstringNo
emailstringYes
idstringYes
namestringYes
rolestringYes
statusstringYes

MemberRoleUpdatePayload

NameTypeDescriptionRequired
rolestring,
Available values: "admin", "normal"Enum: "admin", "normal"Yes

MessageMetadata

NameTypeDescriptionRequired
retriever_resources[ object ],
Default:No
usageUsageInfoNo

OpenApiErrorCode

NameTypeDescriptionRequired
OpenApiErrorCodestring

Package

NameTypeDescriptionRequired
plugin_unique_identifierstringYes
versionstringNo

PermittedExternalAppsListQuery

Strict (extra='forbid').

NameTypeDescriptionRequired
limitinteger,
Default: 20No
modeSupportedAppTypeNo
namestringNo
pageinteger,
Default: 1No

PermittedExternalAppsListResponse

NameTypeDescriptionRequired
data[ AppListRow ]Yes
has_morebooleanYes
limitintegerYes
pageintegerYes
totalintegerYes

PluginDependency

NameTypeDescriptionRequired
current_identifierstringNo
typePluginDependencyTypeYes
valueGithub
Marketplace
PackageYes

PluginDependencyType

NameTypeDescriptionRequired
PluginDependencyTypestring

RevokeResponse

NameTypeDescriptionRequired
statusstringYes

ServerVersionResponse

Meta endpoint payload for GET /openapi/v1/_version — no auth required.

NameTypeDescriptionRequired
editionstring,
Available values: "CLOUD", "SELF_HOSTED"Enum: "CLOUD", "SELF_HOSTED"Yes
versionstringYes

SessionListQuery

Pagination for GET /account/sessions. Strict (extra='forbid').

NameTypeDescriptionRequired
limitinteger,
Default: 100No
pageinteger,
Default: 1No

SessionListResponse

NameTypeDescriptionRequired
data[ SessionRow ]Yes
has_morebooleanYes
limitintegerYes
pageintegerYes
totalintegerYes

SessionRow

NameTypeDescriptionRequired
client_idstringYes
created_atstringNo
device_labelstringYes
expires_atstringNo
idstringYes
last_used_atstringNo
prefixstringYes

SimpleResultResponse

NameTypeDescriptionRequired
resultstringYes

SupportedAppType

App types the app usage face (get app) lists and filters.

A curated subset of :class:AppMode: the real, user-facing app categories. Excludes runtime-only mode tags that are not standalone apps (rag-pipeline is a knowledge Pipeline; channel is unused) and the roster-owned agent type (surfaced through the roster, not this list).

Members reference AppMode.*.value so the subset relationship is type-checked: dropping a member from AppMode breaks this at import. This is the single source for the listable set — params, filters, and the generated CLI whitelist all derive from it.

NameTypeDescriptionRequired
SupportedAppTypestringApp types the app usage face (get app) lists and filters. A curated subset of :class:AppMode: the real, user-facing app categories. Excludes runtime-only mode tags that are not standalone apps (rag-pipeline is a knowledge Pipeline; channel is unused) and the roster-owned agent type (surfaced through the roster, not this list). Members reference AppMode.*.value so the subset relationship is type-checked: dropping a member from AppMode breaks this at import. This is the single source for the listable set — params, filters, and the generated CLI whitelist all derive from it.

TaskStopResponse

200 body for POST /apps/<id>/tasks/<task_id>:stop. The handler always returns {"result": "success"}, so result is required (no default) — the generated contract types it as a required 'success' rather than an optional field.

NameTypeDescriptionRequired
resultstringYes

UsageInfo

NameTypeDescriptionRequired
completion_tokensintegerNo
prompt_tokensintegerNo
total_tokensintegerNo

WorkflowRunData

NameTypeDescriptionRequired
created_atintegerNo
elapsed_timenumberNo
errorstringNo
finished_atintegerNo
idstringYes
outputsobjectNo
statusstringYes
total_stepsintegerNo
total_tokensintegerNo
workflow_idstringYes

WorkspaceDetailResponse

NameTypeDescriptionRequired
created_atstringNo
currentbooleanYes
idstringYes
namestringYes
rolestringYes
statusstringYes

WorkspaceListResponse

NameTypeDescriptionRequired
workspaces[ WorkspaceSummaryResponse ]Yes

WorkspacePayload

NameTypeDescriptionRequired
idstringYes
namestringYes
rolestringYes

WorkspaceSummaryResponse

NameTypeDescriptionRequired
currentbooleanYes
idstringYes
namestringYes
rolestringYes
statusstringYes