Managing API clients
/iam/api-clients is where you create and manage the API clients your organizations authenticate as. An API client is an OAuth client your services use with the client-credentials grant: you create one here on an organization, give it a role, and receive its clientId and a credential. It then exchanges that credential for access tokens and calls the API as the organization, with the scopes its role allows.
A client authenticates in one of two ways, fixed when you create it:
- Secret. The client holds one client secret, minted with the client and shown once. You rotate it in place.
- Public key. You register one or more public keys and the client signs a JWT with the matching private key (
private_key_jwt). Keys can expire, and you roll them by adding a new key and deleting the old one.
You see the clients on your own organization and on the organizations under it; a client on an organization outside that scope answers 404, and the API does not distinguish "does not exist" from "not yours".
Before you start
You need a valid access token for a caller permitted to manage API clients on the organization. Get one as an API client. If you do not have an API client yet, create your first one from the API reference: see Your first API client.
Listing and reading need the api:full:read scope; creating, updating, deleting and every credential change need api:full:write. See Access scopes. An API client may not change or delete itself, or add, change, delete or rotate its own credentials.
Pin apiVersion on every call to protect your integration from future changes. Omitting it selects the current default, 1.0.
Create a client
POST to /iam/api-clients with the organization, a name and a role. Omit credentialType for a secret client: the API mints the client with its one secret and returns it.
curl -sS -X POST "https://api.cybersentriq.com/iam/api-clients?apiVersion=1.0" \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"orgId":"<ORG_ID>","name":"Billing integration","role":"user"}'
const res = await fetch(
"https://api.cybersentriq.com/iam/api-clients?apiVersion=1.0",
{
method: "POST",
headers: {
Authorization: `Bearer ${accessToken}`,
"Content-Type": "application/json",
"Idempotency-Key": crypto.randomUUID(),
},
body: JSON.stringify({
orgId: orgId,
name: "Billing integration",
role: "user",
}),
},
);
const client = await res.json();
import requests, uuid
res = requests.post(
"https://api.cybersentriq.com/iam/api-clients",
params={"apiVersion": "1.0"},
headers={
"Authorization": f"Bearer {access_token}",
"Idempotency-Key": str(uuid.uuid4()),
},
json={"orgId": org_id, "name": "Billing integration", "role": "user"},
)
client = res.json()
using System.Net.Http;
using System.Text;
var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post,
"https://api.cybersentriq.com/iam/api-clients?apiVersion=1.0");
req.Headers.Add("Authorization", $"Bearer {accessToken}");
req.Headers.Add("Idempotency-Key", Guid.NewGuid().ToString());
req.Content = new StringContent(
"{\"orgId\":\"" + orgId + "\",\"name\":\"Billing integration\",\"role\":\"user\"}",
Encoding.UTF8, "application/json");
var res = await http.SendAsync(req);
var client = await res.Content.ReadAsStringAsync();
body := strings.NewReader(`{"orgId":"` + orgID + `","name":"Billing integration","role":"user"}`)
req, _ := http.NewRequest("POST",
"https://api.cybersentriq.com/iam/api-clients?apiVersion=1.0", body)
req.Header.Set("Authorization", "Bearer "+accessToken)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Idempotency-Key", uuid.NewString())
res, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer res.Body.Close()
// Decode res.Body into your model.
The client exists and can obtain tokens when the 201 returns. The response is the client with its credentials and the endpoints your service authenticates at:
{
"id": "a1af50f9-7857-4f51-accf-a292281ef851",
"clientId": "aB3xY7...",
"orgId": "71a0ffa1-9182-4013-ac76-309008b92f52",
"orgName": "Contoso Holdings",
"name": "Billing integration",
"enabled": true,
"role": "user",
"credentialType": "secret",
"maxCredentials": 1,
"credentials": [
{
"id": "5c8e2b1d-3f4a-4b6c-9d7e-8f1a2b3c4d5e",
"credentialType": "secret",
"secret": "s3cr3t-shown-once-only",
"createdAt": "2026-09-23T09:30:00Z",
"updatedAt": "2026-09-23T09:30:00Z"
}
],
"endpoints": {
"audience": "https://api.cybersentriq.com",
"openidConfiguration": "https://auth.cybersentriq.com/.well-known/openid-configuration",
"jsonWebKeySet": "https://auth.cybersentriq.com/.well-known/jwks.json"
}
}
The secret is shown once. secret is returned only in this response and cannot be read back. Store it in your secrets manager immediately. If you lose it, rotate the secret to get a new one.
Then authenticate with the clientId and secret using the client-credentials grant. See Authenticating as an API client.
Request fields
orgId(required): the organization to create the client on. You must administer it.name(required): a name for the client, up to 128 characters.role(required):admin,userorviewer. The role decides the scopes the client's tokens carry:adminandusercan write,viewercan only read. You cannot grant a role above your own.description(optional): up to 1024 characters.enabled(optional, defaulttrue): create the client disabled to finish setting it up before it can obtain tokens.credentialType(optional, defaultsecret):secretorpublicKey. It cannot be changed later.credentials(optional,publicKeyonly): the keys to register at creation, each withalg,pemand an optionalkidandexpiresAt. Omit it to create the client with no key and add one later.
Send an Idempotency-Key
A create touches several systems before it answers, and a network failure between you and the API can leave you unsure whether it happened. Send an Idempotency-Key header (any globally unique string; a random UUID will do) and repeat the request with the same key when in doubt:
- A repeat after success replays the original
201, secret included. - A repeat after a
502or503resumes the create where it stopped, so you never end up with two clients. - A repeat while the first request is still running answers
409request-in-progresswith aRetry-Afterheader; wait that long and repeat again. - The same key with a different body, or from a different caller, is refused with a
409(idempotency-request-body-conflictoridempotency-key-conflict).
Without a key, a repeat after a failure creates a second client.
List clients
GET /iam/api-clients?orgId=<ORG_ID> lists the clients on an organization. Each item is the client without its credentials. Needs api:full:read:
curl -sS "https://api.cybersentriq.com/iam/api-clients?orgId=<ORG_ID>&apiVersion=1.0" \
-H "Authorization: Bearer <ACCESS_TOKEN>"
const res = await fetch(
`https://api.cybersentriq.com/iam/api-clients?orgId=${orgId}&apiVersion=1.0`,
{ headers: { Authorization: `Bearer ${accessToken}` } },
);
const { items, nextPageToken } = await res.json();
import requests
res = requests.get(
"https://api.cybersentriq.com/iam/api-clients",
params={"orgId": org_id, "apiVersion": "1.0"},
headers={"Authorization": f"Bearer {access_token}"},
)
page = res.json()
using System.Net.Http;
var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Get,
$"https://api.cybersentriq.com/iam/api-clients?orgId={orgId}&apiVersion=1.0");
req.Headers.Add("Authorization", $"Bearer {accessToken}");
var res = await http.SendAsync(req);
var page = await res.Content.ReadAsStringAsync();
req, _ := http.NewRequest("GET",
"https://api.cybersentriq.com/iam/api-clients?orgId="+orgID+"&apiVersion=1.0", nil)
req.Header.Set("Authorization", "Bearer "+accessToken)
res, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer res.Body.Close()
// Decode res.Body into your model.
{
"total": 1,
"items": [
{
"id": "a1af50f9-7857-4f51-accf-a292281ef851",
"clientId": "aB3xY7...",
"orgId": "71a0ffa1-9182-4013-ac76-309008b92f52",
"orgName": "Contoso Holdings",
"name": "Billing integration",
"enabled": true,
"role": "user",
"credentialType": "secret",
"createdAt": "2026-09-23T09:30:00Z",
"updatedAt": "2026-09-23T09:30:00Z"
}
],
"nextPageToken": null
}
Shape the listing with query parameters:
scope=descendants: include the clients on every organization underorgId, not only on it.state=enabledorstate=disabled: one state only. Omit for both.search=<text>: clients whose name, description or organization name contains the text, case-insensitively. Four or more hex characters also match the start of a client id.credentialsExpiringIn=<days>: only public-key clients all of whose keys expire within that many days, an expired key included. From0(only what has already expired) to731. Use it to find keys to roll.order=name,orgName: one or more ofname,orgNameandenabled, each ascending unless prefixed with-.maxResultsandpageToken: paging.maxResultsis from1to200and defaults to50. FollownextPageTokenuntil it isnull; it is always present, so test its value, never whether the property is there. A page token is valid only for the listing it came from, so change any other parameter and start again.
Read a client
GET /iam/api-clients/{apiClientId} returns one client with its credentials and endpoints, in the same shape as the create response. A secret credential comes back without its secret:
curl -sS "https://api.cybersentriq.com/iam/api-clients/<API_CLIENT_ID>?apiVersion=1.0" \
-H "Authorization: Bearer <ACCESS_TOKEN>"
Update a client
PATCH /iam/api-clients/{apiClientId} changes the name, description or role, or sets enabled. Only the fields you send change; an empty string description clears it. Needs api:full:write:
curl -sS -X PATCH "https://api.cybersentriq.com/iam/api-clients/<API_CLIENT_ID>?apiVersion=1.0" \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
-H "Content-Type: application/json" \
-d '{"enabled":false}'
Disabling stops token issuance at once and enabling restores it. Tokens already issued are not revoked and stay valid until they expire, so a disable takes full effect within the token lifetime. The credentialType and the organization cannot be changed. A 200 returns the updated client.
Manage credentials
GET /iam/api-clients/{apiClientId}/credentials lists the client's credentials with the most it can hold (maxCredentials). GET .../credentials/{apiClientCredentialId} returns one. A secret is always listed without its value.
Add a public key
POST /iam/api-clients/{apiClientId}/credentials registers one more key on a public-key client. This is how you roll keys without downtime: add the new key, move your service to it, then delete the old one. Needs api:full:write:
curl -sS -X POST "https://api.cybersentriq.com/iam/api-clients/<API_CLIENT_ID>/credentials?apiVersion=1.0" \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"credentialType":"publicKey","alg":"RS256","pem":"-----BEGIN PUBLIC KEY-----\n...\n-----END PUBLIC KEY-----","expiresAt":"2027-09-23T00:00:00Z"}'
alg(required):RS256,RS384orPS256.pem(required): the public key, PEM encoded.kid(optional): the key id your service puts in the JWT header. Defaults to the RFC 7638 thumbprint of the key. It must be unique among the client's live keys.expiresAt(optional): when the key stops being accepted. Omit for a key that does not expire.
The key is usable when the 201 returns. The same Idempotency-Key rules as create apply. A secret client cannot take a second credential (409 credentials-full); rotate its secret instead.
Change a key's expiry
PATCH .../credentials/{apiClientCredentialId} with {"expiresAt":"<RFC 3339>"} sets when a public key stops being accepted. The expiry must be in the future and cannot be cleared. A secret has no expiry and cannot be given one (409 secret-not-expirable).
Delete a key
DELETE .../credentials/{apiClientCredentialId} removes a public key. Its kid is never reused. You may delete the last key, leaving a client that exists but cannot authenticate until you add one. A secret is never deletable (409 secret-not-deletable): rotate it, or delete the client.
curl -sS -X DELETE "https://api.cybersentriq.com/iam/api-clients/<API_CLIENT_ID>/credentials/<CREDENTIAL_ID>?apiVersion=1.0" \
-H "Authorization: Bearer <ACCESS_TOKEN>"
A successful delete returns 204 with no body.
Rotate the secret
POST .../credentials/{apiClientCredentialId}/rotate-secret mints a new secret for a secret credential and reveals it in this response only. Use it on a schedule, or when a secret may have leaked. Needs api:full:write:
curl -sS -X POST \
"https://api.cybersentriq.com/iam/api-clients/<API_CLIENT_ID>/credentials/<CREDENTIAL_ID>/rotate-secret?apiVersion=1.0" \
-H "Authorization: Bearer <ACCESS_TOKEN>"
{ "secret": "new-s3cr3t-shown-once-only" }
Rotation is immediate: the old secret stops working as soon as this call returns. Roll the new secret out to your service during a window where a brief failure is acceptable. A public key is not rotated (409 not-a-secret): add the new key and delete the old one instead.
To rotate a secret without service interruption, do not rotate in place. Create a new client with the same role, change your service to authenticate as the new client, then delete the old one. Both secrets are valid while you switch over, so nothing fails in between.
Delete a client
DELETE /iam/api-clients/{apiClientId} deletes the client. Token issuance stops at once; tokens already issued stay valid until they expire. The id and clientId are never reissued, and the organization's quota slot is released. Needs api:full:write:
curl -sS -X DELETE "https://api.cybersentriq.com/iam/api-clients/<API_CLIENT_ID>?apiVersion=1.0" \
-H "Authorization: Bearer <ACCESS_TOKEN>"
A successful delete returns 204 with no body. The delete is safe to repeat: a repeat while the first is still running answers 409 request-in-progress with Retry-After, a repeat after a 502 or 503 resumes it, and a repeat after success answers 404.
Versioning
apiVersion is a query parameter in major.minor form. Omit it and you get the pinned default, 1.0. Send an unsupported version and the call returns 400 with an api-supported-versions response header listing the versions you can use. Every response carries that header, so you can always see what is available.
Pin apiVersion in production clients so a new default cannot change your integration's behavior underneath it.
When it fails
Every error is application/problem+json with a stable type URI of the form https://api.cybersentriq.com/problems/<slug>:
{
"type": "https://api.cybersentriq.com/problems/request-in-progress",
"title": "Request in progress",
"status": 409,
"detail": "Another change to this client is still being applied. Retry after the Retry-After interval."
}
Match on type or the status code, never on title or detail.
| Status | type |
Meaning |
|---|---|---|
| 400 | bad-request, invalid-api-version |
The request is malformed, orgId is missing from a listing, order names a field the listing cannot order by, a pageToken was issued for a different listing, or the apiVersion value is not supported. Fix it; retrying unchanged will not help. |
| 401 | unauthorized |
The access token is missing, invalid or expired. Request a new token and retry once. |
| 401 | step-up-required |
A signed-in person must verify their identity again before this write. API clients never receive it. |
| 403 | insufficient-scope |
The token lacks the scope the method needs. See Access scopes. |
| 403 | forbidden |
Your caller is not permitted to do this on the client's organization, or an API client is acting on itself. Retrying will not help. |
| 404 | not-found |
The client or credential is unknown, still being created, deleted, or on an organization you cannot see. |
| 405 | method-not-allowed |
The resource does not serve this method. The Allow header lists the ones it does. |
| 409 | request-in-progress |
An earlier request with the same Idempotency-Key is still running. Wait for Retry-After seconds, then repeat. |
| 409 | credentials-full, credential-type-mismatch, kid-in-use, secret-not-expirable, secret-not-deletable, not-a-secret, idempotency-key-conflict, idempotency-request-body-conflict |
The request conflicts with the client's state or with an earlier request. The slug names what to change. |
| 413 | request-body-too-large |
The body is larger than the API accepts. |
| 422 | org-not-provisioned, org-type-unknown, api-client-quota-exceeded, account-service-rejected |
The organization cannot take this client: it is not provisioned for API clients, its type is unknown, it has used its client quota, or the platform refused the change, for example a role above your own. |
| 429 | too-many-requests |
You have hit the rate allowance. Wait for Retry-After seconds, then retry. |
| 501 | not-implemented |
The operation is not available yet. |
| 502, 503 | upstream-error, upstream-unavailable |
A system the operation depends on did not answer. A write may have been partly applied; repeat it with the same Idempotency-Key where one applies, and it resumes. |
Next
- Authenticate a service with a client you created: Authenticating as an API client.
- See a full flow: Building an end-to-end integration.