Authentication and IAM
Get and use an Argy token: device code (RFC 8628), personal access tokens, JWTs, SSO sign-in (OIDC, SAML), tenants, roles and permissions.
This page explains how an external client obtains a token to call the Argy APIs, how that token is verified and how permissions apply. It is aimed at integrators, script authors and teams rolling out SSO.
The calls described here target https://api.argy.cloud. To use the token you get, see the API overview, the platform API, the RAG API and the LLM Gateway.
Choose an authentication method
| Need | Recommended method | Section |
|---|---|---|
| Command-line tool or agent on a workstation | Device code (RFC 8628) | Device code |
| Script, CI/CD, non-interactive integration | Personal access token (PAT) | Personal access tokens |
| Application that already holds an Argy session | Argy JWT, renewed with refresh | JWTs and renewal |
| Signing in your company's users | SSO (OIDC or SAML), SCIM for provisioning | SSO, SCIM and MFA |
All public APIs accept the same header:
Authorization: Bearer $ARGY_PAT
A password is not an authentication method: POST /v1/auth/login answers 410 PASSWORD_AUTH_DISABLED. Sign-in goes through passkey, magic link or SSO.
Device code (RFC 8628)
The device code flow lets a tool without an embedded browser sign in: the tool displays a code, the user approves it in their browser, then the tool retrieves its tokens. It is the default mode of argy auth login in Argy Code.
1. Start the flow
POST /v1/auth/device/start (public).
| Field | Type | Default | Description |
|---|---|---|---|
locale | string | en | Language of the approval page. |
curl -X POST https://api.argy.cloud/v1/auth/device/start \
-H "Content-Type: application/json" \
-d '{ "locale": "en" }'
Response 200:
| Field | Description |
|---|---|
deviceCode | Secret code the tool keeps to poll for the token. |
userCode | Short code the user enters or recognizes in the browser. |
verificationUri | Approval page to open. |
verificationUriComplete | Same page, with the code already filled in. |
expiresIn | Lifetime of the flow: 600 seconds. |
interval | Minimum interval between two polls: 5 seconds. |
2. Get the user's approval
The user opens verificationUriComplete, signs in if needed, then approves or denies the request.
3. Poll for the token
POST /v1/auth/device/token (public), with the body { "deviceCode": "..." }. Call it every interval seconds until you get a final answer.
curl -X POST https://api.argy.cloud/v1/auth/device/token \
-H "Content-Type: application/json" \
-d '{ "deviceCode": "'"$DEVICE_CODE"'" }'
Response 200 once the request is approved: accessToken, refreshToken, expiresIn, tokenType.
Until the response is a success, the error code tells you what to do:
| Status | Code | Meaning | Action |
|---|---|---|---|
| 400 | authorization_pending | The user has not approved yet. | Retry after interval seconds. |
| 400 | slow_down | Polling too often. | Increase the interval between calls. |
| 400 | access_denied | The user denied the request. | Stop; start a new flow if needed. |
| 400 | expired_token | The code has expired. | Restart from step 1. |
| 401 | INVALID_DEVICE_CODE | Unknown or already consumed code. | Restart from step 1. |
A token is only issued for an active account: a suspended account gets 401 instead of a token.
Personal access tokens (PAT)
A PAT is a long-lived token tied to your account, designed for scripts, CI and non-interactive tools. It is created from the portal: see Settings and identity. It can also be given to Argy Code with argy auth login --pat or the ARGY_PAT variable (CLI reference).
Create a PAT
Creation goes through an interactive user session, typically the portal. A PAT therefore cannot create or extend another PAT.
POST /v1/pats: interactive session required. Response 201.
| Field | Type | Default | Description |
|---|---|---|---|
name | string | required | Token name, to recognize it in the list. |
expiresAt | string | required | Expiration date in ISO 8601 format. |
permissions | string[] | - | Restricts the token to these permissions, in resource:action form (e.g. rag:read). See PAT rights. |
format | string | signed | signed (signed JWT) or opaque-v2 (short token, pat_v2_ prefix). |
If name or expiresAt is missing, or the date is invalid, the response is 400 BAD_REQUEST. Outside an interactive session it is 403 PAT_MANAGEMENT_REQUIRES_SESSION.
The token value is shown only once, at creation: store it in a secrets manager and expose it to your tools through ARGY_PAT. The signed format is the one Argy Code requires.
PAT rights
The permissions field determines the token's rights. Three cases apply:
Value of permissions | PAT rights |
|---|---|
| Field omitted | The PAT keeps its creator's current rights. It is not restricted. |
| Explicit non-empty list | The PAT is restricted to those permissions, within the ones its creator actually holds. |
| Empty list | Rejected: 400 with the code INVALID_PAT_PERMISSIONS. |
If you request a permission you do not hold, creation fails with 403 PAT_PERMISSION_NOT_HELD. A restricted PAT carries no roles, only the listed permissions.
For an automation, always give an explicit list: omitting the field hands over a token as powerful as your account.
Choose permissions
Always limit a PAT to the permissions the integration needs. The most common ones for an integrator:
| Permission | Opens |
|---|---|
rag:read, rag:write | RAG API |
project:read, project:write, project:deploy | Projects and deployments (platform API) |
module:read, module:write | Module catalog and bundles |
studio:read, studio:write | Studio |
pipeline:read, pipeline:write | Runs and observability |
notifications:read, notifications:manage | Notifications |
billing:read | Read-only subscription, consumption and invoices |
governance:read, governance:write | Policies and audit logs |
argy_ai:use, llm:manage | AI usage and administration (LLM Gateway) |
Some permissions are sensitive (for example llm:read_raw, which grants access to unfiltered audit traces): delegate them only deliberately.
List and revoke
| Method and path | Authentication | Description |
|---|---|---|
GET /v1/pats | User session | Lists your PATs. |
DELETE /v1/pats/{id} | Interactive session | Revokes a PAT. |
Revoke a PAT as soon as it is exposed or no longer needed.
curl https://api.argy.cloud/v1/organizations/me \
-H "Authorization: Bearer $ARGY_PAT"
This call is a simple way to check that a token is accepted.
JWTs and renewal
Session access tokens (obtained through device code or sign-in) are signed JWTs.
To renew a session: POST /v1/auth/refresh (public) with { "refreshToken": "..." }. Response 200 with new tokens. POST /v1/auth/logout ends the session.
The token identifies your tenant and organizations. If you send X-Tenant-Id or X-Org-Id, they must match the token (see the API overview).
SSO, SCIM and MFA
SSO, SCIM, passkeys and MFA are configured by an administrator in the portal: see Settings and identity. On the integrator side, these points are useful:
- OIDC:
GET /v1/auth/login/oidcredirects to your identity provider, thenGET /v1/auth/callback/oidcopens the session. - SAML:
GET /v1/auth/saml/loginredirects to your SAML provider. It expectstenantId(as a query parameter or thex-tenant-idheader) andredirect_uri. Without a tenant, the response is400 TENANT_ID_REQUIRED. - SCIM 2.0: automatic account provisioning from your identity provider is turned on in the portal, where the administrator enters and saves the SCIM token and the SCIM base URL (see Settings and identity).
- MFA and passkeys: enrollment and management of authentication factors are done from the portal (see Settings and identity).
Tenants, organizations and roles
Every token is tied to a tenant and to the user's organizations. A request never sees another tenant's data.
| Method and path | Description |
|---|---|
GET /v1/users/me | The caller's profile. |
GET /v1/organizations/me | Organizations the caller belongs to. |
GET /v1/roles | Roles available in the tenant, including custom roles. |
Permissions come from the user's roles; a PAT created with a list of permissions is limited to those. Custom roles are built in the portal (Settings and identity). Granting a sensitive permission to a custom role is controlled and can be refused with SENSITIVE_PERMISSION_FORBIDDEN.
Common errors
| Status | Code | Cause | Action |
|---|---|---|---|
| 401 | UNAUTHORIZED | Missing, invalid, expired or revoked token. | Get a new token or renew the session. |
| 403 | FORBIDDEN | The token lacks the route's permission. | Create a PAT with the required permission. |
| 403 | PAT_MANAGEMENT_REQUIRES_SESSION | PAT creation or revocation outside an interactive session. | Use the portal. |
| 400 | BAD_REQUEST | name or expiresAt missing, invalid date. | Fix the request body. |
| 410 | PASSWORD_AUTH_DISABLED | Password sign-in attempt. | Use passkey, magic link, SSO or device code. |
| 401 | INVALID_DEVICE_CODE | Unknown or expired device code. | Restart the device code flow. |
See also
- API overview: conventions and error envelope
- Settings and identity: create a PAT, configure SSO, SCIM, passkeys and roles
- Argy Code CLI reference:
argy auth login,--patandARGY_PAT - Platform API, RAG API and LLM Gateway
- Security model