Use the Task Management API to estimate task tokens and costs, submit structure prediction or virtual screening tasks, check progress, retrieve results, browse task history, and cancel tasks that have not started running.
This reference covers the endpoints, request and response fields, task states, and errors shared by all task types. For the input format, limits, workflow, and result interpretation, see the guide for your task type.
Task types and guides
task_type | Task type | Input and usage guide |
|---|---|---|
1 | Structure prediction (default) | Structure Prediction Guide |
2 | Virtual screening | Virtual Screening Guide |
Use the same model, task_type, and input for a quote and task creation. The input must match the selected task type.
Endpoints
| Endpoint | Method | Path | Description |
|---|---|---|---|
| Quote a task | POST | /v1/tasks/quote | Estimate task tokens and required credits |
| Create a task | POST | /v1/tasks/create | Submit a structure prediction or virtual screening task |
| Get task status | GET | /v1/tasks/status | Lightweight status, result URL, and task error lookup; recommended for waiting on tasks |
| Get task details | GET | /v1/tasks/query | Retrieve task status and results by ID |
| List tasks | GET | /v1/tasks/list | Get a paginated list of tasks for the current account |
| Cancel a task | POST | /v1/tasks/cancel | Cancel a task in CREATED or QUEUED state |
General conventions
Base URL
https://api.atomelody.com
All requests use HTTPS. Send Content-Type: application/json for endpoints with a JSON request body.
Authentication
Include an API Key in the HTTP header of every request:
Authorization: Bearer <YOUR_API_KEY>
Create and manage API Keys on the console's API Keys page.
Response envelope
Successful responses use the following envelope; each endpoint defines the contents of data:
{
"code": "OK",
"message": "OK",
"data": {}
}
For failed requests, the HTTP status reflects the error and the response does not include data:
{
"code": "INVALID_SEQUENCE",
"message": "Sequence 1 is invalid: the protein sequence contains unsupported character \"X\" at position 4."
}
code is a stable, machine-readable error type. message describes the particular failure and may vary for the same code. Check both the HTTP status and code; do not branch on message text.
The examples and field tables list stable fields that external clients can rely on. Responses may contain additional metadata; ignore fields not documented here.
Task states
status | State | Meaning | Cancellable |
|---|---|---|---|
1 | CREATED | Created, waiting to enter the processing queue | Yes |
2 | QUEUED | In the processing queue | Yes |
3 | RUNNING | Computation is in progress | No |
4 | COMPLETED | Completed successfully; results are available | No |
5 | FAILED | Execution failed | No |
6 | CANCELLED | Cancelled | No |
COMPLETED, FAILED, and CANCELLED are terminal states. Virtual screening also returns COMPLETED when only some candidates succeed; see screening task states. Reserved credits are released automatically after failure or cancellation. See Pricing and Quotas.
The platform controls how many tasks can be queued or running at once according to account and system policies. Tasks beyond the current concurrency allowance remain CREATED and enter processing in queue order as existing tasks finish. These limits are not a fixed API contract.
Quote a task
Before submitting a prediction task, use this endpoint to estimate its total token count and cost. A quote does not create a task, run inference, or reserve or deduct credits.
Request
POST /v1/tasks/quote
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | No | "Melo-1" | Prediction model; currently only Melo-1 is supported |
task_type | int | No | 1 | Task type: 1 for structure prediction, 2 for virtual screening |
input | object | Yes | - | Task input, identical to the input for creation; see the task guides |
The endpoint validates the input and quota limits for the selected task type. Invalid input returns an error without a quote. A task name is not required. For complete requests, see structure prediction quotes and virtual screening quotes.
Response
The following example is a structure prediction quote. Virtual screening also returns candidate_costs, described below.
{
"code": "OK",
"message": "OK",
"data": {
"token_num": 4,
"base_cost": 10,
"quantity": 1,
"estimated_cost": 10
}
}
| Field | Type | Description |
|---|---|---|
token_num | int64 | Total task tokens for structure prediction; for virtual screening, the sum across all target–candidate combinations |
base_cost | int64 | Base cost in compute credits, before quantity and discounts; based on the actual token tier for structure prediction, or the sum of base costs for all screening combinations |
quantity | int32 | Billing quantity, always returned; the effective num_seeds for Melo-1 structure prediction (1 if omitted), or 1 for virtual screening, not the candidate count |
estimated_cost | int64 | Estimated compute credits, including the num_seeds multiplier for structure prediction, or the sum of combination costs for screening; the cost at creation takes precedence |
candidate_costs | array | Virtual screening only: per-candidate quotes in input order |
candidate_costs[].candidate_id | string | Candidate ID from the input |
candidate_costs[].token_num | int64 | Tokens for the target combined with this candidate |
candidate_costs[].estimated_cost | int64 | Estimated credits for this combination |
The example has 4 tokens and uses the default 1 seed, with an estimated cost of 10 credits. See Pricing and Quotas. Once confirmed, call Create a task with the same model, task_type, and input. The creation response's billing_order.frozen contains the credits actually reserved.
With the same input and input.num_seeds: 20, token_num remains 4, base_cost remains 10, quantity is 20, and estimated_cost is 200. The current estimate is base_cost × quantity. Use estimated_cost directly: it already incorporates all billing rules, so do not multiply it again or recalculate the cost.
To prevent spending more if prices change after the quote, pass the returned data.estimated_cost unchanged as the creation request's top-level max_cost. For example, "max_cost": 10 allows creation at the current cost if it is at most 10 credits. A higher cost returns MAX_COST_EXCEEDED without creating a task or reserving credits.
Create a task
Request
POST /v1/tasks/create
Top-level parameters
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | No | "Melo-1" | Prediction model; currently only Melo-1 is supported |
task_name | string | No | "" | Custom name, up to 20 Unicode characters; cannot consist only of whitespace or contain control characters or \\ / : * ? " < > | |
task_type | int | No | 1 | Task type: 1 for structure prediction, 2 for virtual screening |
max_cost | int64 | No | 0 | Maximum credits allowed for this task, in the same units as estimated_cost; omitted or 0 means no cost ceiling; negative values are invalid |
input | object | Yes | - | Task input; see the task guides for its format |
When max_cost > 0, the cost calculated at creation must be at most this value. Otherwise, the endpoint returns HTTP 400 with MAX_COST_EXCEEDED; message includes the current cost and limit. Virtual screening compares the total cost for all candidates; the existing 1,000-credit per-task limit still applies. This parameter only caps spending. The credits reserved are the actual cost calculated at creation.
For complete requests and molecular inputs, see Structure Prediction and Virtual Screening.
Response
{
"code": "OK",
"message": "OK",
"data": {
"task_id": "tk-01a05cc4a55c77c99fe3eb3203143713",
"status": 2,
"billing_order": {
"order_id": "bo-01a05cc4a55e7cd98219eb3f1b469d95",
"status": 1,
"frozen": 10,
"charged": 0
},
"balance": {
"available": 970,
"frozen": 10
}
}
}
| Field | Type | Description |
|---|---|---|
task_id | string | Unique task identifier |
status | int | Initial task state, usually CREATED or QUEUED |
billing_order.order_id | string | Billing order ID for this task |
billing_order.status | int | 1: reserved; 2: settled; 3: released |
billing_order.frozen | int64 | Credits reserved for this task |
billing_order.charged | int64 | Credits charged |
balance.available | int64 | Currently available account credits |
balance.frozen | int64 | Currently reserved account credits |
Get task status
GET /v1/tasks/status?task_id=<TASK_ID>
Use the same API Key authentication as for other task endpoints. Only tasks belonging to the current account are accessible. The task_id query parameter is required. This endpoint supports polling and retrieving results, including success, failure, and cancellation, without fetching full details. Use /v1/tasks/query when input or billing information is needed.
{
"code": "OK",
"message": "OK",
"data": {
"task_id": "tk-01a05cc4a55c77c99fe3eb3203143713",
"status": 3
}
}
| Field | Type | Description |
|---|---|---|
task_id | string | Unique task identifier |
status | int | Values 1–6 from Task states; 4, 5, and 6 are terminal |
output_url | string | Temporary result ZIP URL, valid for 10 minutes; omitted when no results are available; call this endpoint again after expiry |
error | object | Present when the task has an error; otherwise omitted |
error.code | string | Public stage error code: MSA_ERROR, INFERENCE_ERROR, or TASK_ERROR, consistent with the details endpoint |
Successful tasks return output_url. If all screening candidates fail but a summary archive is available, status is 5 and both output_url and error are returned; retain and process that archive. Task execution failure is distinct from request failure: a successful query still returns top-level code: "OK".
{
"code": "OK",
"message": "OK",
"data": {
"task_id": "tk-example",
"status": 5,
"output_url": "https://example.com/signed-summary-url",
"error": { "code": "INFERENCE_ERROR" }
}
}
If signing the result URL temporarily fails, the endpoint returns a retryable server error so clients do not treat a response without a download URL as complete.
Task waiting script
Inference can take time. The waiting script polls automatically and emits events when the status changes or the task ends. Use it to follow progress in a terminal or integrate it into applications and automated workflows.
Download the Python waiting script and run it locally or on a server. It requires Python 3.9 or later and has no third-party dependencies. You can also use its implementation as a reference for polling, waiting, and event handling in another language or tool.
Supply ATOMELODY_API_KEY through the environment; do not put credentials in the script or event output. Save the script as wait_task.py, then run:
python3 wait_task.py <TASK_ID> --max-wait 1800
The script queries immediately, then increases the interval through approximately 15, 30, 60, and 120 seconds, with jitter and a 120-second cap. Network errors, HTTP 429, and 5xx receive bounded retries; the script exits after 5 consecutive failures. A server-provided Retry-After is respected as a minimum delay. Authentication, permission, missing-task, and invalid-response errors stop immediately.
Output is flushed JSON Lines, one object per line. The first nonterminal state is emitted immediately; later events appear only when the state changes. The examples omit the observed_at timestamp included with each event:
{"event":"status_changed","task_id":"tk-example","previous_status":null,"status":2}
{"event":"status_changed","task_id":"tk-example","previous_status":2,"status":3}
{"event":"completed","task_id":"tk-example","status":4,"output_url":"https://example.com/signed-output-url"}
After emitting the transition from QUEUED to RUNNING, the script keeps running. Polling may skip intermediate states. If the first query finds a finished task, only the final event is emitted.
| Event | Exit code | Handling |
|---|---|---|
status_changed | Keeps running | Update progress and continue waiting on the original process; do not start another waiting script |
completed | 0 | Download and process output_url |
failed / cancelled | 1 | Inspect the final state and error; download the summary if output_url is present |
error | 2 | Query or configuration error, not inference failure; fix it and retry with the same task ID |
pending | 3 | The local waiting budget has expired; the task may still be running, so retain its ID |
interrupted | 130 | The user interrupted local waiting; the server task was not cancelled |
--max-wait defaults to 1800 seconds and only limits local waiting; it does not cancel server-side inference. Request timeouts shrink with the remaining budget, although lower-level network operations such as DNS may delay exit slightly. Reuse the original task_id when restarting the script; do not create another task.
Running and integrating: Read the output directly in a terminal, or process events line by line and use the exit code in an application or workflow. The script continues after status_changed; no additional query or waiting process is needed. Silence usually means the task state is unchanged and is not a reason to check frequently or restart the script.
For background waiting, use your environment's process management or completion notifications. Automatic follow-up processing or notifications must be configured in the calling application or workflow; the script only queries and emits events. If waiting ends before the task finishes, retain the task ID and query again later.
Download URLs in completion events also expire after 10 minutes. Call /v1/tasks/status again if a fresh URL is needed.
Get task details
Request
GET /v1/tasks/query?task_id=<TASK_ID>
| Query parameter | Type | Required | Description |
|---|---|---|---|
task_id | string | Yes | Task ID to query |
Response
The example omits the contents of input. The full response includes task input in the format specified by task_type.
{
"code": "OK",
"message": "OK",
"data": {
"task_id": "tk-01a05cc4a55c77c99fe3eb3203143713",
"task_name": "Demo_Task",
"task_type": 1,
"status": 4,
"model": "Melo-1",
"billing_order": {
"order_id": "bo-01a05cc4a55e7cd98219eb3f1b469d95",
"status": 2,
"frozen": 10,
"charged": 10
},
"create_at": "2026-08-25T10:00:00Z",
"start_at": "2026-08-25T10:00:05Z",
"end_at": "2026-08-25T10:01:15Z",
"output_url": "https://example.com/signed-output-url"
}
}
| Field | Type | Description |
|---|---|---|
task_id | string | Task ID |
task_name | string | Task name |
task_type | int | 1 for structure prediction, 2 for virtual screening |
status | int | Current task state |
model | string | Model used |
input | object | Task input; see the task guides for its format |
billing_order | object | Billing order, with the same field definitions as in the creation response |
error | object | Task execution error, including the stage error code, returned on task failure; this describes the asynchronous task, not a top-level API error |
create_at | string | Creation time in RFC 3339 format |
start_at | string | Start time; an empty string if not yet started |
end_at | string | End time; an empty string if not yet finished |
output_url | string | Temporary result ZIP URL, valid for 10 minutes; query again after expiry; also returned when all screening candidates fail but a summary archive is available |
For archive contents and usage, see structure prediction results and virtual screening results.
A query can succeed even when the task has failed (top-level code is OK). The task failure is in data.error. The following shows only the relevant fields:
{
"code": "OK",
"message": "OK",
"data": {
"task_id": "tk-01a05cc4a55c77c99fe3eb3203143713",
"status": 5,
"error": {
"code": "MSA_ERROR"
}
}
}
error.code is a stable task failure type identifying the stage, suitable for programmatic handling:
error.code | Meaning |
|---|---|
MSA_ERROR | MSA stage failed |
INFERENCE_ERROR | Inference stage failed |
TASK_ERROR | Other task processing failure |
List tasks
Request
GET /v1/tasks/list
| Query parameter | Type | Required | Default | Description |
|---|---|---|---|---|
status | int | No | - | Filter by status, from 1 to 6 |
model | string | No | - | Filter by a supported model name |
task_type | int | No | 0 | Filter by type: 1 for structure prediction, 2 for virtual screening; 0 or omitted means all types |
page | int | No | 1 | Page number, starting at 1 |
per_page | int | No | 20 | Items per page, up to 100; larger values are treated as 100 |
sort_key | string | No | "create_at" | Sort field; currently only create_at is supported |
asc | boolean | No | false | true for ascending order, false for descending order |
Response
{
"code": "OK",
"message": "OK",
"data": {
"list": [
{
"task_id": "tk-01a05cc4a55c77c99fe3eb3203143713",
"task_name": "Demo_Task",
"task_type": 1,
"status": 4,
"model": "Melo-1",
"create_at": "2026-08-25T10:00:00Z"
}
],
"pagination": {
"page": 1,
"per_page": 20,
"total": 1,
"total_pages": 1
}
}
}
| Field | Type | Description |
|---|---|---|
list | array | Tasks on the current page; an empty array if none match |
list[].task_id | string | Task ID |
list[].task_name | string | Task name |
list[].task_type | int | Task type; see Task types and guides |
list[].status | int | Task state; see Task states |
list[].model | string | Model used |
list[].create_at | string | Creation time in RFC 3339 format |
pagination.page | int | Current page number |
pagination.per_page | int | Items per page |
pagination.total | int | Total matching tasks |
pagination.total_pages | int | Total pages |
Cancel a task
Only CREATED or QUEUED tasks can be cancelled. Once a task is RUNNING or terminal, the endpoint returns TASK_STATUS_CONFLICT.
Request
POST /v1/tasks/cancel
{
"task_id": "tk-01a05cc4a55c77c99fe3eb3203143713"
}
| Field | Type | Required | Description |
|---|---|---|---|
task_id | string | Yes | Task ID to cancel |
Response
{
"code": "OK",
"message": "OK"
}
After cancellation, the task enters CANCELLED and reserved credits are released automatically. Confirm the final state through task details and the console's credit history.
Common error codes
code | HTTP status | Description |
|---|---|---|
INVALID_ARGUMENT | 400 | Invalid request format, required parameters, list filters or sorting, or exceeded cost limits for the selected task type; see message |
UNAUTHORIZED | 401 | Missing, invalid, or expired API Key |
FORBIDDEN | 403 | Access to the resource is denied |
RATE_LIMITED | 429 | Request rate exceeded; retry later |
UNSUPPORTED_MODEL | 400 | Unsupported model name |
UNSUPPORTED_TASK_TYPE | 400 | Unsupported task type |
INVALID_TASK_NAME | 400 | Task name is too long, contains only whitespace, or includes disallowed characters |
INVALID_SEQUENCE | 400 | Molecular input or token count does not meet the selected task type's requirements; see message |
TASK_NOT_FOUND | 404 | Task does not exist |
TASK_STATUS_CONFLICT | 409 | The current task state does not allow this action |
WALLET_NOT_ACTIVE | 409 | Credit account is currently unavailable |
INSUFFICIENT_BALANCE | 400 | Insufficient available credits |
MAX_COST_EXCEEDED | 400 | Task cost exceeds max_cost; no task was created and no credits were reserved; see message for the current cost and limit |
INTERNAL_ERROR | 500 | Temporary service error; retry later |