Skip to content

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

NeedRecommended methodSection
Command-line tool or agent on a workstationDevice code (RFC 8628)Device code
Script, CI/CD, non-interactive integrationPersonal access token (PAT)Personal access tokens
Application that already holds an Argy sessionArgy JWT, renewed with refreshJWTs and renewal
Signing in your company's usersSSO (OIDC or SAML), SCIM for provisioningSSO, 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).

FieldTypeDefaultDescription
localestringenLanguage 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:

FieldDescription
deviceCodeSecret code the tool keeps to poll for the token.
userCodeShort code the user enters or recognizes in the browser.
verificationUriApproval page to open.
verificationUriCompleteSame page, with the code already filled in.
expiresInLifetime of the flow: 600 seconds.
intervalMinimum 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:

StatusCodeMeaningAction
400authorization_pendingThe user has not approved yet.Retry after interval seconds.
400slow_downPolling too often.Increase the interval between calls.
400access_deniedThe user denied the request.Stop; start a new flow if needed.
400expired_tokenThe code has expired.Restart from step 1.
401INVALID_DEVICE_CODEUnknown 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.

FieldTypeDefaultDescription
namestringrequiredToken name, to recognize it in the list.
expiresAtstringrequiredExpiration date in ISO 8601 format.
permissionsstring[]-Restricts the token to these permissions, in resource:action form (e.g. rag:read). See PAT rights.
formatstringsignedsigned (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 permissionsPAT rights
Field omittedThe PAT keeps its creator's current rights. It is not restricted.
Explicit non-empty listThe PAT is restricted to those permissions, within the ones its creator actually holds.
Empty listRejected: 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:

PermissionOpens
rag:read, rag:writeRAG API
project:read, project:write, project:deployProjects and deployments (platform API)
module:read, module:writeModule catalog and bundles
studio:read, studio:writeStudio
pipeline:read, pipeline:writeRuns and observability
notifications:read, notifications:manageNotifications
billing:readRead-only subscription, consumption and invoices
governance:read, governance:writePolicies and audit logs
argy_ai:use, llm:manageAI 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 pathAuthenticationDescription
GET /v1/patsUser sessionLists your PATs.
DELETE /v1/pats/{id}Interactive sessionRevokes 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/oidc redirects to your identity provider, then GET /v1/auth/callback/oidc opens the session.
  • SAML: GET /v1/auth/saml/login redirects to your SAML provider. It expects tenantId (as a query parameter or the x-tenant-id header) and redirect_uri. Without a tenant, the response is 400 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 pathDescription
GET /v1/users/meThe caller's profile.
GET /v1/organizations/meOrganizations the caller belongs to.
GET /v1/rolesRoles 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

StatusCodeCauseAction
401UNAUTHORIZEDMissing, invalid, expired or revoked token.Get a new token or renew the session.
403FORBIDDENThe token lacks the route's permission.Create a PAT with the required permission.
403PAT_MANAGEMENT_REQUIRES_SESSIONPAT creation or revocation outside an interactive session.Use the portal.
400BAD_REQUESTname or expiresAt missing, invalid date.Fix the request body.
410PASSWORD_AUTH_DISABLEDPassword sign-in attempt.Use passkey, magic link, SSO or device code.
401INVALID_DEVICE_CODEUnknown or expired device code.Restart the device code flow.

See also