Skip to main content

Documentation Index

Fetch the complete documentation index at: https://gcore.com/docs/llms.txt

Use this file to discover all available pages before exploring further.

Write operations in the Gcore Cloud API are asynchronous — the API returns a task ID immediately, while the actual operation runs in the background. The created resource ID is only available after polling the task to completion. This applies to every operation that changes infrastructure state: creating instances, volumes, networks, load balancers, Kubernetes clusters, and more.
  1. Make the request. A write call returns a task ID immediately:
{
  "tasks": ["d4a4b10e-5d22-4c23-8e09-f7a3e1c1a999"]
}
  1. Poll the task. Call GET /cloud/v1/tasks/{task_id} repeatedly until the state field is no longer RUNNING:
curl "https://api.gcore.com/cloud/v1/tasks/{TASK_ID}" \
  -H "Authorization: APIKey $GCORE_API_KEY"
  1. Extract the result. When state is FINISHED, find the created resource ID in created_resources.

Task states

Tasks move through four states from creation to completion:
StateMeaning
NEWTask queued, not yet started
RUNNINGOperation in progress
FINISHEDOperation completed successfully
ERROROperation failed — check error field

Task response

A finished create_vm task response shows the complete structure, including the created_resources field where the new resource IDs are found:
{
  "id": "d4a4b10e-5d22-4c23-8e09-f7a3e1c1a999",
  "task_type": "create_vm",
  "state": "FINISHED",
  "error": null,
  "created_on": "2026-05-23T05:07:31",
  "finished_on": "2026-05-23T05:07:50",
  "created_resources": {
    "instances": ["169942e0-9b53-42df-95ef-1a8b6525c2bd"],  // → resource ID
    "volumes":   ["726ecfcc-7fd0-4e30-a86e-7892524aa483"],
    "floatingips": [],
    "networks": [],
    ...
  }
}
The resource ID is in the created_resources field under the resource type key. Only the types that were actually created contain non-empty arrays — all others are empty lists.

Polling intervals

Polling too frequently wastes API quota; polling too rarely delays pipelines. These intervals balance the two:
OperationTypical durationPoll every
Create VM15–30 seconds5 seconds
Create volume5–15 seconds5 seconds
Create network / subnet5–10 seconds5 seconds
Create load balancer30–90 seconds10 seconds
Delete VM15–70 seconds5 seconds
Delete Bare Metal server60–120 seconds30 seconds
Create Kubernetes cluster5–15 minutes30 seconds

Poll the task

TASK_ID="{TASK_ID}"

while true; do
  STATE=$(curl -s "https://api.gcore.com/cloud/v1/tasks/$TASK_ID" \
    -H "Authorization: APIKey $GCORE_API_KEY" \
    | grep -o '"state":"[^"]*"' | grep -o '[A-Z]*$' | tr -d '"')
  echo "State: $STATE"
  if [ "$STATE" = "FINISHED" ]; then break; fi
  if [ "$STATE" = "ERROR" ]; then echo "Task failed"; exit 1; fi
  sleep 5
done

Error tasks

When state is ERROR, the error field contains the failure reason:
{
  "state": "ERROR",
  "error": "Quota limit for volume_size exceeded by 20",
  "created_resources": null
}
On error, no resources from that task are created — there is nothing to clean up from the failed task itself.

List recent tasks

To see all tasks in a project and region, call:
curl "https://api.gcore.com/cloud/v1/tasks?limit=20&state=RUNNING" \
  -H "Authorization: APIKey $GCORE_API_KEY"
Filter by state (NEW, RUNNING, FINISHED, ERROR) and task_type (e.g., create_vm, delete_vm, create_volume).
Tasks are associated with a specific project and region, whereas the task endpoint GET /cloud/v1/tasks/{task_id} does not require project_id or region_id in the path — a task ID is globally unique.