Internal API consumer guide
This guide is for Ontinue teams and workloads outside ION engineering that need read-only access to selected ION customer configuration and consent-validation data. The Internal API is restricted to approved Ontinue consumers and is not a public contract. It is exposed through Azure Front Door, authenticated with Microsoft Entra ID, and authorized with application roles.
Use a managed identity whenever the caller runs in Azure. Do not put access tokens, client secrets, or credentials in source code, configuration files, logs, tickets, or command history.
As a consumer, call Front Door only. APIM validates the caller token and roles, then obtains its own managed-identity token for backend operations. Do not call APIM or the backend directly.
Environments
Use the Front Door base URL and Entra application for the same environment.
The client ID is the token audience used in api://<client-id>/.default.
| Environment | Code | Front Door base URL | Entra application | Client ID |
|---|---|---|---|---|
| Alpha | apa | https://api.internal.alpha-ion.dev | azsp-ontinue-rome-idm-ion-internal-api-apa-01 | 45aacb32-7844-4894-9986-d5e78886a8da |
| Beta | bta | https://api.internal.beta-ion.dev | azsp-ontinue-rome-idm-ion-internal-api-bta-01 | 470448ab-4f56-46f3-86d5-1d08f62a6048 |
| Gamma | gma | https://api.internal.gamma-ion.dev | azsp-ontinue-rome-idm-ion-internal-api-gma-01 | 533c71b6-179d-4dd7-bdf5-20c1ef540e25 |
| Production | prd | https://api.internal.ion.ontinue.com | azsp-ontinue-rome-idm-ion-internal-api-prd-01 | 97f30357-df31-4707-b642-642983da854b |
Append the operation path directly to the base URL, for example:
https://api.internal.alpha-ion.dev/v1/customers
The Front Door route adds APIM’s internal base path. Never add
/intapi-ext to a consumer URL. Only /v1/* is routed for this service.
Access prerequisites
Before requesting access:
- Choose the environment and operation needed. Validate in Alpha or another approved non-production environment before requesting production access.
- Create or identify the workload’s managed identity. Prefer a user-assigned identity when its lifecycle must be independent from the compute resource.
- Record the managed identity’s display name, client ID, object/principal ID, owning team, Azure resource, business use case, required role, target environment, and expected request rate.
- Ensure the workload can reach the environment’s Front Door hostname over HTTPS and can obtain managed-identity tokens from its Azure hosting service.
- Obtain data-owner approval for access to customer configuration. Request only the least-privileged role needed.
Application roles are assigned to the calling identity on the target
environment’s Internal API enterprise application. The resulting role appears
in the access token’s roles claim. Role checks use any-of semantics when
an operation lists more than one accepted role.
| Role | Intended access |
|---|---|
Ion.Health.Read | Authenticated Internal API liveness check |
Ion.Internal.Customers.Read | Read one customer’s configuration |
Ion.Internal.Customers.Read.All | List all customers and read individual customer configuration |
Send the access request to the Internal API owners, the Architects team, and include all prerequisite details above. Access is environment-specific; a grant in Alpha does not grant Production access.
Operations
All paths are relative to the environment’s Front Door base URL.
| Method | Path | Checked-in runtime role requirement | Purpose | Success |
|---|---|---|---|---|
HEAD | /v1/healthcheck/liveness | Ion.Health.Read | Authenticated synthetic gateway check | 200, no body |
GET | /v1/customers | Ion.Internal.Customers.Read.All | List customer base configurations | 200, JSON:API collection |
GET | /v1/customers/{customer-short} | Ion.Internal.Customers.Read or Ion.Internal.Customers.Read.All | Get one customer by company_short | 200, JSON:API resource |
GET | /v1/customers/{customer-short}/ConsentValidation | Ion.Internal.Customers.Read or Ion.Internal.Customers.Read.All | Get the latest Entra application consent-validation status | 200, JSON:API resource |
Consent-operation authorization mismatch: the OpenAPI/reference declares
Ion.Platform.CustomerConfigurationData.ReadandIon.Platform.CustomerConfigurationData.ReadWrite, but the checked-in Terraform operation policy enforcesIon.Internal.Customers.ReadandIon.Internal.Customers.Read.All. Consumers must confirm the role to request with the Internal API owners until the contract and effective deployed policy are reconciled. Runtime enforcement follows the effective APIM policy.
{customer-short} is the customer’s short name, such as ontinuedev. The
authoritative OpenAPI source
defines operation contracts and schemas. The deployable bundled contract is at
ion-internal-api/api/specs/openapi.yaml.
Implementation flow
Request the application role
Owner: Consumer team and Architects team
Provide the target environment, managed identity display name, client ID, object/principal ID, Azure resource, owning team, business justification, operation, least-privileged role, and expected traffic. For consent validation, call out the documented/deployed role mismatch and obtain explicit confirmation of the role that will be granted and tested.
Wait for the role assignment to the target environment’s Internal API enterprise application before testing. Entra role-assignment propagation can take time.
Configure the managed identity
Owner: Consumer team
Enable the selected system-assigned or user-assigned managed identity on the Azure workload. Grant the workload permission to use that identity where the hosting service requires it. Store non-secret values such as the Front Door URL, API client ID, and user-assigned identity client ID in environment-specific configuration.
Do not create a client secret when managed identity is available. Never persist or log the access token.
Acquire an environment-specific token
Owner: Consumer team
Request api://<client-id>/.default, using the client ID from the environment
table. The .default scope asks Entra to include application roles already
assigned to the managed identity; roles are not selected at token-request time.
Cache tokens in memory and let the identity SDK refresh them before expiry.
Raw Azure managed-identity HTTP endpoints use the equivalent
resource=api://<client-id> form rather than the SDK’s .default scope form.
Call Front Door only
Owner: Consumer team
Send the token as Authorization: Bearer <token> to the exact Front Door base
URL plus the documented /v1/... path. Use HTTPS. Do not add /intapi-ext, call
an azure-api.net hostname, or call the Doppio/backend hostname directly.
Set Accept: application/json for GET requests. Treat the liveness operation
as HEAD: inspect its status and do not expect a response body.
Handle responses and rate limits
Owner: Consumer team
Parse successful GET bodies as JSON:API. Handle 401 by obtaining a token for
the correct environment and audience; handle 403 as an authorization failure
even if its body is empty. Apply bounded exponential backoff with jitter to
429 and transient 5xx responses, respecting Retry-After when supplied.
Read X-RateLimit-IonInternalApi-Remaining-User for the current remaining
allowance. Do not depend on undocumented error bodies or assume that every
failure is JSON.
Validate before production
Owner: Consumer team and service owner
In a non-production environment, verify the expected roles, aud, oid, and
expiry claims without logging the token. Exercise each required operation and
negative cases for missing role and wrong audience. Confirm JSON:API parsing,
timeouts, retry limits, telemetry redaction, and behavior under throttling.
Before production, obtain the production-specific role assignment, update both the Front Door URL and client ID together, and complete the owning team’s operational-readiness and data-access review.
cURL with managed identity
These examples target Alpha. Change BASE_URL and API_CLIENT_ID together for
another environment. They keep the token in a shell variable for the process;
they do not print or persist it.
Azure VM or VM scale set
The Instance Metadata Service (IMDS) accepts resource, which is the raw HTTP
equivalent of requesting the SDK scope api://<client-id>/.default.
BASE_URL="https://api.internal.alpha-ion.dev"
API_CLIENT_ID="45aacb32-7844-4894-9986-d5e78886a8da"
RESOURCE="api://${API_CLIENT_ID}"
ACCESS_TOKEN="$(curl --fail --silent --show-error \
--header "Metadata: true" \
"http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=${RESOURCE}" \
| jq --raw-output '.access_token')"
curl --fail-with-body --silent --show-error \
--header "Authorization: Bearer ${ACCESS_TOKEN}" \
--header "Accept: application/json" \
"${BASE_URL}/v1/customers/ontinuedev"
For a user-assigned identity, add
&client_id=<managed-identity-client-id> to the IMDS token URL. The placeholder
is the caller identity’s client ID, not the Internal API client ID.
App Service, Functions, or Container Apps identity endpoint
BASE_URL="https://api.internal.alpha-ion.dev"
API_CLIENT_ID="45aacb32-7844-4894-9986-d5e78886a8da"
ACCESS_TOKEN="$(curl --fail --silent --show-error \
--header "X-IDENTITY-HEADER: ${IDENTITY_HEADER}" \
"${IDENTITY_ENDPOINT}?api-version=2019-08-01&resource=api://${API_CLIENT_ID}" \
| jq --raw-output '.access_token')"
curl --silent --show-error --include --request HEAD \
--header "Authorization: Bearer ${ACCESS_TOKEN}" \
"${BASE_URL}/v1/healthcheck/liveness"
The platform identity endpoint and its header are runtime-provided values. Do not copy them into source control or logs.
Python async example
Install azure-identity and aiohttp through the workload’s normal locked
dependency process. This example uses a system-assigned managed identity; pass
its client ID to ManagedIdentityCredential for a user-assigned identity.
import asyncio
import aiohttp
from azure.identity.aio import ManagedIdentityCredential
BASE_URL = "https://api.internal.alpha-ion.dev"
API_CLIENT_ID = "45aacb32-7844-4894-9986-d5e78886a8da"
SCOPE = f"api://{API_CLIENT_ID}/.default"
async def get_customer(customer_short: str) -> dict:
credential = ManagedIdentityCredential()
timeout = aiohttp.ClientTimeout(total=15)
try:
token = await credential.get_token(SCOPE)
headers = {
"Authorization": f"Bearer {token.token}",
"Accept": "application/json",
}
url = f"{BASE_URL}/v1/customers/{customer_short}"
async with aiohttp.ClientSession(timeout=timeout) as session:
async with session.get(url, headers=headers) as response:
remaining = response.headers.get(
"X-RateLimit-IonInternalApi-Remaining-User"
)
if response.status == 403:
raise PermissionError(
"Internal API denied the assigned application role"
)
response.raise_for_status()
print("remaining allowance:", remaining)
return await response.json()
finally:
await credential.close()
async def main() -> None:
customer = await get_customer("ontinuedev")
print(customer["data"]["attributes"]["company_short"])
if __name__ == "__main__":
asyncio.run(main())
For production code, reuse the credential and HTTP session, bound retries and
concurrency, add jittered backoff for 429/transient 5xx, and redact the
Authorization header from telemetry. Do not print the token or full
customer payloads.
JSON:API responses
Successful GET responses use a JSON:API envelope. A single-resource response
has an object in data:
{
"jsonapi": { "version": "1.0" },
"links": {
"self": "https://api.internal.alpha-ion.dev/v1/customers/ontinuedev"
},
"meta": {},
"data": {
"type": "IonCustomers",
"id": "ontinuedev",
"attributes": {
"company_name": "Ontinue Dev",
"company_short": "ontinuedev",
"platform": "ION",
"customer": {
"tenant_id": "47a70592-4ded-4612-8406-caa427805a47",
"managing_platform": "ION"
},
"consented_ion_applications": [
"azsp-ontinue-ion-access-write-all-prd-01"
]
}
}
}
A collection has an array in data:
{
"jsonapi": { "version": "1.0" },
"meta": {},
"data": [
{
"type": "IonCustomers",
"id": "ontinuedev",
"attributes": {
"company_name": "Ontinue Dev",
"company_short": "ontinuedev",
"platform": "ION"
}
}
]
}
Treat fields marked optional in OpenAPI as optional in client models. Do not infer authorization or customer scope from fields in the response.
Runtime behavior and limits
- Front Door is the only consumer route. Call the documented Front Door
hostname and
/v1/*path; never expose or append APIM’s/intapi-extpath. - Liveness is synthetic and authenticated.
HEAD /v1/healthcheck/livenessvalidates the gateway authentication andIon.Health.Readauthorization path, then APIM returns200. It does not call Doppio and is not evidence of Doppio or downstream dependency health. - A
403can have an empty body. The deployed role-rejection policy returns the status directly. Branch on status code, not on a JSON error message. - The exact remaining header is
X-RateLimit-IonInternalApi-Remaining-User. - The limit is 50 successful calls per 60 seconds per
oid. The deployed counter increments for2xxand3xxresponses. Tokens without anoidenter the shared fallback bucket (none), so callers must not depend on a missing-oidtoken for isolation or capacity. 404is not an explicit operation response in the OpenAPI contracts. A gateway or backend may still return it at runtime. Handle it generically, but do not build contract behavior around a documented404payload.- Back off generically. Use bounded exponential backoff with jitter for
429and transient5xx, and honorRetry-Afterwhen present. Do not assume that the rate-limit window or every transient response provides that header.
Troubleshooting
| Symptom | Likely cause | Action |
|---|---|---|
| DNS, TLS, or connection failure | Wrong hostname, blocked egress, or unsupported direct endpoint | Use the exact environment Front Door URL over HTTPS and verify workload egress/DNS. Do not use APIM or Doppio URLs. |
401 Unauthorized | Missing/expired token or wrong environment audience | Acquire a fresh token for api://<environment-client-id>/.default; update base URL and client ID together. |
403 Forbidden, possibly with no body | Required app role is absent, assignment has not propagated, or the consent-operation mismatch applies | Inspect token claims safely for aud, roles, oid, and expiry. Confirm the deployed role and assignment with the owners. Never paste the token into a ticket. |
404 Not Found | Wrong path/casing or unknown customer short name | Compare the path with OpenAPI, including ConsentValidation casing, and confirm company_short. Treat the response shape as unspecified. |
429 Too Many Requests | The caller’s oid bucket reached 50 successful calls in 60 seconds, or callers share the fallback bucket | Reduce concurrency, cache appropriate reads, apply jittered backoff, and verify the token has an oid. |
5xx or timeout | Transient gateway/backend failure | Retry only safe reads with bounded backoff and a timeout. Escalate persistent failures with environment, UTC time, operation, status, and correlation headers—but no token or sensitive payload. |
Liveness is 200 but customer reads fail | Liveness does not call Doppio | Test the required data operation; investigate its authorization, backend, and dependency path separately. |
| Remaining-rate header is absent | The request failed before policy completion or a response path omitted it | Continue to enforce client-side limits and backoff; do not treat the header as guaranteed on every failure. |
Support and ownership
The Architects team owns the Internal API contract and access coordination. The OpenAPI contact address is support@ontinue.com.
For an access request, provide the prerequisite identity and use-case details. For an incident, provide the environment, Front Door hostname, UTC timestamp, HTTP method and path, status code, sanitized correlation/trace headers, and whether the issue is repeatable. Never include bearer tokens, managed-identity endpoint headers, secrets, or customer-sensitive response bodies.
Related design pages: