Explore the available endpoints
**POST** /task/submit
This endpoint allows a user to submit a task for processing. It verifies the user's authentication, checks permissions, freezes credits, and adds the task to the task manager.
{ "authkey": "user_auth_token", "task_type": "model_training", "model_id": "12345", "task_details": { "key1": "value1", "key2": "value2" } }
Field | Type | Description |
---|---|---|
authkey | string | The authentication token for the user. |
task_type | string | The type of task being submitted (e.g., "model_training"). |
model_id | string | The ID of the model associated with the task. |
task_details | object | Additional details about the task (e.g., parameters). |
{ "message": "Task submitted successfully", "code": 200, "data": { "transaction_id": "txn_1234567890" } }
{ "message": "Invalid task type", "code": 400, "data": {} }
{ "message": "Invalid authkey", "code": 401, "data": {} }
{ "message": "Permission denied", "code": 403, "data": {} }
{ "message": "Rate limit exceeded", "code": 429, "data": {} }
{ "message": "Failed to freeze credits: Insufficient balance", "code": 400, "data": {} }
**POST** /task/query
This endpoint allows a user to query the status of a task using the transaction ID. If the task has finished, the details will be returned; otherwise, the status will be "pending".
{ "authkey": "user_auth_token", "transaction_id": "txn_1234567890" }
Field | Type | Description |
---|---|---|
authkey | string | The authentication token for the user. |
transaction_id | string | The transaction ID of the task to query. |
{ "message": "Task finished", "code": 200, "data": { "task_type": "model_training", "transaction_id": "txn_1234567890", "status": "completed", "task_details": { "key1": "value1", "key2": "value2" } } }
{ "message": "Task status", "code": 100, "data": { "task_type": "model_training", "transaction_id": "txn_1234567890", "status": "pending", "task_details": { "key1": "value1", "key2": "value2" } } }
{ "message": "User not found", "code": 404, "data": {} }
{ "message": "Invalid authkey", "code": 401, "data": {} }
{ "message": "Task not found", "code": 404, "data": {} }
Code | Description |
---|---|
200 | Success: The operation was successful. |
100 | Task is still pending. |
400 | Bad Request: General error, such as invalid input. |
401 | Unauthorized: The authkey is invalid or missing. |
403 | Forbidden: The user does not have permission. |
404 | Not Found: The specified resource does not exist. |
429 | Too Many Requests: Rate limit exceeded. |