Documentation

Task Management API

Reference for task quotes, creation, status, details, pagination, cancellation, request and response fields, and error codes

Documentation contents

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_typeTask typeInput and usage guide
1Structure prediction (default)Structure Prediction Guide
2Virtual screeningVirtual 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

EndpointMethodPathDescription
Quote a taskPOST/v1/tasks/quoteEstimate task tokens and required credits
Create a taskPOST/v1/tasks/createSubmit a structure prediction or virtual screening task
Get task statusGET/v1/tasks/statusLightweight status, result URL, and task error lookup; recommended for waiting on tasks
Get task detailsGET/v1/tasks/queryRetrieve task status and results by ID
List tasksGET/v1/tasks/listGet a paginated list of tasks for the current account
Cancel a taskPOST/v1/tasks/cancelCancel 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

statusStateMeaningCancellable
1CREATEDCreated, waiting to enter the processing queueYes
2QUEUEDIn the processing queueYes
3RUNNINGComputation is in progressNo
4COMPLETEDCompleted successfully; results are availableNo
5FAILEDExecution failedNo
6CANCELLEDCancelledNo

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

FieldTypeRequiredDefaultDescription
modelstringNo"Melo-1"Prediction model; currently only Melo-1 is supported
task_typeintNo1Task type: 1 for structure prediction, 2 for virtual screening
inputobjectYes-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
  }
}
FieldTypeDescription
token_numint64Total task tokens for structure prediction; for virtual screening, the sum across all target–candidate combinations
base_costint64Base 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
quantityint32Billing 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_costint64Estimated 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_costsarrayVirtual screening only: per-candidate quotes in input order
candidate_costs[].candidate_idstringCandidate ID from the input
candidate_costs[].token_numint64Tokens for the target combined with this candidate
candidate_costs[].estimated_costint64Estimated 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

FieldTypeRequiredDefaultDescription
modelstringNo"Melo-1"Prediction model; currently only Melo-1 is supported
task_namestringNo""Custom name, up to 20 Unicode characters; cannot consist only of whitespace or contain control characters or \\ / : * ? " < > |
task_typeintNo1Task type: 1 for structure prediction, 2 for virtual screening
max_costint64No0Maximum credits allowed for this task, in the same units as estimated_cost; omitted or 0 means no cost ceiling; negative values are invalid
inputobjectYes-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
    }
  }
}
FieldTypeDescription
task_idstringUnique task identifier
statusintInitial task state, usually CREATED or QUEUED
billing_order.order_idstringBilling order ID for this task
billing_order.statusint1: reserved; 2: settled; 3: released
billing_order.frozenint64Credits reserved for this task
billing_order.chargedint64Credits charged
balance.availableint64Currently available account credits
balance.frozenint64Currently 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
  }
}
FieldTypeDescription
task_idstringUnique task identifier
statusintValues 1–6 from Task states; 4, 5, and 6 are terminal
output_urlstringTemporary result ZIP URL, valid for 10 minutes; omitted when no results are available; call this endpoint again after expiry
errorobjectPresent when the task has an error; otherwise omitted
error.codestringPublic 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.

EventExit codeHandling
status_changedKeeps runningUpdate progress and continue waiting on the original process; do not start another waiting script
completed0Download and process output_url
failed / cancelled1Inspect the final state and error; download the summary if output_url is present
error2Query or configuration error, not inference failure; fix it and retry with the same task ID
pending3The local waiting budget has expired; the task may still be running, so retain its ID
interrupted130The 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 parameterTypeRequiredDescription
task_idstringYesTask 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"
  }
}
FieldTypeDescription
task_idstringTask ID
task_namestringTask name
task_typeint1 for structure prediction, 2 for virtual screening
statusintCurrent task state
modelstringModel used
inputobjectTask input; see the task guides for its format
billing_orderobjectBilling order, with the same field definitions as in the creation response
errorobjectTask execution error, including the stage error code, returned on task failure; this describes the asynchronous task, not a top-level API error
create_atstringCreation time in RFC 3339 format
start_atstringStart time; an empty string if not yet started
end_atstringEnd time; an empty string if not yet finished
output_urlstringTemporary 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.codeMeaning
MSA_ERRORMSA stage failed
INFERENCE_ERRORInference stage failed
TASK_ERROROther task processing failure

List tasks

Request

GET /v1/tasks/list

Query parameterTypeRequiredDefaultDescription
statusintNo-Filter by status, from 1 to 6
modelstringNo-Filter by a supported model name
task_typeintNo0Filter by type: 1 for structure prediction, 2 for virtual screening; 0 or omitted means all types
pageintNo1Page number, starting at 1
per_pageintNo20Items per page, up to 100; larger values are treated as 100
sort_keystringNo"create_at"Sort field; currently only create_at is supported
ascbooleanNofalsetrue 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
    }
  }
}
FieldTypeDescription
listarrayTasks on the current page; an empty array if none match
list[].task_idstringTask ID
list[].task_namestringTask name
list[].task_typeintTask type; see Task types and guides
list[].statusintTask state; see Task states
list[].modelstringModel used
list[].create_atstringCreation time in RFC 3339 format
pagination.pageintCurrent page number
pagination.per_pageintItems per page
pagination.totalintTotal matching tasks
pagination.total_pagesintTotal 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"
}
FieldTypeRequiredDescription
task_idstringYesTask 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

codeHTTP statusDescription
INVALID_ARGUMENT400Invalid request format, required parameters, list filters or sorting, or exceeded cost limits for the selected task type; see message
UNAUTHORIZED401Missing, invalid, or expired API Key
FORBIDDEN403Access to the resource is denied
RATE_LIMITED429Request rate exceeded; retry later
UNSUPPORTED_MODEL400Unsupported model name
UNSUPPORTED_TASK_TYPE400Unsupported task type
INVALID_TASK_NAME400Task name is too long, contains only whitespace, or includes disallowed characters
INVALID_SEQUENCE400Molecular input or token count does not meet the selected task type's requirements; see message
TASK_NOT_FOUND404Task does not exist
TASK_STATUS_CONFLICT409The current task state does not allow this action
WALLET_NOT_ACTIVE409Credit account is currently unavailable
INSUFFICIENT_BALANCE400Insufficient available credits
MAX_COST_EXCEEDED400Task cost exceeds max_cost; no task was created and no credits were reserved; see message for the current cost and limit
INTERNAL_ERROR500Temporary service error; retry later