Authentication

Alls APIs are authenticated through Bearer Authentication.

Query Task Status

You can check the status of any task by querying the task API:

https://api.beam.cloud/v2/task/{TASK_ID}/

Task Statuses

Your payload will return the status of the task. These are the possible statuses for a task:

StatusDescription
PENDINGThe task is enqueued and has not started yet.
RUNNINGThe task is running.
COMPLETEThe task completed without any errors.
RETRYThe task is being retried. Defaults to 3, unless max_retries is provided in the function decorator.
CANCELLEDThe task was cancelled by the user.
TIMEOUTThe task timed out, based on the timeout provided in the function decorator.
EXPIREDThe task remained in the queue and was never picked up by a worker.
FAILEDThe task did not complete successfully.

Request

curl -X GET \
  'https://api.beam.cloud/v2/task/{TASK_ID}/' \
  -H 'Authorization: Bearer [YOUR_AUTH_TOKEN]' \
  -H 'Content-Type: application/json'

Response

The response to /task returns the following data:

FieldTypeDescription
idstringThe unique identifier of the task.
started_atstringThe timestamp when the task started, in ISO 8601 format. Null if the task hasn’t started yet.
ended_atstringThe timestamp when the task ended, in ISO 8601 format. Null if the task is still running or hasn’t started.
statusstringThe current status of the task (e.g., COMPLETE, RUNNING, etc.).
container_idstringThe identifier of the container running the task.
updated_atstringThe timestamp when the task was last updated, in ISO 8601 format.
created_atstringThe timestamp when the task was created, in ISO 8601 format.
outputsarrayAn array containing the outputs of the task.
statsobjectAn object containing statistics about the task’s execution environment.
stats.active_containersintegerThe number of active containers for the task.
stats.queue_depthintegerThe depth of the queue for the deployment.
stubobjectAn object containing detailed information about the task’s configuration and deployment.
stub.idstringThe identifier of the deployment stub.
stub.namestringThe name of the deployment stub.
stub.typestringThe type of the deployment stub.
stub.configstringThe configuration details of the deployment stub in JSON format.
stub.config_versionintegerThe version number of the deployment stub configuration.
stub.object_idintegerThe object identifier associated with the deployment stub.
stub.created_atstringThe timestamp when the deployment stub was created, in ISO 8601 format.
stub.updated_atstringThe timestamp when the deployment stub was last updated, in ISO 8601 format.

Here’s what the response payload looks like as JSON:

{
  "id": "07ce4078-bccc-4a42-b530-5f2653484a6a",
  "started_at": "2024-07-22T14:02:28.466278Z",
  "ended_at": "2024-07-22T14:02:28.475954Z",
  "status": "COMPLETE",
  "container_id": "endpoint-d327e987-759d-493e-b3e4-005774bcf998-8b747792",
  "updated_at": "2024-07-22T14:02:28.477026Z",
  "created_at": "2024-07-22T14:02:28.413232Z",
  "outputs": [],
  "stats": {
    "active_containers": 0,
    "queue_depth": 0
  },
  "stub": {
    "id": "d327e987-759d-493e-b3e4-005774bcf998",
    "name": "endpoint/deployment/app:squared",
    "type": "",
    "config": "{\"runtime\":{\"cpu\":1000,\"gpu\":\"\",\"memory\":128,\"image_id\":\"4724a2a2dfb601d8\"},\"handler\":\"app:squared\",\"on_start\":\"\",\"python_version\":\"python3.10\",\"keep_warm_seconds\":180,\"max_pending_tasks\":100,\"callback_url\":\"\",\"task_policy\":{\"max_retries\":0,\"timeout\":180,\"expires\":\"0001-01-01T00:00:00Z\"},\"workers\":1,\"authorized\":false,\"volumes\":null,\"autoscaler\":{\"type\":\"queue_depth\",\"max_containers\":1,\"tasks_per_container\":1}}",
    "config_version": 0,
    "object_id": 0,
    "created_at": "0001-01-01T00:00:00Z",
    "updated_at": "0001-01-01T00:00:00Z"
  }
}

Cancelling Tasks

Tasks can be cancelled through the api.beam.cloud/v2/task/cancel/ endpoint.

Request

curl -X DELETE --compressed 'https://api.beam.cloud/v2/task/cancel/' \
  -H 'Authorization: Bearer [YOUR_TOKEN]' \
  -H 'Content-Type: application/json' \
  -d '{"task_ids": ["TASK_ID"]}'

This API accepts a list of tasks, which can be passed in like this:

{
  "task_ids": [
    "70101e46-269c-496b-bc8b-1f7ceeee2cce",
    "81bdd7a3-3622-4ee0-8024-733227d511cd",
    "7679fb12-94bb-4619-9bc5-3bd9c4811dca"
  ]
}

Response

200

{}