Skip to content

API Documentation

Access Refly open capabilities via API, such as running workflows and fetching status/output.

Base URL: /v1

Overview

Refly API provides RESTful endpoints for programmatically running workflows, uploading files, querying execution status, and more. All API requests require authentication via API Key.

Authentication

All API requests require an API Key in the HTTP header for authentication.\n\nHow to get an API Key:\n1. Go to the Integration page in Refly workspace\n2. Click the "API Key" tab\n3. Create a new API Key and keep it secure

Authorization: Bearer YOUR_API_KEY

Endpoints

The following endpoints are available for integration.

Workflow

POST /openapi/workflow/{canvasId}/run

Run workflow

Execute a workflow via authenticated API call. Unlike webhook triggers, this endpoint requires API Key authentication and returns an execution ID that can be used to track workflow status.

Parameters

NameInTypeRequiredDescription
canvasIdpathstringYesCanvas/Workflow ID (from the canvas URL in the browser address bar)

Request Body

Wrap workflow variables under the variables field.

Each key in variables is a workflow variable name. Values can be strings, numbers, booleans, objects, or arrays.

For file variables, pass fileKey (or an array of fileKey) returned by /openapi/files/upload.

For backward compatibility, you may also pass variables as top-level fields, but variables is recommended.

Request Body Fields

NameTypeRequiredDescription
variablesobjectNoWorkflow variables as key-value pairs. Each key is a workflow variable name. Values can be strings, numbers, booleans, objects, or arrays. For file variables, pass fileKey (or an array of fileKey) returned by /openapi/files/upload.

Request Body Example

json
{}

Responses

StatusDescription
200Workflow execution started successfully
400Invalid request parameters
401Unauthorized - invalid or missing API key
403Workflow API is disabled
404Workflow not found

Response Fields (200)

NameTypeRequiredDescription
successbooleanYesWhether the operation was successful
errCodestringNoError code
errMsgstringNoError message
traceIdstringNoTrace ID
stackstringNoError stack (only returned in development environment)
dataobjectNo-
data.executionIdstringNoWorkflow execution ID
data.statusenum(init | executing | finish | failed)No-

POST /openapi/workflow/{executionId}/abort

Abort workflow execution

Abort a running workflow execution via authenticated API call. Requires API Key authentication.

Parameters

NameInTypeRequiredDescription
executionIdpathstringYesWorkflow execution ID (from run response or status endpoint)

Responses

StatusDescription
200Workflow abort request accepted
401Unauthorized - invalid or missing API key
404Workflow execution not found

Response Fields (200)

NameTypeRequiredDescription
successbooleanYesWhether the operation was successful
errCodestringNoError code
errMsgstringNoError message
traceIdstringNoTrace ID
stackstringNoError stack (only returned in development environment)

GET /openapi/workflow/{executionId}/output

Get workflow execution output

Get workflow execution output (output nodes and drive files) via authenticated API call. Requires API Key authentication. Messages may include partial content while nodes are executing or failed. Files are returned only after nodes finish.

Parameters

NameInTypeRequiredDescription
executionIdpathstringYesWorkflow execution ID

Responses

StatusDescription
200Workflow execution output retrieved successfully
401Unauthorized - invalid or missing API key
404Workflow execution not found

Response Fields (200)

NameTypeRequiredDescription
successbooleanYesWhether the operation was successful
errCodestringNoError code
errMsgstringNoError message
traceIdstringNoTrace ID
stackstringNoError stack (only returned in development environment)
dataobjectNo-
data.outputobject[]NoOutput node results
data.output[].nodeIdstringYesNode ID
data.output[].titlestringNoNode title
data.output[].statusenum(init | waiting | executing | finish | failed)NoAction status
data.output[].errorMessagestringNoNode error message
data.output[].startTimestring(date-time)NoNode start time
data.output[].endTimestring(date-time)NoNode end time
data.output[].messagesobject[]NoOutput messages
data.output[].messages[].messageIdstringYesMessage ID
data.output[].messages[].contentstringNoMessage content
data.output[].messages[].reasoningContentstringNoMessage reasoning content
data.output[].messages[].typeenum(ai | tool)YesAction message type
data.filesobject[]NoOutput files
data.files[].namestringYesFile name
data.files[].typestringYesFile type
data.files[].sizenumberNoFile size
data.files[].nodeIdstringNoNode ID that produced the file
data.files[].urlstringNoFile access URL

GET /openapi/workflow/{executionId}/status

Get workflow execution status

Get workflow execution status via authenticated API call. Requires API Key authentication.

Parameters

NameInTypeRequiredDescription
executionIdpathstringYesWorkflow execution ID

Responses

StatusDescription
200Workflow execution status retrieved successfully
401Unauthorized - invalid or missing API key
404Workflow execution not found

Response Fields (200)

NameTypeRequiredDescription
successbooleanYesWhether the operation was successful
errCodestringNoError code
errMsgstringNoError message
traceIdstringNoTrace ID
stackstringNoError stack (only returned in development environment)
dataobjectNo-
data.executionIdstringNoWorkflow execution ID
data.statusenum(init | executing | finish | failed)No-
data.nodeExecutionsobject[]NoNode execution status list
data.nodeExecutions[].nodeIdstringYesNode ID
data.nodeExecutions[].statusenum(init | waiting | executing | finish | failed)NoAction status
data.nodeExecutions[].titlestringNoNode title
data.nodeExecutions[].errorMessagestringNoNode error message
data.createdAtstring(date-time)NoCreated time

GET /openapi/workflows

Search workflows

Search workflows accessible by this API key.

Parameters

NameInTypeRequiredDescription
keywordquerystringNoKeyword to search in workflow titles
orderquerystringNoSort order
pagequerynumberNoPage number (1-based)
pageSizequerynumberNoNumber of items per page

Responses

StatusDescription
200Workflow list retrieved successfully
401Unauthorized - invalid or missing API key

Response Fields (200)

NameTypeRequiredDescription
successbooleanYesWhether the operation was successful
errCodestringNoError code
errMsgstringNoError message
traceIdstringNoTrace ID
stackstringNoError stack (only returned in development environment)
dataobject[]NoWorkflow search results
data[].canvasIdstringYesCanvas/Workflow ID
data[].titlestringYesWorkflow title

GET /openapi/workflows/

Get workflow detail

Get workflow details and workflow plan by canvas ID.

Parameters

NameInTypeRequiredDescription
canvasIdpathstringYesCanvas/Workflow ID

Responses

StatusDescription
200Workflow detail retrieved successfully
401Unauthorized - invalid or missing API key
404Workflow not found

Response Fields (200)

NameTypeRequiredDescription
successbooleanYesWhether the operation was successful
errCodestringNoError code
errMsgstringNoError message
traceIdstringNoTrace ID
stackstringNoError stack (only returned in development environment)
dataobjectNo-
data.titlestringYesWorkflow plan title
data.tasksobject[]YesWorkflow tasks
data.tasks[].idstringYesTask ID
data.tasks[].titlestringYesTask title
data.tasks[].promptstringYesTask prompt/instruction
data.tasks[].toolsetsstring[]YesToolsets selected for this task
data.tasks[].dependentTasksstring[]NoDependent task IDs
data.variablesobject[]NoWorkflow variables
data.variables[].namestringYesVariable name
data.variables[].variableTypeenum(string | option | resource)NoVariable type
data.variables[].requiredbooleanNoWhether the variable is required
data.variables[].optionsstring[]NoVariable options (only for option type)

Files

POST /openapi/files/upload

Upload files for workflow variables

Upload files and return fileKey values. Unused files are cleaned up after about 24 hours.

Request Body

Files to upload for workflow variables.

Request Body Fields

NameTypeRequiredDescription
filesstring(binary)[]YesFiles to upload

Request Body Example

json
{
  "files": [
    "string"
  ]
}

Responses

StatusDescription
200Files uploaded successfully
400Invalid request parameters
401Unauthorized - invalid or missing API key

Response Fields (200)

NameTypeRequiredDescription
successbooleanYesWhether the operation was successful
errCodestringNoError code
errMsgstringNoError message
traceIdstringNoTrace ID
stackstringNoError stack (only returned in development environment)
dataobjectNo-
data.filesobject[]YesUploaded files
data.files[].fileKeystringYesFile key
data.files[].fileNamestringYesFile name

Copilot

POST /openapi/copilot/workflow/generate

Generate workflow via Copilot

Generate a workflow plan from a natural language prompt. If canvasId is provided, the workflow on that canvas will be overwritten and cannot be undone.

Request Body

Copilot workflow generation request.

Request Body Fields

NameTypeRequiredDescription
querystringYesNatural language prompt describing the desired workflow (supports multiple languages).
canvasIdstringNoOptional canvas ID to overwrite. This will replace the existing workflow and cannot be undone.
localestringNoOutput locale. Supported: en, zh-CN, ja, zh-Hant, fr, de-DE, ko, hi, es, ru, de, it, tr, pt, vi, id, th, ar, mn, fa.

Request Body Example

json
{
  "query": "生成一个客户反馈分析工作流",
  "locale": "zh-CN"
}

Responses

StatusDescription
200Workflow generated successfully
400Request failed or invalid parameters (response may include modelResponse)
401Unauthorized - invalid or missing API key
404Canvas not found

Response Fields (200)

NameTypeRequiredDescription
successbooleanYesWhether the operation was successful
errCodestringNoError code
errMsgstringNoError message
traceIdstringNoTrace ID
stackstringNoError stack (only returned in development environment)
dataobjectNo-
data.canvasIdstringNoCanvas/Workflow ID
data.workflowPlanobjectNo-
data.workflowPlan.titlestringYesWorkflow plan title
data.workflowPlan.tasksobject[]YesWorkflow tasks
data.workflowPlan.tasks[].idstringYesTask ID
data.workflowPlan.tasks[].titlestringYesTask title
data.workflowPlan.tasks[].promptstringYesTask prompt/instruction
data.workflowPlan.tasks[].toolsetsstring[]YesToolsets selected for this task
data.workflowPlan.tasks[].dependentTasksstring[]NoDependent task IDs
data.workflowPlan.variablesobject[]NoWorkflow variables
data.workflowPlan.variables[].namestringYesVariable name
data.workflowPlan.variables[].variableTypeenum(string | option | resource)NoVariable type
data.workflowPlan.variables[].requiredbooleanNoWhether the variable is required
data.workflowPlan.variables[].optionsstring[]NoVariable options (only for option type)

Response Fields (400)

NameTypeRequiredDescription
statusCodenumberYesHTTP status code
messagestringYesReadable error message
errorstringYesError type
modelResponsestringNoOriginal AI response (may be empty, length-limited)

Error Codes

Common error codes for webhook and API integrations.

Error CodeHTTP StatusMessageDescription
CANVAS_NOT_FOUND404Canvas not foundAssociated canvas cannot be found.
E0000-An unknown error has occurred. Please try again later.An unknown error has occurred. Please try again later.
E0001-Cannot connect to the server, please try again later.Cannot connect to the server, please try again later.
E0003-System parameter error. Please try again later.System parameter error. Please try again later.
E0004-Authorization process failed, please try againAuthorization process failed, please try again
E0005-Account not found, please sign upAccount not found, please sign up
E0006-Password incorrect, please try againPassword incorrect, please try again
E0007-Email already registered, please sign in or try another oneEmail already registered, please sign in or try another one
E0008-Verification session not found or expired, please try againVerification session not found or expired, please try again
E0009-Verification code is incorrect, please try againVerification code is incorrect, please try again
E0010-Operation too frequent, please try again laterOperation too frequent, please try again later
E0011-Human verification failed, please try againHuman verification failed, please try again
E0012-Authentication expired, please sign in againAuthentication expired, please sign in again
E0013-This file type is temporarily not supportedThis file type is temporarily not supported
E0014-Switching embedding model is not supported temporarilySwitching embedding model is not supported temporarily
E0015-Chat model not configured, please configure a chat model in the settingsChat model not configured, please configure a chat model in the settings
E0016-Embedding model not configured, please configure an embedding model in the settingsEmbedding model not configured, please configure an embedding model in the settings
E0017-Media provider not configured, please configure a media provider in the settingsMedia provider not configured, please configure a media provider in the settings
E0018-Media model not configured, please configure a media model in the settingsMedia model not configured, please configure a media model in the settings
E1000-Canvas not found, please refreshCanvas not found, please refresh
E1002-Resource not found, please refreshResource not found, please refresh
E1003-Document not found, please refreshDocument not found, please refresh
E1004-Reference not found, please refreshReference not found, please refresh
E1005-Reference object missing, please refreshReference object missing, please refresh
E1006-Skill not found, please refreshSkill not found, please refresh
E1007-Label class not found, please refreshLabel class not found, please refresh
E1008-Label instance not found, please refreshLabel instance not found, please refresh
E1009-Share content not foundShare content not found
E1011-Action result not found, please refreshAction result not found, please refresh
E1012-Upload file not found, please try againUpload file not found, please try again
E1013-Code artifact not found, please refreshCode artifact not found, please refresh
E1014-Project not found, please refreshProject not found, please refresh
E1015-Provider not found, please refreshProvider not found, please refresh
E1016-Provider item not found, please refreshProvider item not found, please refresh
E1017-MCP server not found, please refreshMCP server not found, please refresh
E1018-Canvas version not found, please refreshCanvas version not found, please refresh
E1019-Provider misconfiguration, please check the provider configurationProvider misconfiguration, please check the provider configuration
E1020-Toolset not found, please refreshToolset not found, please refresh
E1021-Workflow execution not found, please refreshWorkflow execution not found, please refresh
E1022-Workflow app not found, please refreshWorkflow app not found, please refresh
E1023-Copilot session not found, please refreshCopilot session not found, please refresh
E1024-Drive file not found, please refreshDrive file not found, please refresh
E2001-Storage quota exceeded, please upgrade your subscriptionStorage quota exceeded, please upgrade your subscription
E2002-Execution failed, credit quota insufficient, please upgrade your subscriptionExecution failed, credit quota insufficient, please upgrade your subscription
E2003-Model not supported, please select other modelsModel not supported, please select other models
E2004-Content is too large. Maximum length is 100k characters.Content is too large. Maximum length is 100k characters.
E2005-Request payload is too large. Maximum size is 100KB.Request payload is too large. Maximum size is 100KB.
E3001-Model provider error, please try again laterModel provider error, please try again later
E3002-Request rate limit exceeded for the model provider. Please try again later.Request rate limit exceeded for the model provider. Please try again later.
E3003-Model provider timed out, please try again laterModel provider timed out, please try again later
E3004-Action was stoppedAction was stopped
E3005-Duplication is not allowed for this shared contentDuplication is not allowed for this shared content
E3006-File too large for direct parsing, use execute_code tool to process itFile too large for direct parsing, use execute_code tool to process it
E3007-The content you entered contains sensitive information. Please revise and try again.The content you entered contains sensitive information. Please revise and try again.
E3008-Presigned uploads are not supported by this storage backendPresigned uploads are not supported by this storage backend
E3009-The content type is not allowed for this operationThe content type is not allowed for this operation
E3010-The uploaded file size does not match the expected sizeThe uploaded file size does not match the expected size
E3011-The upload session has expired, please request a new presigned URLThe upload session has expired, please request a new presigned URL
E3012-Tool call failedTool call failed
E3013-Failed to send emailFailed to send email
INSUFFICIENT_CREDITS402Insufficient creditsInsufficient credits for this operation.
INVALID_REQUEST_BODY400Invalid request bodyRequest body format is invalid.
WEBHOOK_DISABLED403Webhook disabledWebhook is disabled and cannot be triggered.
WEBHOOK_NOT_FOUND404Webhook not foundWebhook does not exist or has been deleted.
WEBHOOK_RATE_LIMITED429Webhook rate limitedRequest rate exceeds the limit.