Skip to main content
Three values are needed before any Cloud API call works: an API token, a project ID, and a region ID.
A terminal must be open and curl must be installed. If either is unfamiliar, read API basics first — it covers both in a few minutes.

Step 1. Set up the API token

If the token has not been created yet, follow Authentication to create one in the Gcore Customer Portal and copy the value. Then set it as an environment variable in the terminal:
Replace 29841_c767... with the actual token value copied in Step 1. Verify the variable was set correctly:
The terminal will display a response. A working token returns something like:
If the terminal shows an error message instead, check Authentication errors.

Step 2. Find the project ID

Cloud API URLs include a project ID — a number that identifies the account’s project. List the projects to find it:

The API returns:

Find the "id" value in the results array — that number is the project ID. Copy it and set the appropriate variable for the method being used:
Replace 1234567 with the actual ID from the response. Most accounts have one project named “Default”, while multiple projects are used to separate environments (production, staging) or billing.

Step 3. Select a region

Cloud resources — VMs, volumes, networks — exist in a specific region (a data center location), and different regions support different features. List all available regions:

The API returns a list of regions. Each entry looks like:

The fields that matter for choosing: Find a region close to the target users, confirm it has "has_kvm": true for VM workloads, and note its "id". Set the appropriate variable for the method being used:
Replace 148 with the chosen region’s id.

Step 4. Make a resource call

With the token and project ID set, list the VMs in the project:

The API returns:

An empty list is expected on a new project — no VMs have been created yet. A 200 OK response with valid JSON confirms the token and project ID.

Environment variables reference

The token and project ID from Steps 1 and 2 are required for a Cloud API call. A call that targets one region also sends the region ID, in the body or as region_ids. curl and JavaScript — the project ID is in the instance path:
The instance list path:
Example:
Python SDK — all three values are read automatically from environment variables:
A list call reads the project ID from the environment. A create call still passes region_id in the body. Go SDK — all three values are read automatically by gcore.NewClient(), the same way the Python SDK reads them:
A list call reads the project ID from the environment. A create call still passes region_id in the body. Resource creation is asynchronous — the response returns a task ID, not the finished resource.