Last active
July 17, 2024 08:06
-
-
Save mizphses/90897d3feed093904e929a581efb1410 to your computer and use it in GitHub Desktop.
Dify's OpenAPI Schema. The author allow to use this spec under the MIT license. (c)2024 mizphses(Fuminori Ogawa)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
openapi: 3.0.0 | |
info: | |
title: Dify API | |
version: 1.0.0 | |
description: Dify Cloudで作ったアプリのAPIスキーマ | |
contact: | |
name: mizphses | |
email: mizphses@gmail.com | |
servers: | |
- url: https://api.dify.ai/v1 | |
description: Prodction | |
paths: | |
/chat-messages: | |
post: | |
summary: Send a message to Dify | |
description: Endpoint to send a message to Dify. | |
operationId: sendMessage | |
tags: | |
- Chat | |
requestBody: | |
required: true | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/chatInputSchema' | |
responses: | |
'200': | |
description: OK | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/chatReturnBlock' | |
'400': | |
description: Bad Request | |
'401': | |
description: Unauthorized | |
'403': | |
description: Forbidden | |
'404': | |
description: Not Found | |
'500': | |
description: Internal Server Error | |
/chat-messages/{task_id}/stop: | |
post: | |
summary: Stop a task | |
description: Endpoint to stop a task. | |
operationId: stopTask | |
tags: | |
- Chat | |
parameters: | |
- name: task_id | |
in: path | |
description: The task id | |
required: true | |
schema: | |
type: string | |
responses: | |
'200': | |
description: OK | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/successReturn' | |
'400': | |
description: Bad Request | |
'401': | |
description: Unauthorized | |
'403': | |
description: Forbidden | |
'404': | |
description: Not Found | |
'500': | |
description: Internal Server Error | |
/messages/{message_id}/feedbacks: | |
post: | |
summary: Send a feedback | |
description: Endpoint to send a feedback. | |
operationId: sendFeedback | |
tags: | |
- Chat | |
parameters: | |
- name: message_id | |
in: path | |
description: The message id | |
required: true | |
schema: | |
type: string | |
requestBody: | |
required: true | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/evaluationInputSchema' | |
responses: | |
'200': | |
description: OK | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/successReturn' | |
'400': | |
description: Bad Request | |
'401': | |
description: Unauthorized | |
'403': | |
description: Forbidden | |
'404': | |
description: Not Found | |
'500': | |
description: Internal Server Error | |
/messages/{message_id}/suggested: | |
get: | |
summary: Get suggested messages | |
description: Endpoint to get suggested messages. | |
operationId: getSuggestedMessages | |
tags: | |
- Chat | |
parameters: | |
- name: message_id | |
in: path | |
description: The message id | |
required: true | |
schema: | |
type: string | |
- name: user | |
in: query | |
description: The user id | |
schema: | |
type: string | |
responses: | |
'200': | |
description: OK | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/suggestNextMessageReturn' | |
'400': | |
description: Bad Request | |
'401': | |
description: Unauthorized | |
'403': | |
description: Forbidden | |
'404': | |
description: Not Found | |
'500': | |
description: Internal Server Error | |
/messages: | |
get: | |
summary: Get messages | |
description: Endpoint to get messages. | |
operationId: getMessages | |
tags: | |
- Chat | |
parameters: | |
- name: user | |
in: query | |
description: The user id | |
schema: | |
type: string | |
- name: conversation_id | |
in: query | |
description: The conversation id | |
schema: | |
type: string | |
- name: limit | |
in: query | |
description: The limit | |
schema: | |
type: integer | |
- name: offset | |
in: query | |
description: The offset | |
schema: | |
type: integer | |
responses: | |
'200': | |
description: OK | |
content: | |
application/json: | |
schema: | |
type: array | |
items: | |
$ref: '#/components/schemas/talkHistoryReturn' | |
'400': | |
description: Bad Request | |
'401': | |
description: Unauthorized | |
'403': | |
description: Forbidden | |
'404': | |
description: Not Found | |
'500': | |
description: Internal Server Error | |
/conversations: | |
get: | |
summary: Get conversations | |
description: Endpoint to get conversations. | |
operationId: getConversations | |
tags: | |
- Chat | |
parameters: | |
- name: user | |
in: query | |
description: The user id | |
schema: | |
type: string | |
- name: limit | |
in: query | |
description: The limit | |
schema: | |
type: integer | |
- name: last_id | |
in: query | |
description: The last id | |
schema: | |
type: string | |
responses: | |
'200': | |
description: OK | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/getConversationReturn' | |
'400': | |
description: Bad Request | |
'401': | |
description: Unauthorized | |
'403': | |
description: Forbidden | |
'404': | |
description: Not Found | |
'500': | |
description: Internal Server Error | |
/conversation/{conversation_id}: | |
delete: | |
summary: Delete a conversation | |
description: Endpoint to delete a conversation. | |
operationId: deleteConversation | |
tags: | |
- Chat | |
parameters: | |
- name: conversation_id | |
in: path | |
description: The conversation id | |
required: true | |
schema: | |
type: string | |
responses: | |
'200': | |
description: OK | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/successReturn' | |
'400': | |
description: Bad Request | |
'401': | |
description: Unauthorized | |
'403': | |
description: Forbidden | |
'404': | |
description: Not Found | |
'500': | |
description: Internal Server Error | |
/conversations/{conversation_id}/name: | |
post: | |
summary: Rename a conversation | |
description: Endpoint to rename a conversation. | |
operationId: renameConversation | |
tags: | |
- Chat | |
parameters: | |
- name: conversation_id | |
in: path | |
description: The conversation id | |
required: true | |
schema: | |
type: string | |
requestBody: | |
required: true | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/renameConversationInput' | |
responses: | |
'200': | |
description: OK | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/renameConversationReturn' | |
'400': | |
description: Bad Request | |
'401': | |
description: Unauthorized | |
'403': | |
description: Forbidden | |
'404': | |
description: Not Found | |
'500': | |
description: Internal Server Error | |
/files/upload: | |
post: | |
summary: Upload a file | |
description: Endpoint to upload a file to Dify. | |
operationId: uploadFile | |
tags: | |
- Files | |
requestBody: | |
required: true | |
content: | |
multipart/form-data: | |
schema: | |
$ref: '#/components/schemas/fileInputSchema' | |
responses: | |
'200': | |
description: OK | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/fileReturnSchema' | |
'400': | |
description: Bad Request | |
'401': | |
description: Unauthorized | |
'403': | |
description: Forbidden | |
'404': | |
description: Not Found | |
'500': | |
description: Internal Server Error | |
/audio-to-text: | |
post: | |
summary: Convert audio to text | |
description: Endpoint to convert audio to text. | |
operationId: audioToText | |
tags: | |
- Files | |
requestBody: | |
required: true | |
content: | |
multipart/form-data: | |
schema: | |
$ref: '#/components/schemas/s2tInputSchema' | |
responses: | |
'200': | |
description: OK | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/s2tReturnSchema' | |
'400': | |
description: Bad Request | |
'401': | |
description: Unauthorized | |
'403': | |
description: Forbidden | |
'404': | |
description: Not Found | |
'500': | |
description: Internal Server Error | |
/text-to-audio: | |
post: | |
summary: Convert text to audio | |
description: Endpoint to convert text to audio. | |
operationId: textToAudio | |
tags: | |
- Files | |
requestBody: | |
required: true | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/t2sRequest' | |
responses: | |
'200': | |
description: OK | |
content: | |
audio/wav: | |
schema: | |
type: string | |
format: binary | |
'400': | |
description: Bad Request | |
'401': | |
description: Unauthorized | |
'403': | |
description: Forbidden | |
'404': | |
description: Not Found | |
'500': | |
description: Internal Server Error | |
components: | |
schemas: | |
fileInputSchema: | |
type: object | |
properties: | |
file: | |
type: string | |
format: binary | |
user: | |
type: string | |
fileReturnSchema: | |
type: object | |
properties: | |
id: | |
type: string | |
name: | |
type: string | |
size: | |
type: integer | |
extension: | |
type: string | |
mime_type: | |
type: string | |
created_by: | |
type: string | |
created_at: | |
type: integer | |
chatInputSchema: | |
type: object | |
properties: | |
inputs: | |
type: object | |
query: | |
type: string | |
response_mode: | |
type: string | |
conversation_id: | |
type: string | |
user: | |
type: string | |
files: | |
type: array | |
items: | |
type: object | |
properties: | |
type: | |
type: string | |
transfer_method: | |
type: string | |
url: | |
type: string | |
s2tInputSchema: | |
type: object | |
properties: | |
file: | |
type: string | |
format: binary | |
s2tReturnSchema: | |
type: object | |
properties: | |
text: | |
type: string | |
chatReturnBlock: | |
type: object | |
properties: | |
event: | |
type: string | |
message_id: | |
type: string | |
conversation_id: | |
type: string | |
mode: | |
type: string | |
answer: | |
type: string | |
metadata: | |
type: object | |
properties: | |
usage: | |
type: object | |
properties: | |
prompt_tokens: | |
type: integer | |
prompt_unit_price: | |
type: string | |
prompt_price_unit: | |
type: string | |
prompt_price: | |
type: string | |
completion_tokens: | |
type: integer | |
completion_unit_price: | |
type: string | |
completion_price_unit: | |
type: string | |
completion_price: | |
type: string | |
total_tokens: | |
type: integer | |
total_price: | |
type: string | |
currency: | |
type: string | |
latency: | |
type: number | |
retriever_resources: | |
type: array | |
items: | |
type: object | |
properties: | |
position: | |
type: integer | |
dataset_id: | |
type: string | |
dataset_name: | |
type: string | |
document_id: | |
type: string | |
document_name: | |
type: string | |
segment_id: | |
type: string | |
score: | |
type: number | |
content: | |
type: string | |
created_at: | |
type: integer | |
successReturn: | |
type: object | |
properties: | |
result: | |
type: string | |
example: "success" | |
evaluationInputSchema: | |
type: object | |
properties: | |
rating: | |
type: string | |
example: "like" | |
user: | |
type: string | |
suggestNextMessageReturn: | |
type: object | |
properties: | |
result: | |
type: string | |
example: "success" | |
data: | |
type: array | |
items: | |
type: string | |
example: ["a", "b", "c"] | |
talkHistoryReturn: | |
type: object | |
properties: | |
limit: | |
type: integer | |
has_more: | |
type: boolean | |
data: | |
type: array | |
items: | |
type: object | |
properties: | |
id: | |
type: string | |
conversation_id: | |
type: string | |
inputs: | |
type: object | |
query: | |
type: string | |
answer: | |
type: string | |
message_files: | |
type: array | |
feedback: | |
type: string | |
retriever_resources: | |
type: array | |
items: | |
type: object | |
properties: | |
position: | |
type: integer | |
dataset_id: | |
type: string | |
dataset_name: | |
type: string | |
document_id: | |
type: string | |
document_name: | |
type: string | |
segment_id: | |
type: string | |
score: | |
type: number | |
content: | |
type: string | |
created_at: | |
type: integer | |
getConversationReturn: | |
type: object | |
properties: | |
limit: | |
type: integer | |
has_more: | |
type: boolean | |
data: | |
type: array | |
items: | |
type: object | |
properties: | |
id: | |
type: string | |
name: | |
type: string | |
inputs: | |
type: object | |
status: | |
type: string | |
created_at: | |
type: integer | |
renameConversationInput: | |
type: object | |
properties: | |
name: | |
type: string | |
renameConversationReturn: | |
type: object | |
properties: | |
id: | |
type: string | |
name: | |
type: string | |
inputs: | |
type: object | |
created_at: | |
type: integer | |
t2sRequest: | |
type: object | |
properties: | |
text: | |
type: string | |
user: | |
type: string | |
streaming: | |
type: boolean | |
securitySchemes: | |
bearerAuth: | |
type: http | |
scheme: bearer |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment