# Dify

> Run Dify apps and manage knowledge bases.

App · 20 actions. Web page: https://docs.lodol.com/docs/integrations/dify

## Actions

### Create knowledge base

Create knowledge base.

**Inputs**

- Name (`name`, text, required): Name of the knowledge base.
- Description (`description`, text): Description of the knowledge base.
- Indexing technique (`indexing_technique`, text): How Dify indexes the knowledge base. One of: `high_quality` (High quality), `economy`.

**Outputs**

- `data` (object): The response from Dify.

**Example output**

```json
{
  "data": {
    "id": "example",
    "name": "example"
  }
}
```

### Create text document

Create text document.

**Inputs**

- Dataset (`dataset_id`, text, required): Choose a knowledge base or enter its ID.
- Name (`name`, text, required): Name of the document.
- Text (`text`, text, required): Text to index.
- Indexing technique (`indexing_technique`, text): How Dify indexes the text. One of: `high_quality` (High quality), `economy`.
- Process rule (`process_rule`, object): Custom chunking rule.

**Outputs**

- `data` (object): The response from Dify.

**Example output**

```json
{
  "data": {
    "batch": "example",
    "document": {
      "id": "example",
      "name": "example"
    }
  }
}
```

### Delete document

Delete document.

**Inputs**

- Dataset (`dataset_id`, text, required): Choose a knowledge base or enter its ID.
- Document ID (`document_id`, text, required): Document ID to delete.

**Outputs**

- `data` (object): The response from Dify.

**Example output**

```json
{
  "data": {}
}
```

### Delete knowledge base

Delete knowledge base.

**Inputs**

- Dataset (`dataset_id`, text, required): Choose a knowledge base or enter its ID.

**Outputs**

- `data` (object): The response from Dify.

**Example output**

```json
{
  "data": {}
}
```

### Get app info

Get app info.

**Inputs**: None.

**Outputs**

- `data` (object): The response from Dify.

**Example output**

```json
{
  "data": {
    "mode": "example",
    "name": "example"
  }
}
```

### Get app parameters

Get app parameters.

**Inputs**: None.

**Outputs**

- `data` (object): The response from Dify.

**Example output**

```json
{
  "data": {}
}
```

### Get app settings

Get app settings.

**Inputs**: None.

**Outputs**

- `data` (object): The response from Dify.

**Example output**

```json
{
  "data": {
    "title": "example"
  }
}
```

### Get document

Get document.

**Inputs**

- Dataset (`dataset_id`, text, required): Choose a knowledge base or enter its ID.
- Document ID (`document_id`, text, required): Document ID from List documents.
- Metadata (`metadata`, text): Which metadata to return. One of: `all`, `only`, `without`.

**Outputs**

- `data` (object): The response from Dify.

**Example output**

```json
{
  "data": {
    "id": "example",
    "name": "example"
  }
}
```

### Get document indexing status

Get document indexing status.

**Inputs**

- Dataset (`dataset_id`, text, required): Choose a knowledge base or enter its ID.
- Batch (`batch`, text, required): Batch ID returned when the document was created.

**Outputs**

- `data` (object): The response from Dify.

**Example output**

```json
{
  "data": {
    "data": [
      {
        "id": "example",
        "indexing_status": "example"
      }
    ]
  }
}
```

### Get knowledge base

Get knowledge base.

**Inputs**

- Dataset (`dataset_id`, text, required): Choose a knowledge base or enter its ID.

**Outputs**

- `data` (object): The response from Dify.

**Example output**

```json
{
  "data": {
    "id": "example",
    "name": "example"
  }
}
```

### Get workflow run

Get workflow run.

**Inputs**

- Workflow run ID (`workflow_run_id`, text, required): Workflow run ID from Run workflow.

**Outputs**

- `data` (object): The response from Dify.

**Example output**

```json
{
  "data": {
    "id": "example",
    "outputs": {},
    "status": "example"
  }
}
```

### List conversation messages

List conversation messages.

**Inputs**

- End user (`end_user`, text, required): The same user identifier used to start the conversation.
- Conversation ID (`conversation_id`, text, required): Conversation ID.
- First ID (`first_id`, text): First message ID from the preceding page.
- Limit (`limit`, number): Messages per page. From 1 to 100.

**Outputs**

- `data` (object): The response from Dify.

**Example output**

```json
{
  "data": {
    "data": [
      {
        "answer": "example",
        "id": "example",
        "query": "example"
      }
    ],
    "has_more": true
  }
}
```

### List conversations

List conversations.

**Inputs**

- End user (`end_user`, text, required): The same user identifier used to start the conversation.
- Last ID (`last_id`, text): Last ID from the preceding page.
- Limit (`limit`, number): Conversations per page. From 1 to 100.
- Sort by (`sort_by`, text): Order to return conversations. One of: `created_at` (Created at), `-created_at` (-created at), `updated_at` (Updated at), `-updated_at` (-updated at).

**Outputs**

- `data` (object): The response from Dify.

**Example output**

```json
{
  "data": {
    "data": [
      {
        "id": "example",
        "name": "example"
      }
    ],
    "has_more": true
  }
}
```

### List document chunks

List document chunks.

**Inputs**

- Dataset (`dataset_id`, text, required): Choose a knowledge base or enter its ID.
- Document ID (`document_id`, text, required): Document ID from List documents.

**Outputs**

- `data` (object): The response from Dify.

**Example output**

```json
{
  "data": {
    "data": [
      {
        "content": "example",
        "id": "example"
      }
    ]
  }
}
```

### List documents

List documents.

**Inputs**

- Dataset (`dataset_id`, text, required): Choose a knowledge base or enter its ID.
- Page (`page`, number): Page number, starting at 1. At least 1.
- Limit (`limit`, number): Maximum number of records to return. From 1 to 100.
- Keyword (`keyword`, text): Search by document name.
- Status (`status`, text): Filter the documents by status. One of: `queuing`, `indexing`, `paused`, `error`, `available`, `disabled`, `archived`.

**Outputs**

- `data` (object): The response from Dify.

**Example output**

```json
{
  "data": {
    "data": [
      {
        "id": "example",
        "name": "example"
      }
    ],
    "has_more": true
  }
}
```

### List knowledge bases

List knowledge bases.

**Inputs**

- Page (`page`, number): Page number, starting at 1. At least 1.
- Limit (`limit`, number): Maximum number of records to return. From 1 to 100.
- Keyword (`keyword`, text): Search by name.

**Outputs**

- `data` (object): The response from Dify.

**Example output**

```json
{
  "data": {
    "data": [
      {
        "id": "example",
        "name": "example"
      }
    ],
    "has_more": true
  }
}
```

### List workflow logs

List workflow logs.

**Inputs**

- Page (`page`, number): Page number, starting at 1. At least 1.
- Limit (`limit`, number): Maximum number of records to return. From 1 to 100.
- Status (`status`, text): Filter by workflow outcome. One of: `succeeded`, `failed`, `stopped`.
- Keyword (`keyword`, text): Search the workflow logs.

**Outputs**

- `data` (object): The response from Dify.

**Example output**

```json
{
  "data": {
    "data": [
      {}
    ],
    "has_more": true
  }
}
```

### Run workflow

Run workflow.

**Inputs**

- End user (`end_user`, text, required): Stable identifier you use for the person in Dify.
- Inputs (`inputs`, object): Named inputs configured in the workflow.

**Outputs**

- `data` (object): The response from Dify.

**Example output**

```json
{
  "data": {
    "data": {
      "outputs": {},
      "status": "example"
    },
    "task_id": "example",
    "workflow_run_id": "example"
  }
}
```

### Send chat message

Send chat message.

**Inputs**

- End user (`end_user`, text, required): Stable identifier you use for the person in Dify.
- Query (`query`, text, required): Message to send.
- Inputs (`inputs`, object): Named inputs configured in the app.
- Conversation ID (`conversation_id`, text): Conversation ID to continue.

**Outputs**

- `data` (object): The response from Dify.

**Example output**

```json
{
  "data": {
    "answer": "example",
    "conversation_id": "example",
    "message_id": "example"
  }
}
```

### Update knowledge base

Update knowledge base.

**Inputs**

- Dataset (`dataset_id`, text, required): Choose a knowledge base or enter its ID.
- Name (`name`, text): New name.
- Description (`description`, text): New description.

**Outputs**

- `data` (object): The response from Dify.

**Example output**

```json
{
  "data": {
    "id": "example",
    "name": "example"
  }
}
```
