The CloudLabs API accepts Microsoft Entra ID access tokens issued to your API client with the client credentials flow. Your system signs in as itself; no person is involved.
Request a token
Use the token URL and scope shown when you created the client. The scope is always the application ID URI followed by /.default.
curl -s -X POST "https://login.microsoftonline.com/$TENANT_ID/oauth2/v2.0/token" \
-d grant_type=client_credentials \
-d client_id="$CLIENT_ID" \
-d client_secret="$CLIENT_SECRET" \
-d scope="api://$API_APP_ID/.default"$body = @{
grant_type = "client_credentials"
client_id = $env:CLIENT_ID
client_secret = $env:CLIENT_SECRET
scope = "api://$($env:API_APP_ID)/.default"
}
$token = (Invoke-RestMethod -Method Post -Body $body `
-Uri "https://login.microsoftonline.com/$($env:TENANT_ID)/oauth2/v2.0/token").access_tokenThe response holds an access_token and its lifetime in expires_in (seconds). Reuse the token until shortly before it expires; don't request one per call.
Call the API
curl -s "https://vnext-api.cloudlabs.ai/v1/labs/$LAB_ID" \
-H "Authorization: Bearer $ACCESS_TOKEN"Scopes are set in CloudLabs
You don't ask for labs.read or other CloudLabs scopes in the token request. They belong to the client in CloudLabs, and the API checks them on every call.
Safe-retry creates
Calls that create something accept an Idempotency-Key header. Send a unique value (a UUID) per intended create; if the network fails, repeat the call with the same key and CloudLabs won't create a second copy.