Call OmniCloud APIs from a Workload
Your login password belongs only in your local CLI session. Never put it in workload YAML, source code, or a container image.
This section describes the flow for fetching the tokens from within a Workload component, running on the OmniCloud.
OmniCloud gives a workload component a non-human machine identity through these environment variables unless the manifest overrides a reserved name:
OMNISAT_CLIENT_IDOMNISAT_CLIENT_SECRETOMNISAT_TOKEN_URL
Do not define or override these names in your workload specification. An override prevents platform injection and can start your workload with invalid or incomplete credentials.
Call customer APIs through https://api.dphi.space. Normal cluster DNS and
gateway routing preserve TLS verification; do not disable certificate checks or
replace the hostname with an IP address.
Request a short-lived token
The following Python function obtains a token using the injected identity:
import os
import httpx
def omnisat_token() -> str:
response = httpx.post(
os.environ["OMNISAT_TOKEN_URL"],
data={
"grant_type": "client_credentials",
"client_id": os.environ["OMNISAT_CLIENT_ID"],
"client_secret": os.environ["OMNISAT_CLIENT_SECRET"],
},
timeout=30,
)
response.raise_for_status()
return response.json()["access_token"]
Use the returned token as a bearer token when calling the platform gateway:
headers = {"Authorization": f"Bearer {omnisat_token()}"}
response = httpx.get(
"https://api.dphi.space/customer-controller/api/v1/storage/volumes",
headers=headers,
timeout=30,
)
response.raise_for_status()
print(response.json())
Request a new token when an API returns 401. Do not log the token, client
secret, or full environment.
The storage list call requires Storage listing permission; get and summary use
that same permission. Uplink and downlink are independent permissions.
Storage management (storage.manage) is human-only: a workload machine identity
cannot create or delete volumes, even if it can list or transfer files. Explicit
workload mounts do not grant
API permissions.
When platform-managed credentials are unavailable and reserved names were not
overridden, the affected component remains Pending with a credential
diagnostic. Workload network access is restricted. Use the platform gateway for
documented capabilities. Package Python dependencies such as httpx into your
image for repeatable runs. Local Python/pip and apt caches can support
installation, but they do not provide unrestricted internet access or guarantee
that an uncached package is available; see Dependencies and package
caches.