Execute Function Tasks
API Doc
Interactive API docs can be found at: https://run.truebit.network/dispatcher/api-docs/
Overview
You can configure the endpoint to return either a synchronous or asynchronous response. In synchronous mode, if the result is ready before the timeout, it will be returned immediately. Otherwise, you’ll receive an executionId, which can be used to check the result later through the status endpoint.
Execute a task using the provided task name. Supports both synchronous and asynchronous execution.
API key for authentication.
The namespace of the task.
The name of the task to be executed.
Label of the task.
Version number of the task.
If true, the endpoint will retrieve the executionId; otherwise, it will try to return the execution result only if it completes within 60 seconds.
Input data required for task execution.
Total number of solutions required for the task.
Number of solutions required to complete the task.
Task Requester Timestamp. This value is used to calculate the random bits in the node selection Phase.
Execution step limit.
Successful operation
Bad request, invalid input.
Not authorized.
Payment required.
Internal server error.
POST /task/function/execute-by-name HTTP/1.1
Host: run.truebit.network
x-api-key: text
Content-Type: application/json
Accept: */*
Content-Length: 146
{
"namespace": "namespace",
"taskName": "task",
"input": "20",
"totalSolutions": 1,
"requiredSolutions": 1,
"taskRequesterTimestamp": 1710262226,
"async": true
}{
"executionId": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeee",
"clearTextSolution": {
"output": "function task output",
"executionStatus": "succeed",
"senderAddress": "0x************************************79C8"
},
"signature": {
"v": 28,
"r": "20476805d11b************************************83f93de9b185d486",
"s": "07f38e3b3633************************************236081b5b8f74e66"
},
"verificationStatus": "Success"
}Authorization
API KEY
To get authorization to execute a task, include your registered API key in the request header. This allows Truebit to validate your access and identify the account responsible for covering the task execution cost (linked to the API key’s associated address).
Example
X-API-KEY: be0dc6ba-9a60-4777-b5b7-60ed2397e3edLast updated
Was this helpful?